Group cinder-volume services using cluster config

Usage of "host" config for grouping cinder-volume
services for the purpose of stateless config and/or
active-active HA is not recommended.

The usage of "cluster" config is recommended for
achieving that behavior. This change replaces the
usage of "host" with "cluster".

Change-Id: I249ce179cfdaf2394ee4e8481a8c9644d667ea99
Closes-bug: #1945239
This commit is contained in:
Rodrigo Barbieri 2021-09-28 15:37:15 -03:00
parent 08ac296df1
commit 2603a774b1
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',