diff --git a/config_tempest/services/volume.py b/config_tempest/services/volume.py index 4f30e30d..48eca8bb 100644 --- a/config_tempest/services/volume.py +++ b/config_tempest/services/volume.py @@ -61,9 +61,10 @@ class VolumeService(VersionedService): def post_configuration(self, conf, is_service): # Verify if the cinder backup service is enabled - if not is_service(**{"type": "volumev3"}): + if not is_service(name=self.name): C.LOG.info("No volume service found, " "skipping backup service check") + conf.set('volume-feature-enabled', 'backup', 'False') return try: params = {'binary': 'cinder-backup'} @@ -71,11 +72,17 @@ class VolumeService(VersionedService): except exceptions.Forbidden: C.LOG.warning("User has no permissions to list services - " "cinder-backup service can't be discovered.") + conf.set('volume-feature-enabled', 'backup', 'False') return if is_backup: - # We only set backup to false if the service isn't running - # otherwise we keep the default value 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) diff --git a/config_tempest/tests/services/test_volume.py b/config_tempest/tests/services/test_volume.py index 02b1ba07..53f61ee2 100644 --- a/config_tempest/tests/services/test_volume.py +++ b/config_tempest/tests/services/test_volume.py @@ -44,6 +44,8 @@ class TestVolumeService(BaseServiceTest): mock_is_service.return_value = False self.Service.post_configuration(self.conf, mock_is_service) self.assertTrue(mock_logging.info.called) + self.assertEqual(self.conf.get('volume-feature-enabled', 'backup'), + 'False') @mock.patch('config_tempest.services.services.Services.is_service') def test_post_configuration_state_down(self, mock_is_service):