Add support for cinder-backup subordinate
This commit is contained in:
parent
15f52309b9
commit
171ac119a0
1
hooks/backup-backend-relation-broken
Symbolic link
1
hooks/backup-backend-relation-broken
Symbolic link
@ -0,0 +1 @@
|
||||
cinder_hooks.py
|
1
hooks/backup-backend-relation-changed
Symbolic link
1
hooks/backup-backend-relation-changed
Symbolic link
@ -0,0 +1 @@
|
||||
cinder_hooks.py
|
1
hooks/backup-backend-relation-departed
Symbolic link
1
hooks/backup-backend-relation-departed
Symbolic link
@ -0,0 +1 @@
|
||||
cinder_hooks.py
|
1
hooks/backup-backend-relation-joined
Symbolic link
1
hooks/backup-backend-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
cinder_hooks.py
|
@ -3,12 +3,15 @@ from charmhelpers.core.hookenv import (
|
||||
relation_ids,
|
||||
service_name,
|
||||
related_units,
|
||||
relation_get
|
||||
relation_get,
|
||||
log,
|
||||
DEBUG,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.context import (
|
||||
OSContextGenerator,
|
||||
ApacheSSLContext as SSLContext,
|
||||
SubordinateConfigContext as BaseSubordinateConfigContext,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
@ -20,6 +23,9 @@ from charmhelpers.contrib.hahelpers.cluster import (
|
||||
determine_api_port,
|
||||
)
|
||||
|
||||
CINDER_CONF_DIR = "/etc/cinder"
|
||||
CINDER_CONF = '%s/cinder.conf' % CINDER_CONF_DIR
|
||||
|
||||
|
||||
class ImageServiceContext(OSContextGenerator):
|
||||
interfaces = ['image-service']
|
||||
@ -106,6 +112,26 @@ class StorageBackendContext(OSContextGenerator):
|
||||
return {}
|
||||
|
||||
|
||||
class SubordinateConfigContext(OSContextGenerator):
|
||||
def __call__(self):
|
||||
cls = BaseSubordinateConfigContext
|
||||
ctxt1 = cls(interface='storage-backend',
|
||||
service='cinder',
|
||||
config_file=CINDER_CONF)()
|
||||
ctxt2 = cls(interface='backup-backend',
|
||||
service='cinder',
|
||||
config_file=CINDER_CONF)()
|
||||
|
||||
for key in ctxt2:
|
||||
if key not in ctxt1:
|
||||
ctxt1[key] = ctxt2[key]
|
||||
ctxt1[key] += ctxt2[key]
|
||||
else:
|
||||
ctxt1[key].update(ctxt2[key])
|
||||
|
||||
return ctxt1
|
||||
|
||||
|
||||
class LoggingConfigContext(OSContextGenerator):
|
||||
|
||||
def __call__(self):
|
||||
|
@ -140,6 +140,10 @@ def config_changed():
|
||||
for rid in relation_ids('storage-backend'):
|
||||
relation_set(relation_id=rid,
|
||||
upgrade_nonce=uuid.uuid4())
|
||||
# NOTE(hopem) tell any backup-backends we just upgraded
|
||||
for rid in relation_ids('backup-backend'):
|
||||
relation_set(relation_id=rid,
|
||||
upgrade_nonce=uuid.uuid4())
|
||||
|
||||
CONFIGS.write_all()
|
||||
configure_https()
|
||||
@ -500,6 +504,13 @@ def storage_backend():
|
||||
CONFIGS.write(CINDER_CONF)
|
||||
|
||||
|
||||
@hooks.hook('backup-backend-relation-changed')
|
||||
@hooks.hook('backup-backend-relation-broken')
|
||||
@restart_on_change(restart_map())
|
||||
def backup_backend():
|
||||
CONFIGS.write(CINDER_CONF)
|
||||
|
||||
|
||||
@hooks.hook('nrpe-external-master-relation-joined',
|
||||
'nrpe-external-master-relation-changed')
|
||||
def update_nrpe_config():
|
||||
|
@ -161,10 +161,7 @@ CONFIG_FILES = OrderedDict([
|
||||
cinder_contexts.CephContext(),
|
||||
cinder_contexts.HAProxyContext(),
|
||||
cinder_contexts.ImageServiceContext(),
|
||||
context.SubordinateConfigContext(
|
||||
interface='storage-backend',
|
||||
service='cinder',
|
||||
config_file=CINDER_CONF),
|
||||
cinder_contexts.SubordinateConfigContext(),
|
||||
cinder_contexts.StorageBackendContext(),
|
||||
cinder_contexts.LoggingConfigContext(),
|
||||
context.IdentityServiceContext(
|
||||
|
@ -30,6 +30,9 @@ requires:
|
||||
storage-backend:
|
||||
interface: cinder-backend
|
||||
scope: container
|
||||
backup-backend:
|
||||
interface: cinder-backup
|
||||
scope: container
|
||||
peers:
|
||||
cluster:
|
||||
interface: cinder-ha
|
||||
|
Loading…
Reference in New Issue
Block a user