Expand dvr overlay network support for >= kilo

This commit is contained in:
James Page 2015-05-06 11:46:22 +01:00
parent 54743ba775
commit 65fcc942cb
3 changed files with 31 additions and 18 deletions

View File

@ -87,7 +87,7 @@ options:
Overlay network type to use choose one of:
.
gre
vxlan
vxlan
.
flat-network-providers:
type: string

View File

@ -14,6 +14,12 @@ from charmhelpers.contrib.openstack.utils import (
os_release,
)
VLAN = 'vlan'
VXLAN = 'vxlan'
GRE = 'gre'
OVERLAY_NET_TYPES = [VXLAN, GRE]
def get_l2population():
plugin = config('neutron-plugin')
@ -22,7 +28,7 @@ def get_l2population():
def get_overlay_network_type():
overlay_net = config('overlay-network-type')
if overlay_net not in ['vxlan', 'gre']:
if overlay_net not in OVERLAY_NET_TYPES:
raise Exception('Unsupported overlay-network-type')
return overlay_net
@ -32,10 +38,6 @@ def get_l3ha():
if os_release('neutron-server') < 'juno':
log('Disabling L3 HA, enable-l3ha is not valid before Juno')
return False
if config('overlay-network-type') not in ['vlan', 'gre', 'vxlan']:
log('Disabling L3 HA, enable-l3ha requires the use of the vxlan, '
'vlan or gre overlay network')
return False
if get_l2population():
log('Disabling L3 HA, l2-population must be disabled with L3 HA')
return False
@ -49,10 +51,11 @@ def get_dvr():
if os_release('neutron-server') < 'juno':
log('Disabling DVR, enable-dvr is not valid before Juno')
return False
if config('overlay-network-type') != 'vxlan':
log('Disabling DVR, enable-dvr requires the use of the vxlan '
'overlay network')
return False
if os_release('neutron-server') == 'juno':
if config('overlay-network-type') != VXLAN:
log('Disabling DVR, enable-dvr requires the use of the vxlan '
'overlay network for OpenStack Juno')
return False
if get_l3ha():
log('Disabling DVR, enable-l3ha must be disabled with dvr')
return False

View File

@ -65,14 +65,6 @@ class GeneralTests(CharmTestCase):
self.os_release.return_value = 'juno'
self.assertEquals(context.get_l3ha(), False)
def test_get_l3ha_badoverlay(self):
self.test_config.set('enable-l3ha', True)
self.test_config.set('overlay-network-type', 'tokenring')
self.test_config.set('neutron-plugin', 'ovs')
self.test_config.set('l2-population', False)
self.os_release.return_value = 'juno'
self.assertEquals(context.get_l3ha(), False)
def test_get_dvr(self):
self.test_config.set('enable-dvr', True)
self.test_config.set('enable-l3ha', False)
@ -109,6 +101,24 @@ class GeneralTests(CharmTestCase):
self.os_release.return_value = 'juno'
self.assertEquals(context.get_dvr(), False)
def test_get_dvr_gre_kilo(self):
self.test_config.set('enable-dvr', True)
self.test_config.set('enable-l3ha', False)
self.test_config.set('overlay-network-type', 'gre')
self.test_config.set('neutron-plugin', 'ovs')
self.test_config.set('l2-population', True)
self.os_release.return_value = 'kilo'
self.assertEquals(context.get_dvr(), True)
def test_get_dvr_vxlan_kilo(self):
self.test_config.set('enable-dvr', True)
self.test_config.set('enable-l3ha', False)
self.test_config.set('overlay-network-type', 'vxlan')
self.test_config.set('neutron-plugin', 'ovs')
self.test_config.set('l2-population', True)
self.os_release.return_value = 'kilo'
self.assertEquals(context.get_dvr(), True)
def test_get_dvr_l3ha_on(self):
self.test_config.set('enable-dvr', True)
self.test_config.set('enable-l3ha', True)