[hopem,r=]

Allow ml2 vlan-ranges and network-providers to
be configurable.
This commit is contained in:
Edward Hope-Morley 2015-04-10 18:42:31 +01:00
parent 2fead842c1
commit 4ff470de33
4 changed files with 24 additions and 2 deletions

View File

@ -73,6 +73,11 @@ options:
gre
vxlan
.
vlan-ranges:
type: string
default: "physnet1:1000:2000"
description: |
Space-delimited list of network provider vlan id ranges.
# Quota configuration settings
quota-security-group:
default: 10

View File

@ -13,6 +13,9 @@ from charmhelpers.contrib.hahelpers.cluster import (
from charmhelpers.contrib.openstack.utils import (
os_release,
)
from charmhelpers.contrib.openstack.neutron import (
parse_vlan_range_mappings,
)
def get_l2population():
@ -180,6 +183,14 @@ class NeutronCCContext(context.NeutronContext):
continue
if ctxt['nova_url']:
return ctxt
vlan_ranges = config('vlan-ranges')
vlan_range_mappings = parse_vlan_range_mappings(vlan_ranges)
if vlan_range_mappings:
providers = sorted(vlan_range_mappings.keys())
ctxt['network_providers'] = ','.join(providers)
ctxt['vlan_ranges'] = ','.join(vlan_ranges.split())
return ctxt

View File

@ -15,10 +15,10 @@ tunnel_id_ranges = 1:1000
vni_ranges = 1001:2000
[ml2_type_vlan]
network_vlan_ranges = physnet1:1000:2000
network_vlan_ranges = {{ vlan_ranges }}
[ml2_type_flat]
flat_networks = physnet1
flat_networks = {{ network_providers }}
[ovs]
enable_tunneling = True

View File

@ -286,6 +286,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1',
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -317,6 +319,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1',
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -354,6 +358,8 @@ class NeutronCCContextTest(CharmTestCase):
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'network_providers': 'physnet1',
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):