Ensure domain info is in CloudComputeContext
Ensure domain info is in CloudComputeContext. The nova.conf template is already setup to render the domain if it present. There is aslo a drive-by fix to two unit tests which were failing locally due to a missing mock. Change-Id: I4f2fd2cf7fcfbb009589907ce1f6245f0121ecd9 Cloaes-Bug: 1830536
This commit is contained in:
parent
a190b7f09a
commit
fe05ccb11f
@ -554,6 +554,9 @@ class CloudComputeContext(context.OSContextGenerator):
|
||||
'neutron_plugin': _neutron_plugin(),
|
||||
'neutron_url': url,
|
||||
}
|
||||
admin_domain = relation_get('admin_domain_name', **rel)
|
||||
if admin_domain:
|
||||
neutron_ctxt['neutron_admin_domain_name'] = admin_domain
|
||||
|
||||
missing = [k for k, v in neutron_ctxt.items() if v in ['', None]]
|
||||
if missing:
|
||||
@ -661,6 +664,9 @@ class CloudComputeContext(context.OSContextGenerator):
|
||||
ctxt['auth_host'] = net_manager.get('keystone_host')
|
||||
ctxt['auth_port'] = net_manager.get('auth_port')
|
||||
ctxt['api_version'] = net_manager.get('api_version')
|
||||
if net_manager.get('neutron_admin_domain_name'):
|
||||
ctxt['admin_domain_name'] = net_manager.get(
|
||||
'neutron_admin_domain_name')
|
||||
else:
|
||||
ctxt['network_manager'] = self.network_manager
|
||||
ctxt['network_manager_config'] = net_manager
|
||||
|
@ -44,6 +44,7 @@ NEUTRON_CONTEXT = {
|
||||
'service_tenant_name': 'admin',
|
||||
'service_username': 'admin',
|
||||
'service_password': 'openstack',
|
||||
'admin_domain_name': 'admin_domain',
|
||||
'quantum_security_groups': 'yes',
|
||||
'quantum_plugin': 'ovs',
|
||||
'auth_host': 'keystone_host',
|
||||
@ -210,6 +211,7 @@ class NovaComputeContextTests(CharmTestCase):
|
||||
'neutron_admin_password': 'openstack',
|
||||
'neutron_admin_tenant_name': 'admin',
|
||||
'neutron_admin_username': 'admin',
|
||||
'neutron_admin_domain_name': 'admin_domain',
|
||||
'neutron_auth_strategy': 'keystone',
|
||||
'neutron_plugin': 'ovs',
|
||||
'neutron_security_groups': True,
|
||||
@ -221,6 +223,7 @@ class NovaComputeContextTests(CharmTestCase):
|
||||
'admin_tenant_name': 'admin',
|
||||
'admin_user': 'admin',
|
||||
'admin_password': 'openstack',
|
||||
'admin_domain_name': 'admin_domain',
|
||||
'auth_port': '5000',
|
||||
'auth_protocol': 'https',
|
||||
'auth_host': 'keystone_host',
|
||||
|
@ -497,21 +497,21 @@ class NovaComputeUtilsTests(CharmTestCase):
|
||||
self.assertEqual(set(ex[k]['services']),
|
||||
set(result[k]['services']))
|
||||
|
||||
@patch.object(utils, 'os')
|
||||
@patch.object(utils.os.path, 'exists')
|
||||
@patch.object(utils, 'nova_metadata_requirement')
|
||||
@patch.object(utils, 'network_manager')
|
||||
def test_resource_map_neutron(self, net_man, en_meta, _os):
|
||||
def test_resource_map_neutron(self, net_man, en_meta, exists):
|
||||
exists.return_value = True
|
||||
self.os_release.return_value = 'diablo'
|
||||
_os.path.exists.return_value = True
|
||||
self._test_resource_map_neutron(net_man, en_meta, 'libvirt-bin')
|
||||
|
||||
@patch.object(utils, 'os')
|
||||
@patch.object(utils.os.path, 'exists')
|
||||
@patch.object(utils, 'nova_metadata_requirement')
|
||||
@patch.object(utils, 'network_manager')
|
||||
def test_resource_map_neutron_yakkety(self, net_man, en_meta, _os):
|
||||
def test_resource_map_neutron_yakkety(self, net_man, en_meta, exists):
|
||||
exists.return_value = True
|
||||
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'yakkety'}
|
||||
self.os_release.return_value = 'diablo'
|
||||
_os.path.exists.return_value = True
|
||||
self._test_resource_map_neutron(net_man, en_meta, 'libvirtd')
|
||||
|
||||
@patch.object(utils, 'nova_metadata_requirement')
|
||||
|
Loading…
x
Reference in New Issue
Block a user