Merge "Group cinder-volume services using cluster config"

This commit is contained in:
Zuul 2021-10-01 09:09:30 +00:00 committed by Gerrit Code Review
commit 6bc43bd756
2 changed files with 27 additions and 2 deletions

View File

@ -194,10 +194,18 @@ class CinderSubordinateConfigContext(SubordinateConfigContext):
any_stateless = any_stateless or stateless
if stateless:
cmp_os_release = CompareOpenStackReleases(
os_release('cinder-common'))
clustering_config = ('cluster' if cmp_os_release >= "ocata"
else 'host')
if 'DEFAULT' in ctxt['sections']:
ctxt['sections']['DEFAULT'].append(('host', service_name()))
ctxt['sections']['DEFAULT'].append(
(clustering_config, service_name()))
else:
ctxt['sections']['DEFAULT'] = [('host', service_name())]
ctxt['sections']['DEFAULT'] = [
(clustering_config, service_name())]
elif any_stateless:
log("One or more stateless backends configured but unable to "

View File

@ -312,6 +312,23 @@ class TestCinderContext(CharmTestCase):
mock_rel_get.side_effect = fake_rel_get
self.relation_get.side_effect = fake_rel_get
self.os_release.return_value = 'ocata'
ctxt = contexts.CinderSubordinateConfigContext(
interface='storage-backend',
service='cinder',
config_file='/etc/cinder/cinder.conf')()
exp = {'sections': {'DEFAULT': [('cluster', 'cinder')],
u'cinder-ceph': [[u'volume_backend_name', u'cinder-ceph'],
[u'volume_driver',
u'cinder.volume.drivers.rbd.RBDDriver'],
[u'rbd_pool', u'cinder-ceph'],
[u'rbd_user', u'cinder-ceph']]}}
self.assertEqual(ctxt, exp)
self.os_release.return_value = 'newton'
ctxt = contexts.CinderSubordinateConfigContext(
interface='storage-backend',