2020-10-26 09:50:37 |
ZhaoYixin |
description |
when I stop all cinder-backup service,
cinder service-list
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
| cinder-backup | stor01 | nova | enabled | down | 2020-10-26T08:43:36.000000 | - |
| cinder-backup | stor02 | nova | enabled | down | 2020-10-26T08:44:11.000000 | - |
| cinder-backup | stor03 | nova | enabled | down | 2020-10-26T09:32:49.000000 | - |
| cinder-backup | stor04 | nova | enabled | down | 2020-10-26T09:33:04.000000 | - |
| cinder-scheduler | ctl01 | nova | enabled | up | 2020-10-26T09:34:04.000000 | - |
| cinder-volume | stor01@ceph | nova | enabled | up | 2020-10-26T09:34:07.000000 | - |
| ...... | ...... | ...... | ...... |...... | ...... | - |
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
all cinder-backup service state is down.
run command 'cinder backup-create <volume_id> --name backup'
cinder-scheduler still choose one down state cinder-backup host.
########################################
Solution is add to judge whether the service is up in the 'is_good_service' method.
########################################
def _list_backup_services(self, availability_zone, driver=None):
"""List all enabled backup services.
:returns: list -- hosts for services that are enabled for backup.
"""
services = []
def _is_good_service(cap, driver, az):
if driver is None and az is None:
return True
match_driver = cap['driver_name'] == driver if driver else True
if match_driver:
if not az:
return True
return cap['availability_zone'] == az
return False
for backend, capabilities in self.backup_service_states.items():
if capabilities['backend_state']:
if _is_good_service(capabilities, driver, availability_zone):
services.append(backend)
return services |
when I stop all cinder-backup service,
cinder service-list
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
| cinder-backup | stor01 | nova | enabled | down | 2020-10-26T08:43:36.000000 | - |
| cinder-backup | stor02 | nova | enabled | down | 2020-10-26T08:44:11.000000 | - |
| cinder-backup | stor03 | nova | enabled | down | 2020-10-26T09:32:49.000000 | - |
| cinder-backup | stor04 | nova | enabled | down | 2020-10-26T09:33:04.000000 | - |
| cinder-scheduler | ctl01 | nova | enabled | up | 2020-10-26T09:34:04.000000 | - |
| cinder-volume | stor01@ceph | nova | enabled | up | 2020-10-26T09:34:07.000000 | - |
| ...... | ...... | ...... | ...... |...... | ...... | - |
+------------------+-------------------------+---------+---------+-------+----------------------------+-----------------+
all cinder-backup service state is down.
run command 'cinder backup-create <volume_id> --name backup'
cinder-scheduler still choose one down state cinder-backup host.
########################################
Solution is add to judge whether the service is up.
########################################
def _list_backup_services(self, availability_zone, driver=None):
"""List all enabled backup services.
:returns: list -- hosts for services that are enabled for backup.
"""
services = []
def _is_good_service(cap, driver, az):
if driver is None and az is None:
return True
match_driver = cap['driver_name'] == driver if driver else True
if match_driver:
if not az:
return True
return cap['availability_zone'] == az
return False
for backend, capabilities in self.backup_service_states.items():
if capabilities['backend_state']:
if _is_good_service(capabilities, driver, availability_zone):
services.append(backend)
return services |
|