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
if is_backup:
service = is_backup['services']
if not service or service[0]['state'] == 'down':
conf.set('volume-feature-enabled', 'backup', 'False')
else:
# post_configuration method is called with every volume (v2,
# v3) service, therefore set the value with priority so that it
# can't be overrided by this method called from other instance
# of volume service
conf.set('volume-feature-enabled', 'backup', 'True',
priority=True)
services = is_backup['services']
backup_enabled = 'False'
for service in services:
if service['state'] == 'up':
backup_enabled = 'True'
break
# post_configuration method is called with every volume (v2,
# v3) service, therefore set the value with priority so that it
# can't be overrided by this method called from other instance
# of volume service
conf.set('volume-feature-enabled', 'backup', backup_enabled,
priority=True)