[hopem,r=]

Allow flat network providers to be configured seperately to vlan
providers.

Closes-Bug: 1444470
This commit is contained in:
Edward Hope-Morley 2015-04-15 15:08:39 +01:00
parent 97ff044adb
commit 9ba06cb46e
3 changed files with 14 additions and 11 deletions

View File

@ -73,11 +73,17 @@ options:
gre gre
vxlan vxlan
. .
flat-network-providers:
type: string
default:
description: |
Space-delimited list of Neutron flat network providers.
vlan-ranges: vlan-ranges:
type: string type: string
default: "physnet1:1000:2000" default: "physnet1:1000:2000"
description: | description: |
Space-delimited list of network provider vlan id ranges. Space-delimited list of Neutron network-provider & vlan-id-ranges using
the following format (<provider>:<start>:<end>).
# Quota configuration settings # Quota configuration settings
quota-security-group: quota-security-group:
default: 10 default: 10

View File

@ -13,9 +13,6 @@ from charmhelpers.contrib.hahelpers.cluster import (
from charmhelpers.contrib.openstack.utils import ( from charmhelpers.contrib.openstack.utils import (
os_release, os_release,
) )
from charmhelpers.contrib.openstack.neutron import (
parse_vlan_range_mappings,
)
def get_l2population(): def get_l2population():
@ -193,11 +190,12 @@ class NeutronCCContext(context.NeutronContext):
if n_api_settings: if n_api_settings:
ctxt.update(n_api_settings) ctxt.update(n_api_settings)
flat_providers = config('flat-network-providers')
if flat_providers:
ctxt['network_providers'] = ','.join(flat_providers.split())
vlan_ranges = config('vlan-ranges') vlan_ranges = config('vlan-ranges')
vlan_range_mappings = parse_vlan_range_mappings(vlan_ranges) if vlan_ranges:
if vlan_range_mappings:
providers = sorted(vlan_range_mappings.keys())
ctxt['network_providers'] = ','.join(providers)
ctxt['vlan_ranges'] = ','.join(vlan_ranges.split()) ctxt['vlan_ranges'] = ','.join(vlan_ranges.split())
return ctxt return ctxt

View File

@ -287,7 +287,6 @@ class NeutronCCContextTest(CharmTestCase):
'quota_subnet': 10, 'quota_subnet': 10,
'quota_vip': 10, 'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000', 'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1',
} }
napi_ctxt = context.NeutronCCContext() napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'): with patch.object(napi_ctxt, '_ensure_packages'):
@ -298,6 +297,7 @@ class NeutronCCContextTest(CharmTestCase):
@patch('__builtin__.__import__') @patch('__builtin__.__import__')
def test_neutroncc_context_vxlan(self, _import, plugin, nm): def test_neutroncc_context_vxlan(self, _import, plugin, nm):
plugin.return_value = None plugin.return_value = None
self.test_config.set('flat-network-providers', 'physnet2 physnet3')
self.test_config.set('overlay-network-type', 'vxlan') self.test_config.set('overlay-network-type', 'vxlan')
ctxt_data = { ctxt_data = {
'debug': True, 'debug': True,
@ -320,7 +320,7 @@ class NeutronCCContextTest(CharmTestCase):
'quota_subnet': 10, 'quota_subnet': 10,
'quota_vip': 10, 'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000', 'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1', 'network_providers': 'physnet2,physnet3',
} }
napi_ctxt = context.NeutronCCContext() napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'): with patch.object(napi_ctxt, '_ensure_packages'):
@ -359,7 +359,6 @@ class NeutronCCContextTest(CharmTestCase):
'quota_subnet': 10, 'quota_subnet': 10,
'quota_vip': 10, 'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000', 'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1',
} }
napi_ctxt = context.NeutronCCContext() napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'): with patch.object(napi_ctxt, '_ensure_packages'):