Choose state 'down' host when scheduler get backup host

Bug #1901503 reported by ZhaoYixin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
ZhaoYixin

Bug 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.

########################################

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

ZhaoYixin (zhaoyixin)
Changed in cinder:
assignee: nobody → ZHAOYIXIN (zhaoyixinlc)
ZhaoYixin (zhaoyixin)
description: updated
ZhaoYixin (zhaoyixin)
Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/759786

tags: added: backup-service
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.