Fix duplicate dhcp edge name error

When we detaching subnet from one dhcp edge and deploying a new dhcp edge
for the subnet, there is a chance that we would use a duplicate name for
the new dhcp edge and it would lead to duplicate name error at the
backend. Since the edge name is just a tag that we can easily read and
it would not be used in plugin, the patch fixed the problem by using a
randomly unique edge name.

Change-Id: Ia764ec8c7b54e78ed36f827df4e3025d6e309062
Fixes-bug: #1508633
This commit is contained in:
linb 2015-09-01 10:25:49 +08:00
parent ad711e5c4b
commit 0dcb113c36
2 changed files with 4 additions and 4 deletions

View File

@ -631,7 +631,8 @@ class EdgeManager(object):
router_id, binding['edge_id'], jobdata=jobdata, dist=dist)
def _allocate_dhcp_edge_appliance(self, context, resource_id):
resource_name = resource_id
resource_name = (vcns_const.DHCP_EDGE_PREFIX +
_uuid())[:vcns_const.EDGE_NAME_LEN]
self._allocate_edge_appliance(
context, resource_id, resource_name,
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['dhcp'])

View File

@ -111,10 +111,9 @@ class EdgeDHCPManagerTestCase(EdgeUtilsTestCaseMixin):
self.edge_manager.create_dhcp_edge_service(self.ctx,
fake_network['id'],
fake_subnet)
resource_id = resource_name = (vcns_const.DHCP_EDGE_PREFIX +
fake_network['id'])[:36]
resource_id = (vcns_const.DHCP_EDGE_PREFIX + fake_network['id'])[:36]
self.nsxv_manager.update_edge.assert_called_once_with(
resource_id, 'edge-1', resource_name, None,
resource_id, 'edge-1', mock.ANY, None,
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['dhcp'],
dist=False)