Fix cinder-backup logic

When you have several controllers, if the first controller have
cinder-backup service disabled, the pacemaker return it as down, and so
the cinder-backup is set to False, even though it is running in a
different controller.
This patch do a loop to check if the cinder-backup is enabled in other
controllers, if so return it as True.

Change-Id: I3a16ec4f7b45267fcb8f9c6d01f28fe40faf7661
This commit is contained in:
Arx Cruz 2022-07-08 17:22:17 +02:00
parent a8aaad54f6
commit ea78088ecb
1 changed files with 13 additions and 10 deletions

View File

@ -94,13 +94,16 @@ class VolumeService(VersionedService):
return return
if is_backup: if is_backup:
service = is_backup['services'] services = is_backup['services']
if not service or service[0]['state'] == 'down': backup_enabled = 'False'
conf.set('volume-feature-enabled', 'backup', 'False') for service in services:
else: if service['state'] == 'up':
# post_configuration method is called with every volume (v2, backup_enabled = 'True'
# v3) service, therefore set the value with priority so that it break
# can't be overrided by this method called from other instance
# of volume service # post_configuration method is called with every volume (v2,
conf.set('volume-feature-enabled', 'backup', 'True', # v3) service, therefore set the value with priority so that it
priority=True) # can't be overrided by this method called from other instance
# of volume service
conf.set('volume-feature-enabled', 'backup', backup_enabled,
priority=True)