[jamespage, r=gnuoy] Fixup support for NSX (renamed from NVP) in Icehouse
This commit is contained in:
commit
d2b8d69699
@ -7,7 +7,7 @@ options:
|
|||||||
Supported values include:
|
Supported values include:
|
||||||
.
|
.
|
||||||
ovs - OpenVSwitch
|
ovs - OpenVSwitch
|
||||||
nvp - Nicira NVP
|
nvp|nsx - Nicira NVP/VMware NSX
|
||||||
ext-port:
|
ext-port:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
|
@ -44,6 +44,8 @@ NEUTRON_ML2_PLUGIN = \
|
|||||||
"neutron.plugins.ml2.plugin.Ml2Plugin"
|
"neutron.plugins.ml2.plugin.Ml2Plugin"
|
||||||
NEUTRON_NVP_PLUGIN = \
|
NEUTRON_NVP_PLUGIN = \
|
||||||
"neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin.NvpPluginV2"
|
"neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin.NvpPluginV2"
|
||||||
|
NEUTRON_NSX_PLUGIN = "vmware"
|
||||||
|
|
||||||
NEUTRON = 'neutron'
|
NEUTRON = 'neutron'
|
||||||
QUANTUM = 'quantum'
|
QUANTUM = 'quantum'
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ def networking_name():
|
|||||||
|
|
||||||
OVS = 'ovs'
|
OVS = 'ovs'
|
||||||
NVP = 'nvp'
|
NVP = 'nvp'
|
||||||
|
NSX = 'nsx'
|
||||||
|
|
||||||
CORE_PLUGIN = {
|
CORE_PLUGIN = {
|
||||||
QUANTUM: {
|
QUANTUM: {
|
||||||
@ -65,18 +68,30 @@ CORE_PLUGIN = {
|
|||||||
},
|
},
|
||||||
NEUTRON: {
|
NEUTRON: {
|
||||||
OVS: NEUTRON_OVS_PLUGIN,
|
OVS: NEUTRON_OVS_PLUGIN,
|
||||||
NVP: NEUTRON_NVP_PLUGIN
|
NVP: NEUTRON_NVP_PLUGIN,
|
||||||
|
NSX: NEUTRON_NSX_PLUGIN
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def remap_plugin(plugin):
|
||||||
|
''' Remaps plugin name for renames/switches in packaging '''
|
||||||
|
release = get_os_codename_install_source(config('openstack-origin'))
|
||||||
|
if plugin == 'nvp' and release >= 'icehouse':
|
||||||
|
plugin = 'nsx'
|
||||||
|
elif plugin == 'nsx' and release < 'icehouse':
|
||||||
|
plugin = 'nvp'
|
||||||
|
return plugin
|
||||||
|
|
||||||
|
|
||||||
def core_plugin():
|
def core_plugin():
|
||||||
|
plugin = remap_plugin(config('plugin'))
|
||||||
if (get_os_codename_install_source(config('openstack-origin'))
|
if (get_os_codename_install_source(config('openstack-origin'))
|
||||||
>= 'icehouse'
|
>= 'icehouse'
|
||||||
and config('plugin') == OVS):
|
and plugin == OVS):
|
||||||
return NEUTRON_ML2_PLUGIN
|
return NEUTRON_ML2_PLUGIN
|
||||||
else:
|
else:
|
||||||
return CORE_PLUGIN[networking_name()][config('plugin')]
|
return CORE_PLUGIN[networking_name()][plugin]
|
||||||
|
|
||||||
|
|
||||||
class NetworkServiceContext(OSContextGenerator):
|
class NetworkServiceContext(OSContextGenerator):
|
||||||
|
@ -161,8 +161,9 @@ def nm_changed():
|
|||||||
@hooks.hook("cluster-relation-departed")
|
@hooks.hook("cluster-relation-departed")
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def cluster_departed():
|
def cluster_departed():
|
||||||
if config('plugin') == 'nvp':
|
if config('plugin') in ['nvp', 'nsx']:
|
||||||
log('Unable to re-assign agent resources for failed nodes with nvp',
|
log('Unable to re-assign agent resources for'
|
||||||
|
' failed nodes with nvp|nsx',
|
||||||
level=WARNING)
|
level=WARNING)
|
||||||
return
|
return
|
||||||
if eligible_leader(None):
|
if eligible_leader(None):
|
||||||
|
@ -37,13 +37,14 @@ from charmhelpers.contrib.openstack.context import (
|
|||||||
import charmhelpers.contrib.openstack.templating as templating
|
import charmhelpers.contrib.openstack.templating as templating
|
||||||
from charmhelpers.contrib.openstack.neutron import headers_package
|
from charmhelpers.contrib.openstack.neutron import headers_package
|
||||||
from quantum_contexts import (
|
from quantum_contexts import (
|
||||||
CORE_PLUGIN, OVS, NVP,
|
CORE_PLUGIN, OVS, NVP, NSX,
|
||||||
NEUTRON, QUANTUM,
|
NEUTRON, QUANTUM,
|
||||||
networking_name,
|
networking_name,
|
||||||
QuantumGatewayContext,
|
QuantumGatewayContext,
|
||||||
NetworkServiceContext,
|
NetworkServiceContext,
|
||||||
L3AgentContext,
|
L3AgentContext,
|
||||||
ExternalPortContext,
|
ExternalPortContext,
|
||||||
|
remap_plugin
|
||||||
)
|
)
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@ -71,9 +72,13 @@ NEUTRON_ML2_PLUGIN_CONF = \
|
|||||||
"/etc/neutron/plugins/ml2/ml2_conf.ini"
|
"/etc/neutron/plugins/ml2/ml2_conf.ini"
|
||||||
NEUTRON_NVP_PLUGIN_CONF = \
|
NEUTRON_NVP_PLUGIN_CONF = \
|
||||||
"/etc/neutron/plugins/nicira/nvp.ini"
|
"/etc/neutron/plugins/nicira/nvp.ini"
|
||||||
|
NEUTRON_NSX_PLUGIN_CONF = \
|
||||||
|
"/etc/neutron/plugins/vmware/nsx.ini"
|
||||||
|
|
||||||
NEUTRON_PLUGIN_CONF = {
|
NEUTRON_PLUGIN_CONF = {
|
||||||
OVS: NEUTRON_OVS_PLUGIN_CONF,
|
OVS: NEUTRON_OVS_PLUGIN_CONF,
|
||||||
NVP: NEUTRON_NVP_PLUGIN_CONF
|
NVP: NEUTRON_NVP_PLUGIN_CONF,
|
||||||
|
NSX: NEUTRON_NSX_PLUGIN_CONF,
|
||||||
}
|
}
|
||||||
|
|
||||||
QUANTUM_GATEWAY_PKGS = {
|
QUANTUM_GATEWAY_PKGS = {
|
||||||
@ -116,6 +121,7 @@ NEUTRON_GATEWAY_PKGS = {
|
|||||||
"nova-api-metadata"
|
"nova-api-metadata"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
NEUTRON_GATEWAY_PKGS[NSX] = NEUTRON_GATEWAY_PKGS[NVP]
|
||||||
|
|
||||||
GATEWAY_PKGS = {
|
GATEWAY_PKGS = {
|
||||||
QUANTUM: QUANTUM_GATEWAY_PKGS,
|
QUANTUM: QUANTUM_GATEWAY_PKGS,
|
||||||
@ -138,9 +144,10 @@ def get_early_packages():
|
|||||||
|
|
||||||
def get_packages():
|
def get_packages():
|
||||||
'''Return a list of packages for install based on the configured plugin'''
|
'''Return a list of packages for install based on the configured plugin'''
|
||||||
packages = deepcopy(GATEWAY_PKGS[networking_name()][config('plugin')])
|
plugin = remap_plugin(config('plugin'))
|
||||||
|
packages = deepcopy(GATEWAY_PKGS[networking_name()][plugin])
|
||||||
if (get_os_codename_install_source(config('openstack-origin'))
|
if (get_os_codename_install_source(config('openstack-origin'))
|
||||||
>= 'icehouse' and config('plugin') == 'ovs'):
|
>= 'icehouse' and plugin == 'ovs'):
|
||||||
# NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for icehouse
|
# NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for icehouse
|
||||||
packages.remove('neutron-l3-agent')
|
packages.remove('neutron-l3-agent')
|
||||||
packages.append('neutron-vpn-agent')
|
packages.append('neutron-vpn-agent')
|
||||||
@ -298,7 +305,9 @@ NEUTRON_OVS_CONFIG_FILES.update(NEUTRON_SHARED_CONFIG_FILES)
|
|||||||
|
|
||||||
QUANTUM_NVP_CONFIG_FILES = {
|
QUANTUM_NVP_CONFIG_FILES = {
|
||||||
QUANTUM_CONF: {
|
QUANTUM_CONF: {
|
||||||
'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR)],
|
'hook_contexts': [context.AMQPContext(ssl_dir=QUANTUM_CONF_DIR),
|
||||||
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['quantum-dhcp-agent', 'quantum-metadata-agent']
|
'services': ['quantum-dhcp-agent', 'quantum-metadata-agent']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -306,7 +315,9 @@ QUANTUM_NVP_CONFIG_FILES.update(QUANTUM_SHARED_CONFIG_FILES)
|
|||||||
|
|
||||||
NEUTRON_NVP_CONFIG_FILES = {
|
NEUTRON_NVP_CONFIG_FILES = {
|
||||||
NEUTRON_CONF: {
|
NEUTRON_CONF: {
|
||||||
'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR)],
|
'hook_contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
|
||||||
|
QuantumGatewayContext(),
|
||||||
|
SyslogContext()],
|
||||||
'services': ['neutron-dhcp-agent', 'neutron-metadata-agent']
|
'services': ['neutron-dhcp-agent', 'neutron-metadata-agent']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -318,6 +329,7 @@ CONFIG_FILES = {
|
|||||||
OVS: QUANTUM_OVS_CONFIG_FILES,
|
OVS: QUANTUM_OVS_CONFIG_FILES,
|
||||||
},
|
},
|
||||||
NEUTRON: {
|
NEUTRON: {
|
||||||
|
NSX: NEUTRON_NVP_CONFIG_FILES,
|
||||||
NVP: NEUTRON_NVP_CONFIG_FILES,
|
NVP: NEUTRON_NVP_CONFIG_FILES,
|
||||||
OVS: NEUTRON_OVS_CONFIG_FILES,
|
OVS: NEUTRON_OVS_CONFIG_FILES,
|
||||||
},
|
},
|
||||||
@ -330,7 +342,7 @@ def register_configs():
|
|||||||
configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
|
configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
|
||||||
openstack_release=release)
|
openstack_release=release)
|
||||||
|
|
||||||
plugin = config('plugin')
|
plugin = remap_plugin(config('plugin'))
|
||||||
name = networking_name()
|
name = networking_name()
|
||||||
if plugin == 'ovs':
|
if plugin == 'ovs':
|
||||||
# NOTE: deal with switch to ML2 plugin for >= icehouse
|
# NOTE: deal with switch to ML2 plugin for >= icehouse
|
||||||
|
@ -11,7 +11,7 @@ ovs_use_veth = True
|
|||||||
{% if instance_mtu -%}
|
{% if instance_mtu -%}
|
||||||
dnsmasq_config_file = /etc/neutron/dnsmasq.conf
|
dnsmasq_config_file = /etc/neutron/dnsmasq.conf
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if plugin == 'nvp' -%}
|
{% if plugin == 'nvp' or plugin == 'nsx' -%}
|
||||||
enable_metadata_network = True
|
enable_metadata_network = True
|
||||||
enable_isolated_metadata = True
|
enable_isolated_metadata = True
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
@ -290,10 +290,10 @@ class TestHostIP(CharmTestCase):
|
|||||||
_query.assert_called_with('myhost.example.com', 'A')
|
_query.assert_called_with('myhost.example.com', 'A')
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkingName(CharmTestCase):
|
class TestMisc(CharmTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNetworkingName,
|
super(TestMisc,
|
||||||
self).setUp(quantum_contexts,
|
self).setUp(quantum_contexts,
|
||||||
TO_PATCH)
|
TO_PATCH)
|
||||||
|
|
||||||
@ -304,3 +304,29 @@ class TestNetworkingName(CharmTestCase):
|
|||||||
def test_ge_havana(self):
|
def test_ge_havana(self):
|
||||||
self.get_os_codename_install_source.return_value = 'havana'
|
self.get_os_codename_install_source.return_value = 'havana'
|
||||||
self.assertEquals(quantum_contexts.networking_name(), 'neutron')
|
self.assertEquals(quantum_contexts.networking_name(), 'neutron')
|
||||||
|
|
||||||
|
def test_remap_plugin(self):
|
||||||
|
self.get_os_codename_install_source.return_value = 'havana'
|
||||||
|
self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nvp')
|
||||||
|
self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nvp')
|
||||||
|
|
||||||
|
def test_remap_plugin_icehouse(self):
|
||||||
|
self.get_os_codename_install_source.return_value = 'icehouse'
|
||||||
|
self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nsx')
|
||||||
|
self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nsx')
|
||||||
|
|
||||||
|
def test_remap_plugin_noop(self):
|
||||||
|
self.get_os_codename_install_source.return_value = 'icehouse'
|
||||||
|
self.assertEquals(quantum_contexts.remap_plugin('ovs'), 'ovs')
|
||||||
|
|
||||||
|
def test_core_plugin(self):
|
||||||
|
self.get_os_codename_install_source.return_value = 'havana'
|
||||||
|
self.config.return_value = 'ovs'
|
||||||
|
self.assertEquals(quantum_contexts.core_plugin(),
|
||||||
|
quantum_contexts.NEUTRON_OVS_PLUGIN)
|
||||||
|
|
||||||
|
def test_core_plugin_ml2(self):
|
||||||
|
self.get_os_codename_install_source.return_value = 'icehouse'
|
||||||
|
self.config.return_value = 'ovs'
|
||||||
|
self.assertEquals(quantum_contexts.core_plugin(),
|
||||||
|
quantum_contexts.NEUTRON_ML2_PLUGIN)
|
||||||
|
@ -41,7 +41,8 @@ TO_PATCH = [
|
|||||||
'relations_of_type',
|
'relations_of_type',
|
||||||
'service_stop',
|
'service_stop',
|
||||||
'determine_dkms_package',
|
'determine_dkms_package',
|
||||||
'service_restart'
|
'service_restart',
|
||||||
|
'remap_plugin'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -61,6 +62,9 @@ class TestQuantumUtils(CharmTestCase):
|
|||||||
super(TestQuantumUtils, self).setUp(quantum_utils, TO_PATCH)
|
super(TestQuantumUtils, self).setUp(quantum_utils, TO_PATCH)
|
||||||
self.networking_name.return_value = 'neutron'
|
self.networking_name.return_value = 'neutron'
|
||||||
self.headers_package.return_value = 'linux-headers-2.6.18'
|
self.headers_package.return_value = 'linux-headers-2.6.18'
|
||||||
|
def noop(value):
|
||||||
|
return value
|
||||||
|
self.remap_plugin.side_effect = noop
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# Reset cached cache
|
# Reset cached cache
|
||||||
@ -71,6 +75,8 @@ class TestQuantumUtils(CharmTestCase):
|
|||||||
self.assertTrue(quantum_utils.valid_plugin())
|
self.assertTrue(quantum_utils.valid_plugin())
|
||||||
self.config.return_value = 'nvp'
|
self.config.return_value = 'nvp'
|
||||||
self.assertTrue(quantum_utils.valid_plugin())
|
self.assertTrue(quantum_utils.valid_plugin())
|
||||||
|
self.config.return_value = 'nsx'
|
||||||
|
self.assertTrue(quantum_utils.valid_plugin())
|
||||||
|
|
||||||
def test_invalid_plugin(self):
|
def test_invalid_plugin(self):
|
||||||
self.config.return_value = 'invalid'
|
self.config.return_value = 'invalid'
|
||||||
@ -212,6 +218,20 @@ class TestQuantumUtils(CharmTestCase):
|
|||||||
['hook_contexts']
|
['hook_contexts']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_register_configs_nsx(self):
|
||||||
|
self.config.return_value = 'nsx'
|
||||||
|
configs = quantum_utils.register_configs()
|
||||||
|
confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF,
|
||||||
|
quantum_utils.NEUTRON_METADATA_AGENT_CONF,
|
||||||
|
quantum_utils.NOVA_CONF,
|
||||||
|
quantum_utils.NEUTRON_CONF]
|
||||||
|
for conf in confs:
|
||||||
|
configs.register.assert_any_call(
|
||||||
|
conf,
|
||||||
|
quantum_utils.CONFIG_FILES['neutron'][quantum_utils.NSX][conf]
|
||||||
|
['hook_contexts']
|
||||||
|
)
|
||||||
|
|
||||||
def test_stop_services_nvp(self):
|
def test_stop_services_nvp(self):
|
||||||
self.config.return_value = 'nvp'
|
self.config.return_value = 'nvp'
|
||||||
quantum_utils.stop_services()
|
quantum_utils.stop_services()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user