Set cross_az_attach setting on cloud-compute relation
Communicate to compute services the cross_az_attach config setting. Since the cross_az_attach setting needs to be applied at the compute node, update the relation settings to specify the cross_az_attach policy configured. Change-Id: I71e97453453d5d091449caf547e68c6455d091cf Closes-Bug: #1899084
This commit is contained in:
parent
77a1bee1f2
commit
198c9e7d6e
@ -654,6 +654,7 @@ def get_compute_config(remote_restart=False):
|
|||||||
# this may not even be needed.
|
# this may not even be needed.
|
||||||
'ec2_host': hookenv.unit_get('private-address'),
|
'ec2_host': hookenv.unit_get('private-address'),
|
||||||
'region': hookenv.config('region'),
|
'region': hookenv.config('region'),
|
||||||
|
'cross_az_attach': hookenv.config('cross-az-attach'),
|
||||||
}
|
}
|
||||||
rel_settings.update(console_settings())
|
rel_settings.update(console_settings())
|
||||||
rel_settings.update(ncc_utils.serial_console_settings())
|
rel_settings.update(ncc_utils.serial_console_settings())
|
||||||
@ -719,6 +720,18 @@ def set_region_on_relation_from_config(rid=None):
|
|||||||
hookenv.relation_set(relation_id=rid, region=hookenv.config('region'))
|
hookenv.relation_set(relation_id=rid, region=hookenv.config('region'))
|
||||||
|
|
||||||
|
|
||||||
|
def set_cross_az_attach_on_relation_from_config(rid=None):
|
||||||
|
"""Helper function that sets the cross-az-attach policy for that relation
|
||||||
|
to trigger a change for any units that see it differently.
|
||||||
|
|
||||||
|
:param rid: The relation to set, or if None, the current one related
|
||||||
|
to the hook.
|
||||||
|
:type rid: Union[str, None]
|
||||||
|
"""
|
||||||
|
hookenv.relation_set(relation_id=rid,
|
||||||
|
cross_az_attach=hookenv.config('cross-az-attach'))
|
||||||
|
|
||||||
|
|
||||||
def update_ssh_keys_and_notify_compute_units(rid=None, unit=None):
|
def update_ssh_keys_and_notify_compute_units(rid=None, unit=None):
|
||||||
"""Update and notify the collected ssh keys to nova-compute units
|
"""Update and notify the collected ssh keys to nova-compute units
|
||||||
|
|
||||||
@ -1174,6 +1187,7 @@ def upgrade_charm():
|
|||||||
identity_joined(rid=r_id)
|
identity_joined(rid=r_id)
|
||||||
for r_id in hookenv.relation_ids('cloud-compute'):
|
for r_id in hookenv.relation_ids('cloud-compute'):
|
||||||
set_region_on_relation_from_config(r_id)
|
set_region_on_relation_from_config(r_id)
|
||||||
|
set_cross_az_attach_on_relation_from_config(r_id)
|
||||||
for unit in hookenv.related_units(r_id):
|
for unit in hookenv.related_units(r_id):
|
||||||
update_ssh_keys_and_notify_compute_units(r_id, unit)
|
update_ssh_keys_and_notify_compute_units(r_id, unit)
|
||||||
for r_id in hookenv.relation_ids('shared-db'):
|
for r_id in hookenv.relation_ids('shared-db'):
|
||||||
|
@ -615,6 +615,7 @@ class NovaCCHooksTests(CharmTestCase):
|
|||||||
console_access_protocol=None,
|
console_access_protocol=None,
|
||||||
ca_cert='foocert64',
|
ca_cert='foocert64',
|
||||||
region='RegionOne',
|
region='RegionOne',
|
||||||
|
cross_az_attach=True,
|
||||||
volume_service='cinder',
|
volume_service='cinder',
|
||||||
ec2_host='nova-cc-host1',
|
ec2_host='nova-cc-host1',
|
||||||
network_manager='neutron',
|
network_manager='neutron',
|
||||||
@ -657,6 +658,7 @@ class NovaCCHooksTests(CharmTestCase):
|
|||||||
quantum_host='nova-cc-host1',
|
quantum_host='nova-cc-host1',
|
||||||
quantum_security_groups='yes',
|
quantum_security_groups='yes',
|
||||||
region='RegionOne',
|
region='RegionOne',
|
||||||
|
cross_az_attach=True,
|
||||||
volume_service='cinder',
|
volume_service='cinder',
|
||||||
ec2_host='nova-cc-host1',
|
ec2_host='nova-cc-host1',
|
||||||
quantum_plugin='bob',
|
quantum_plugin='bob',
|
||||||
|
Loading…
Reference in New Issue
Block a user