Avoid installing quantum/neutron agents on the CC.
This commit is contained in:
parent
e2e8de070e
commit
27bfbc9822
@ -131,9 +131,11 @@ class NeutronCCContext(context.NeutronContext):
|
||||
config('quantum-security-groups'))
|
||||
return sec_groups.lower() == 'yes'
|
||||
|
||||
# TODO: We can override __call__ here to do the quantum ext
|
||||
# net configuration. Need to set default_floating_pool
|
||||
# in that case.
|
||||
def _ensure_packages(self):
|
||||
# Only compute nodes need to ensure packages here, to install
|
||||
# required agents.
|
||||
return
|
||||
|
||||
|
||||
class IdentityServiceContext(context.IdentityServiceContext):
|
||||
def __call__(self):
|
||||
|
@ -138,16 +138,17 @@ def resource_map():
|
||||
[resource_map.pop(k) for k in list(resource_map.iterkeys())
|
||||
if 'neutron' in k]
|
||||
|
||||
# add neutron plugin requirements.
|
||||
# add neutron plugin requirements. nova-c-c only needs the neutron-server
|
||||
# associated with configs, not the plugin agent.
|
||||
if net_manager in ['quantum', 'neutron']:
|
||||
plugin = neutron_plugin()
|
||||
if plugin:
|
||||
conf = neutron_plugin_attribute(plugin, 'config', net_manager)
|
||||
svcs = neutron_plugin_attribute(plugin, 'services', net_manager)
|
||||
service = '%s-server' % net_manager
|
||||
ctxts = (neutron_plugin_attribute(plugin, 'contexts', net_manager)
|
||||
or [])
|
||||
resource_map[conf] = {}
|
||||
resource_map[conf]['services'] = svcs
|
||||
resource_map[conf]['services'] = [service]
|
||||
resource_map[conf]['contexts'] = ctxts
|
||||
resource_map[conf]['contexts'].append(
|
||||
nova_cc_context.NeutronCCContext())
|
||||
|
@ -71,10 +71,41 @@ RESTART_MAP = OrderedDict([
|
||||
]),
|
||||
('/etc/neutron/neutron.conf', ['neutron-server']),
|
||||
('/etc/haproxy/haproxy.cfg', ['haproxy']),
|
||||
('/etc/apache2/sites-available/openstack_https_frontend', ['apache2'])
|
||||
('/etc/apache2/sites-available/openstack_https_frontend', ['apache2']),
|
||||
('/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini',
|
||||
['neutron-server'])
|
||||
])
|
||||
|
||||
|
||||
PLUGIN_ATTRIBUTES = {
|
||||
'ovs': {
|
||||
'config': '/etc/quantum/plugins/openvswitch/'
|
||||
'ovs_quantum_plugin.ini',
|
||||
'driver': 'quantum.plugins.openvswitch.ovs_quantum_plugin.'
|
||||
'OVSQuantumPluginV2',
|
||||
'contexts': ['FakeDBContext'],
|
||||
'services': ['quantum-plugin-openvswitch-agent'],
|
||||
'packages': ['quantum-plugin-openvswitch-agent',
|
||||
'openvswitch-datapath-dkms'],
|
||||
},
|
||||
'nvp': {
|
||||
'config': '/etc/quantum/plugins/nicira/nvp.ini',
|
||||
'driver': 'quantum.plugins.nicira.nicira_nvp_plugin.'
|
||||
'QuantumPlugin.NvpPluginV2',
|
||||
'services': [],
|
||||
'packages': ['quantum-plugin-nicira'],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def fake_plugin_attribute(plugin, attr, net_manager):
|
||||
if plugin in PLUGIN_ATTRIBUTES:
|
||||
try:
|
||||
return PLUGIN_ATTRIBUTES[plugin][attr]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
class NovaCCUtilsTests(CharmTestCase):
|
||||
def setUp(self):
|
||||
super(NovaCCUtilsTests, self).setUp(utils, TO_PATCH)
|
||||
@ -84,7 +115,8 @@ class NovaCCUtilsTests(CharmTestCase):
|
||||
if network_manager:
|
||||
self.network_manager.return_value = network_manager
|
||||
self.test_config.set('network-manager', network_manager.title())
|
||||
self.neutron_plugin.return_value = None
|
||||
self.neutron_plugin.return_value = 'ovs'
|
||||
self.neutron_plugin_attribute.side_effect = fake_plugin_attribute
|
||||
if volume_manager == 'nova-volume':
|
||||
self.relation_ids.return_value = 'nova-volume-service:0'
|
||||
return utils.resource_map()
|
||||
@ -94,7 +126,8 @@ class NovaCCUtilsTests(CharmTestCase):
|
||||
_map = utils.resource_map()
|
||||
confs = [
|
||||
'/etc/quantum/quantum.conf',
|
||||
'/etc/quantum/api-paste.ini'
|
||||
'/etc/quantum/api-paste.ini',
|
||||
'/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini',
|
||||
]
|
||||
[self.assertIn(q_conf, _map.keys()) for q_conf in confs]
|
||||
|
||||
@ -106,6 +139,14 @@ class NovaCCUtilsTests(CharmTestCase):
|
||||
]
|
||||
[self.assertIn(q_conf, _map.keys()) for q_conf in confs]
|
||||
|
||||
def test_resource_map_neutron_no_agent_installed(self):
|
||||
self._resource_map(network_manager='neutron')
|
||||
_map = utils.resource_map()
|
||||
services = []
|
||||
[services.extend(_map[c]['services'])for c in _map]
|
||||
for svc in services:
|
||||
self.assertNotIn('agent', svc)
|
||||
|
||||
def test_resource_map_nova_volume(self):
|
||||
self.relation_ids.return_value = ['nova-volume-service:0']
|
||||
_map = utils.resource_map()
|
||||
|
Loading…
x
Reference in New Issue
Block a user