Merge "Fix delete vlan allocation error for ML2"
This commit is contained in:
commit
ed9457fc2b
@ -130,7 +130,7 @@ class VlanTypeDriver(helpers.SegmentTypeDriver):
|
||||
{'vlan_id': alloc.vlan_id,
|
||||
'physical_network':
|
||||
alloc.physical_network})
|
||||
ctx.session.delete(alloc)
|
||||
alloc.delete()
|
||||
|
||||
def get_type(self):
|
||||
return p_const.TYPE_VLAN
|
||||
|
@ -37,6 +37,9 @@ UPDATED_VLAN_RANGES = {
|
||||
PROVIDER_NET: [],
|
||||
TENANT_NET: [(VLAN_MIN + 5, VLAN_MAX + 5)],
|
||||
}
|
||||
EMPTY_VLAN_RANGES = {
|
||||
PROVIDER_NET: []
|
||||
}
|
||||
CORE_PLUGIN = 'ml2'
|
||||
|
||||
|
||||
@ -158,6 +161,19 @@ class VlanTypeTest(testlib_api.SqlTestCase):
|
||||
self.driver._sync_vlan_allocations()
|
||||
check_in_ranges(UPDATED_VLAN_RANGES)
|
||||
|
||||
self.driver.network_vlan_ranges = EMPTY_VLAN_RANGES
|
||||
self.driver._sync_vlan_allocations()
|
||||
|
||||
vlan_min, vlan_max = UPDATED_VLAN_RANGES[TENANT_NET][0]
|
||||
segment = {api.NETWORK_TYPE: p_const.TYPE_VLAN,
|
||||
api.PHYSICAL_NETWORK: TENANT_NET}
|
||||
segment[api.SEGMENTATION_ID] = vlan_min
|
||||
self.assertIsNone(
|
||||
self._get_allocation(self.context, segment))
|
||||
segment[api.SEGMENTATION_ID] = vlan_max
|
||||
self.assertIsNone(
|
||||
self._get_allocation(self.context, segment))
|
||||
|
||||
def test_reserve_provider_segment(self):
|
||||
segment = {api.NETWORK_TYPE: p_const.TYPE_VLAN,
|
||||
api.PHYSICAL_NETWORK: PROVIDER_NET,
|
||||
|
Loading…
Reference in New Issue
Block a user