Adding support for cross_az_attach config option.
Allow attach between instance and volume in different availability zones. If False, volumes attached to an instance must be in the same availability zone in Cinder as the instance availability zone in Nova. Change-Id: I21df8e0dfa585133c5ef6a55cdbbc2071c267424 Closes-Bug: #1856776
This commit is contained in:
parent
6e3aacb08f
commit
ab6398463a
17
config.yaml
17
config.yaml
@ -639,3 +639,20 @@ options:
|
||||
default notification format unversioned until this is implemented.
|
||||
.
|
||||
Possible Values are both, versioned, unversioned.
|
||||
cross-az-attach: # LP: 1856776
|
||||
type: boolean
|
||||
default: True # OpenStack default value
|
||||
description: |
|
||||
Allow attach between instance and volume in different availability zones.
|
||||
.
|
||||
If False, volumes attached to an instance must be in the same
|
||||
availability zone in Cinder as the instance availability zone in Nova.
|
||||
This also means care should be taken when booting an instance from a
|
||||
volume where source is not "volume" because Nova will attempt to create
|
||||
a volume using the same availability zone as what is assigned to the
|
||||
instance.
|
||||
.
|
||||
If that AZ is not in Cinder, the volume create request will fail and the
|
||||
instance will fail the build request.
|
||||
.
|
||||
By default there is no availability zone restriction on volume attach.
|
@ -283,6 +283,13 @@ def canonical_url():
|
||||
return '%s://%s' % (scheme, ch_network_ip.format_ipv6_addr(addr) or addr)
|
||||
|
||||
|
||||
class CinderConfigContext(ch_context.OSContextGenerator):
|
||||
def __call__(self):
|
||||
return {
|
||||
'cross_az_attach': hookenv.config('cross-az-attach')
|
||||
}
|
||||
|
||||
|
||||
class NeutronCCContext(ch_context.NeutronContext):
|
||||
interfaces = ['quantum-network-service', 'neutron-network-service']
|
||||
|
||||
|
@ -178,6 +178,7 @@ def get_base_resource_map():
|
||||
nova_cc_context.VolumeServiceContext(),
|
||||
ch_context.ZeroMQContext(),
|
||||
ch_context.NotificationDriverContext(),
|
||||
nova_cc_context.CinderConfigContext(),
|
||||
nova_cc_context.NovaIPv6Context(),
|
||||
nova_cc_context.NeutronCCContext(),
|
||||
nova_cc_context.NovaConfigContext(),
|
||||
|
@ -6,4 +6,5 @@ catalog_info = {{ volume_catalog_info }}
|
||||
{% if region -%}
|
||||
os_region_name = {{ region }}
|
||||
{% endif %}
|
||||
cross_az_attach = {{ cross_az_attach }}
|
||||
{% endif -%}
|
||||
|
@ -523,6 +523,15 @@ class NovaComputeContextTests(CharmTestCase):
|
||||
ctxt = context.NeutronAPIContext()()
|
||||
self.assertEqual(ctxt, expected)
|
||||
|
||||
def test_CinderContext(self):
|
||||
self.test_config.update({'cross-az-attach': False, })
|
||||
ctxt = context.CinderConfigContext()()
|
||||
self.assertEqual({'cross_az_attach': False}, ctxt)
|
||||
|
||||
self.test_config.update({'cross-az-attach': True, })
|
||||
ctxt = context.CinderConfigContext()()
|
||||
self.assertEqual({'cross_az_attach': True}, ctxt)
|
||||
|
||||
@mock.patch('charmhelpers.contrib.openstack.context.'
|
||||
'NovaVendorMetadataContext.__call__')
|
||||
def test_vendordata_static_and_dynamic(self, parent):
|
||||
|
Loading…
x
Reference in New Issue
Block a user