Merge "Added Hyper-V networking support"

This commit is contained in:
Jenkins 2016-07-08 15:56:57 +00:00 committed by Gerrit Code Review
commit 6ee476166b
6 changed files with 30 additions and 11 deletions

View File

@ -197,6 +197,7 @@ class NeutronCCContext(context.NeutronContext):
ctxt['dhcp_agents_per_network'] = config('dhcp-agents-per-network')
ctxt['overlay_network_type'] = self.neutron_overlay_network_type
ctxt['external_network'] = config('neutron-external-network')
release = os_release('neutron-server')
if config('neutron-plugin') in ['vsp']:
_config = config()
for k, v in _config.iteritems():
@ -206,7 +207,7 @@ class NeutronCCContext(context.NeutronContext):
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit)
vsd_ip = rdata.get('vsd-ip-address')
if os_release('neutron-server') >= 'kilo':
if release >= 'kilo':
cms_id_value = rdata.get('nuage-cms-id')
log('relation data:cms_id required for'
' nuage plugin: {}'.format(cms_id_value))
@ -254,6 +255,11 @@ class NeutronCCContext(context.NeutronContext):
ctxt['enable_ml2_port_security'] = config('enable-ml2-port-security')
ctxt['enable_sriov'] = config('enable-sriov')
if release == 'kilo' or release >= 'mitaka':
ctxt['enable_hyperv'] = True
else:
ctxt['enable_hyperv'] = False
return ctxt

View File

@ -301,9 +301,14 @@ def determine_packages(source=None):
'neutron')
packages.extend(pkgs)
if get_os_codename_install_source(source) >= 'kilo':
release = get_os_codename_install_source(source)
if release >= 'kilo':
packages.extend(KILO_PACKAGES)
if release == 'kilo' or release >= 'mitaka':
packages.append('python-networking-hyperv')
if config('neutron-plugin') == 'vsp':
nuage_pkgs = config('nuage-packages').split()
packages += nuage_pkgs
@ -315,7 +320,7 @@ def determine_packages(source=None):
for p in GIT_PACKAGE_BLACKLIST:
if p in packages:
packages.remove(p)
if get_os_codename_install_source(source) >= 'kilo':
if release >= 'kilo':
for p in GIT_PACKAGE_BLACKLIST_KILO:
packages.remove(p)

View File

@ -16,6 +16,8 @@ type_drivers = {{ overlay_network_type }},vlan,flat,local
tenant_network_types = {{ overlay_network_type }},vlan,flat,local
{% if enable_sriov %}
mechanism_drivers = openvswitch,l2population,sriovnicswitch
{% elif enable_hyperv %}
mechanism_drivers = openvswitch,hyperv,l2population
{% else %}
mechanism_drivers = openvswitch,l2population
{% endif %}

View File

@ -586,13 +586,14 @@ class NeutronAPIBasicDeployment(OpenStackAmuletDeployment):
}
}
if self._get_openstack_release() >= self.trusty_kilo:
# Kilo or later
if (self._get_openstack_release() in
[self.trusty_liberty, self.wily_liberty]):
# Liberty
expected['ml2'].update({
'mechanism_drivers': 'openvswitch,l2population'
})
else:
# Juno or earlier
# Earlier or later than Liberty
expected['ml2'].update({
'mechanism_drivers': 'openvswitch,hyperv,l2population'
})

View File

@ -339,7 +339,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000',
'enable_ml2_port_security': True
'enable_ml2_port_security': True,
'enable_hyperv': False
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -378,7 +379,8 @@ class NeutronCCContextTest(CharmTestCase):
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000,3001:4000',
'network_providers': 'physnet2,physnet3',
'enable_ml2_port_security': True
'enable_ml2_port_security': True,
'enable_hyperv': False
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -420,7 +422,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000',
'enable_ml2_port_security': True
'enable_ml2_port_security': True,
'enable_hyperv': False
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -456,7 +459,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000',
'enable_ml2_port_security': True
'enable_ml2_port_security': True,
'enable_hyperv': False
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):

View File

@ -145,7 +145,8 @@ class TestNeutronAPIUtils(CharmTestCase):
self.get_os_codename_install_source.return_value = 'kilo'
pkg_list = nutils.determine_packages()
expect = deepcopy(nutils.BASE_PACKAGES)
expect.extend(['neutron-server', 'neutron-plugin-ml2'])
expect.extend(['neutron-server', 'neutron-plugin-ml2',
'python-networking-hyperv'])
expect.extend(nutils.KILO_PACKAGES)
self.assertItemsEqual(pkg_list, expect)