Merge "NSXv: Subnet create and attachment concurrency"
This commit is contained in:
commit
a77354e5fb
@ -176,9 +176,11 @@ class RouterDistributedDriver(router_driver.RouterBaseDriver):
|
|||||||
context, router))
|
context, router))
|
||||||
|
|
||||||
plr_id = self.edge_manager.get_plr_by_tlr_id(context, router_id)
|
plr_id = self.edge_manager.get_plr_by_tlr_id(context, router_id)
|
||||||
|
tlr_edge_id = self._get_edge_id(context, router_id)
|
||||||
if not new_ext_net_id:
|
if not new_ext_net_id:
|
||||||
if plr_id:
|
if plr_id:
|
||||||
# delete all plr relative conf
|
# delete all plr relative conf
|
||||||
|
with locking.LockManager.get_lock(tlr_edge_id):
|
||||||
self.edge_manager.delete_plr_by_tlr_id(
|
self.edge_manager.delete_plr_by_tlr_id(
|
||||||
context, plr_id, router_id)
|
context, plr_id, router_id)
|
||||||
else:
|
else:
|
||||||
@ -188,15 +190,19 @@ class RouterDistributedDriver(router_driver.RouterBaseDriver):
|
|||||||
# retrieved by +get_router does not contain this information
|
# retrieved by +get_router does not contain this information
|
||||||
availability_zone = self.get_router_az_by_id(
|
availability_zone = self.get_router_az_by_id(
|
||||||
context, router['id'])
|
context, router['id'])
|
||||||
|
with locking.LockManager.get_lock(tlr_edge_id):
|
||||||
plr_id = self.edge_manager.create_plr_with_tlr_id(
|
plr_id = self.edge_manager.create_plr_with_tlr_id(
|
||||||
context, router_id, router.get('name'), availability_zone)
|
context, router_id, router.get('name'),
|
||||||
|
availability_zone)
|
||||||
if new_ext_net_id != org_ext_net_id and orgnexthop:
|
if new_ext_net_id != org_ext_net_id and orgnexthop:
|
||||||
# network changed, so need to remove default gateway
|
# network changed, so need to remove default gateway
|
||||||
# and all static routes before vnic can be configured
|
# and all static routes before vnic can be configured
|
||||||
|
with locking.LockManager.get_lock(tlr_edge_id):
|
||||||
edge_utils.clear_gateway(self.nsx_v, context, plr_id)
|
edge_utils.clear_gateway(self.nsx_v, context, plr_id)
|
||||||
|
|
||||||
# Update external vnic if addr or mask is changed
|
# Update external vnic if addr or mask is changed
|
||||||
if orgaddr != newaddr or orgmask != newmask:
|
if orgaddr != newaddr or orgmask != newmask:
|
||||||
|
with locking.LockManager.get_lock(tlr_edge_id):
|
||||||
self.edge_manager.update_external_interface(
|
self.edge_manager.update_external_interface(
|
||||||
self.nsx_v, context, plr_id,
|
self.nsx_v, context, plr_id,
|
||||||
new_ext_net_id, newaddr, newmask)
|
new_ext_net_id, newaddr, newmask)
|
||||||
@ -216,6 +222,7 @@ class RouterDistributedDriver(router_driver.RouterBaseDriver):
|
|||||||
context, router, router_id=plr_id)
|
context, router, router_id=plr_id)
|
||||||
|
|
||||||
# update static routes in all
|
# update static routes in all
|
||||||
|
with locking.LockManager.get_lock(tlr_edge_id):
|
||||||
md_gw_data = self._get_metadata_gw_data(context, router_id)
|
md_gw_data = self._get_metadata_gw_data(context, router_id)
|
||||||
self._update_routes(context, router_id, newnexthop, md_gw_data)
|
self._update_routes(context, router_id, newnexthop, md_gw_data)
|
||||||
|
|
||||||
@ -473,6 +480,7 @@ class RouterDistributedDriver(router_driver.RouterBaseDriver):
|
|||||||
router_id)
|
router_id)
|
||||||
|
|
||||||
# Reattach to regular DHCP Edge
|
# Reattach to regular DHCP Edge
|
||||||
|
with locking.LockManager.get_lock(network_id):
|
||||||
dhcp_id = self.edge_manager.create_dhcp_edge_service(
|
dhcp_id = self.edge_manager.create_dhcp_edge_service(
|
||||||
context, network_id, subnet)
|
context, network_id, subnet)
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ class RouterExclusiveDriver(router_driver.RouterBaseDriver):
|
|||||||
intf_net_ids = (
|
intf_net_ids = (
|
||||||
self.plugin._get_internal_network_ids_by_router(context,
|
self.plugin._get_internal_network_ids_by_router(context,
|
||||||
router_id))
|
router_id))
|
||||||
|
with locking.LockManager.get_lock(edge_id):
|
||||||
for network_id in intf_net_ids:
|
for network_id in intf_net_ids:
|
||||||
address_groups = self.plugin._get_address_groups(
|
address_groups = self.plugin._get_address_groups(
|
||||||
context, router_id, network_id)
|
context, router_id, network_id)
|
||||||
|
@ -453,7 +453,8 @@ class NsxVMetadataProxyHandler(object):
|
|||||||
'name': None,
|
'name': None,
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'device_id': rtr_id,
|
'device_id': rtr_id,
|
||||||
'device_owner': constants.DEVICE_OWNER_ROUTER_INTF,
|
'device_owner': (constants.DEVICE_OWNER_NETWORK_PREFIX +
|
||||||
|
'md_interface'),
|
||||||
'fixed_ips': constants.ATTR_NOT_SPECIFIED,
|
'fixed_ips': constants.ATTR_NOT_SPECIFIED,
|
||||||
'mac_address': constants.ATTR_NOT_SPECIFIED,
|
'mac_address': constants.ATTR_NOT_SPECIFIED,
|
||||||
'port_security_enabled': False,
|
'port_security_enabled': False,
|
||||||
@ -465,6 +466,7 @@ class NsxVMetadataProxyHandler(object):
|
|||||||
context, self.internal_net, rtr_id, is_proxy=True)
|
context, self.internal_net, rtr_id, is_proxy=True)
|
||||||
|
|
||||||
edge_ip = port['fixed_ips'][0]['ip_address']
|
edge_ip = port['fixed_ips'][0]['ip_address']
|
||||||
|
with locking.LockManager.get_lock(edge_id):
|
||||||
edge_utils.update_internal_interface(
|
edge_utils.update_internal_interface(
|
||||||
self.nsxv_plugin.nsx_v, context, rtr_id,
|
self.nsxv_plugin.nsx_v, context, rtr_id,
|
||||||
self.internal_net, address_groups)
|
self.internal_net, address_groups)
|
||||||
|
@ -2619,17 +2619,14 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
self.create_port(context, {'port': port_dict})
|
self.create_port(context, {'port': port_dict})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resource_id = self.edge_manager.create_dhcp_edge_service(
|
self.edge_manager.create_dhcp_edge_service(context, network_id,
|
||||||
context, network_id, subnet)
|
subnet)
|
||||||
# Create all dhcp ports within the network
|
# Create all dhcp ports within the network
|
||||||
address_groups = self._create_network_dhcp_address_group(
|
address_groups = self._create_network_dhcp_address_group(
|
||||||
context, network_id)
|
context, network_id)
|
||||||
self.edge_manager.update_dhcp_edge_service(
|
self.edge_manager.update_dhcp_edge_service(
|
||||||
context, network_id, address_groups=address_groups)
|
context, network_id, address_groups=address_groups)
|
||||||
|
|
||||||
if resource_id:
|
|
||||||
self._update_dhcp_service_new_edge(context, resource_id)
|
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_LE("Failed to update DHCP for subnet %s"),
|
LOG.exception(_LE("Failed to update DHCP for subnet %s"),
|
||||||
@ -3298,6 +3295,8 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
# for each one to reflect the router admin-state-up status.
|
# for each one to reflect the router admin-state-up status.
|
||||||
intf_net_ids = (
|
intf_net_ids = (
|
||||||
self._get_internal_network_ids_by_router(context, router_id))
|
self._get_internal_network_ids_by_router(context, router_id))
|
||||||
|
edge_id = self._get_edge_id_by_rtr_id(context, router_id)
|
||||||
|
with locking.LockManager.get_lock(edge_id):
|
||||||
for network_id in intf_net_ids:
|
for network_id in intf_net_ids:
|
||||||
address_groups = (
|
address_groups = (
|
||||||
self._get_address_groups(context, router_id, network_id))
|
self._get_address_groups(context, router_id, network_id))
|
||||||
|
@ -382,7 +382,7 @@ class EdgeApplianceDriver(object):
|
|||||||
def deploy_edge(self, context, router_id, name, internal_network,
|
def deploy_edge(self, context, router_id, name, internal_network,
|
||||||
dist=False, loadbalancer_enable=True,
|
dist=False, loadbalancer_enable=True,
|
||||||
appliance_size=nsxv_constants.LARGE,
|
appliance_size=nsxv_constants.LARGE,
|
||||||
availability_zone=None):
|
availability_zone=None, deploy_metadata=False):
|
||||||
|
|
||||||
edge_name = name
|
edge_name = name
|
||||||
edge = self._assemble_edge(
|
edge = self._assemble_edge(
|
||||||
@ -444,7 +444,7 @@ class EdgeApplianceDriver(object):
|
|||||||
|
|
||||||
self.callbacks.complete_edge_creation(
|
self.callbacks.complete_edge_creation(
|
||||||
context, edge_id, name, router_id, dist, True,
|
context, edge_id, name, router_id, dist, True,
|
||||||
availability_zone)
|
availability_zone, deploy_metadata)
|
||||||
|
|
||||||
except exceptions.VcnsApiException:
|
except exceptions.VcnsApiException:
|
||||||
self.callbacks.complete_edge_creation(
|
self.callbacks.complete_edge_creation(
|
||||||
|
@ -248,7 +248,7 @@ class EdgeManager(object):
|
|||||||
def _deploy_edge(self, context, lrouter,
|
def _deploy_edge(self, context, lrouter,
|
||||||
lswitch=None, appliance_size=nsxv_constants.COMPACT,
|
lswitch=None, appliance_size=nsxv_constants.COMPACT,
|
||||||
edge_type=nsxv_constants.SERVICE_EDGE,
|
edge_type=nsxv_constants.SERVICE_EDGE,
|
||||||
availability_zone=None):
|
availability_zone=None, deploy_metadata=False):
|
||||||
"""Create an edge for logical router support."""
|
"""Create an edge for logical router support."""
|
||||||
if context is None:
|
if context is None:
|
||||||
context = q_context.get_admin_context()
|
context = q_context.get_admin_context()
|
||||||
@ -257,7 +257,8 @@ class EdgeManager(object):
|
|||||||
lrouter['name'], internal_network=None,
|
lrouter['name'], internal_network=None,
|
||||||
appliance_size=appliance_size,
|
appliance_size=appliance_size,
|
||||||
dist=(edge_type == nsxv_constants.VDR_EDGE),
|
dist=(edge_type == nsxv_constants.VDR_EDGE),
|
||||||
availability_zone=availability_zone)
|
availability_zone=availability_zone,
|
||||||
|
deploy_metadata=deploy_metadata)
|
||||||
|
|
||||||
def _deploy_backup_edges_on_db(self, context, num,
|
def _deploy_backup_edges_on_db(self, context, num,
|
||||||
appliance_size=nsxv_constants.COMPACT,
|
appliance_size=nsxv_constants.COMPACT,
|
||||||
@ -650,7 +651,8 @@ class EdgeManager(object):
|
|||||||
def _allocate_edge_appliance(self, context, resource_id, name,
|
def _allocate_edge_appliance(self, context, resource_id, name,
|
||||||
appliance_size=nsxv_constants.COMPACT,
|
appliance_size=nsxv_constants.COMPACT,
|
||||||
dist=False,
|
dist=False,
|
||||||
availability_zone=None):
|
availability_zone=None,
|
||||||
|
deploy_metadata=False):
|
||||||
"""Try to allocate one available edge from pool."""
|
"""Try to allocate one available edge from pool."""
|
||||||
edge_type = (nsxv_constants.VDR_EDGE if dist else
|
edge_type = (nsxv_constants.VDR_EDGE if dist else
|
||||||
nsxv_constants.SERVICE_EDGE)
|
nsxv_constants.SERVICE_EDGE)
|
||||||
@ -694,7 +696,8 @@ class EdgeManager(object):
|
|||||||
edge_id = self._deploy_edge(context, lrouter,
|
edge_id = self._deploy_edge(context, lrouter,
|
||||||
appliance_size=appliance_size,
|
appliance_size=appliance_size,
|
||||||
edge_type=edge_type,
|
edge_type=edge_type,
|
||||||
availability_zone=availability_zone)
|
availability_zone=availability_zone,
|
||||||
|
deploy_metadata=deploy_metadata)
|
||||||
else:
|
else:
|
||||||
LOG.debug("Select edge: %(edge_id)s from pool for %(name)s",
|
LOG.debug("Select edge: %(edge_id)s from pool for %(name)s",
|
||||||
{'edge_id': available_router_binding['edge_id'],
|
{'edge_id': available_router_binding['edge_id'],
|
||||||
@ -712,16 +715,20 @@ class EdgeManager(object):
|
|||||||
edge_type=edge_type,
|
edge_type=edge_type,
|
||||||
availability_zone=availability_zone.name)
|
availability_zone=availability_zone.name)
|
||||||
edge_id = available_router_binding['edge_id']
|
edge_id = available_router_binding['edge_id']
|
||||||
|
LOG.debug("Select edge: %(edge_id)s from pool for %(name)s",
|
||||||
|
{'edge_id': edge_id, 'name': name})
|
||||||
with locking.LockManager.get_lock(str(edge_id)):
|
with locking.LockManager.get_lock(str(edge_id)):
|
||||||
self.nsxv_manager.callbacks.complete_edge_creation(
|
self.nsxv_manager.callbacks.complete_edge_creation(
|
||||||
context, edge_id, lrouter['name'], lrouter['id'], dist,
|
context, edge_id, lrouter['name'], lrouter['id'], dist,
|
||||||
True)
|
True, deploy_metadata)
|
||||||
|
|
||||||
# change edge's name at backend
|
try:
|
||||||
self.nsxv_manager.update_edge(
|
self.nsxv_manager.rename_edge(edge_id, name)
|
||||||
context, resource_id, available_router_binding['edge_id'],
|
except nsxapi_exc.VcnsApiException as e:
|
||||||
name, None, appliance_size=appliance_size, dist=dist,
|
LOG.error(_LE("Failed to update edge: %s"),
|
||||||
set_errors=True, availability_zone=availability_zone)
|
e.response)
|
||||||
|
self.nsxv_manager.callbacks.complete_edge_update(
|
||||||
|
context, edge_id, resource_id, False, set_errors=True)
|
||||||
|
|
||||||
backup_num = len(self._get_backup_edge_bindings(
|
backup_num = len(self._get_backup_edge_bindings(
|
||||||
context, appliance_size=appliance_size, edge_type=edge_type,
|
context, appliance_size=appliance_size, edge_type=edge_type,
|
||||||
@ -824,7 +831,8 @@ class EdgeManager(object):
|
|||||||
self._allocate_edge_appliance(
|
self._allocate_edge_appliance(
|
||||||
context, resource_id, resource_name,
|
context, resource_id, resource_name,
|
||||||
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['dhcp'],
|
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['dhcp'],
|
||||||
availability_zone=availability_zone)
|
availability_zone=availability_zone,
|
||||||
|
deploy_metadata=True)
|
||||||
|
|
||||||
def allocate_lb_edge_appliance(
|
def allocate_lb_edge_appliance(
|
||||||
self, context, resource_id, availability_zone,
|
self, context, resource_id, availability_zone,
|
||||||
@ -2020,14 +2028,7 @@ class EdgeManager(object):
|
|||||||
def update_external_interface(
|
def update_external_interface(
|
||||||
self, nsxv_manager, context, router_id, ext_net_id,
|
self, nsxv_manager, context, router_id, ext_net_id,
|
||||||
ipaddr, netmask, secondary=None):
|
ipaddr, netmask, secondary=None):
|
||||||
with locking.LockManager.get_lock(str(router_id)):
|
|
||||||
self._update_external_interface(nsxv_manager, context, router_id,
|
|
||||||
ext_net_id, ipaddr, netmask,
|
|
||||||
secondary=secondary)
|
|
||||||
|
|
||||||
def _update_external_interface(
|
|
||||||
self, nsxv_manager, context, router_id, ext_net_id,
|
|
||||||
ipaddr, netmask, secondary=None):
|
|
||||||
secondary = secondary or []
|
secondary = secondary or []
|
||||||
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
||||||
|
|
||||||
@ -2326,14 +2327,6 @@ def _check_ipnet_ip(ipnet, ip_address):
|
|||||||
|
|
||||||
def update_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
def update_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
||||||
address_groups, is_connected=True):
|
address_groups, is_connected=True):
|
||||||
with locking.LockManager.get_lock(str(router_id)):
|
|
||||||
_update_internal_interface(nsxv_manager, context, router_id,
|
|
||||||
int_net_id, address_groups,
|
|
||||||
is_connected=is_connected)
|
|
||||||
|
|
||||||
|
|
||||||
def _update_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
|
||||||
address_groups, is_connected=True):
|
|
||||||
|
|
||||||
# Get edge id
|
# Get edge id
|
||||||
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
||||||
@ -2363,14 +2356,6 @@ def _update_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
|||||||
|
|
||||||
def add_vdr_internal_interface(nsxv_manager, context, router_id,
|
def add_vdr_internal_interface(nsxv_manager, context, router_id,
|
||||||
int_net_id, address_groups, is_connected=True):
|
int_net_id, address_groups, is_connected=True):
|
||||||
with locking.LockManager.get_lock(str(router_id)):
|
|
||||||
_add_vdr_internal_interface(nsxv_manager, context, router_id,
|
|
||||||
int_net_id, address_groups,
|
|
||||||
is_connected=is_connected)
|
|
||||||
|
|
||||||
|
|
||||||
def _add_vdr_internal_interface(nsxv_manager, context, router_id,
|
|
||||||
int_net_id, address_groups, is_connected=True):
|
|
||||||
# Get edge id
|
# Get edge id
|
||||||
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
||||||
edge_id = binding['edge_id']
|
edge_id = binding['edge_id']
|
||||||
@ -2398,15 +2383,6 @@ def _add_vdr_internal_interface(nsxv_manager, context, router_id,
|
|||||||
|
|
||||||
def update_vdr_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
def update_vdr_internal_interface(nsxv_manager, context, router_id, int_net_id,
|
||||||
address_groups, is_connected=True):
|
address_groups, is_connected=True):
|
||||||
with locking.LockManager.get_lock(str(router_id)):
|
|
||||||
_update_vdr_internal_interface(nsxv_manager, context, router_id,
|
|
||||||
int_net_id, address_groups,
|
|
||||||
is_connected=is_connected)
|
|
||||||
|
|
||||||
|
|
||||||
def _update_vdr_internal_interface(nsxv_manager, context, router_id,
|
|
||||||
int_net_id, address_groups,
|
|
||||||
is_connected=True):
|
|
||||||
# Get edge id
|
# Get edge id
|
||||||
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
||||||
edge_id = binding['edge_id']
|
edge_id = binding['edge_id']
|
||||||
@ -2426,13 +2402,7 @@ def _update_vdr_internal_interface(nsxv_manager, context, router_id,
|
|||||||
|
|
||||||
|
|
||||||
def delete_interface(nsxv_manager, context, router_id, network_id, dist=False):
|
def delete_interface(nsxv_manager, context, router_id, network_id, dist=False):
|
||||||
with locking.LockManager.get_lock(str(router_id)):
|
|
||||||
_delete_interface(nsxv_manager, context, router_id, network_id,
|
|
||||||
dist=dist)
|
|
||||||
|
|
||||||
|
|
||||||
def _delete_interface(nsxv_manager, context, router_id, network_id,
|
|
||||||
dist=False):
|
|
||||||
# Get edge id
|
# Get edge id
|
||||||
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
binding = nsxv_db.get_nsxv_router_binding(context.session, router_id)
|
||||||
if not binding:
|
if not binding:
|
||||||
@ -2640,9 +2610,9 @@ class NsxVCallbacks(object):
|
|||||||
else:
|
else:
|
||||||
self._vcm = None
|
self._vcm = None
|
||||||
|
|
||||||
def complete_edge_creation(
|
def complete_edge_creation(self, context, edge_id, name, router_id, dist,
|
||||||
self, context, edge_id, name, router_id, dist, deploy_successful,
|
deploy_successful, availability_zone=None,
|
||||||
availability_zone=None):
|
deploy_metadata=False):
|
||||||
router_db = None
|
router_db = None
|
||||||
if uuidutils.is_uuid_like(router_id):
|
if uuidutils.is_uuid_like(router_id):
|
||||||
try:
|
try:
|
||||||
@ -2652,6 +2622,17 @@ class NsxVCallbacks(object):
|
|||||||
LOG.warning(_LW("Router %s not found"), name)
|
LOG.warning(_LW("Router %s not found"), name)
|
||||||
|
|
||||||
if deploy_successful:
|
if deploy_successful:
|
||||||
|
metadata_proxy_handler = self.plugin.get_metadata_proxy_handler(
|
||||||
|
availability_zone)
|
||||||
|
if deploy_metadata and metadata_proxy_handler:
|
||||||
|
LOG.debug('Update metadata for resource %s',
|
||||||
|
router_id)
|
||||||
|
metadata_proxy_handler.configure_router_edge(
|
||||||
|
context, router_id)
|
||||||
|
|
||||||
|
self.plugin.setup_dhcp_edge_fw_rules(context, self.plugin,
|
||||||
|
router_id)
|
||||||
|
|
||||||
LOG.debug("Successfully deployed %(edge_id)s for router %(name)s",
|
LOG.debug("Successfully deployed %(edge_id)s for router %(name)s",
|
||||||
{'edge_id': edge_id,
|
{'edge_id': edge_id,
|
||||||
'name': name})
|
'name': name})
|
||||||
|
@ -47,7 +47,7 @@ class NsxVPluginWithMdV2TestCase(test_plugin.NsxVPluginV2TestCase):
|
|||||||
mock_alloc_vnic = mock.patch.object(nsxv_db, 'allocate_edge_vnic')
|
mock_alloc_vnic = mock.patch.object(nsxv_db, 'allocate_edge_vnic')
|
||||||
mock_alloc_vnic_inst = mock_alloc_vnic.start()
|
mock_alloc_vnic_inst = mock_alloc_vnic.start()
|
||||||
mock_alloc_vnic_inst.return_value = nsxv_models.NsxvEdgeVnicBinding
|
mock_alloc_vnic_inst.return_value = nsxv_models.NsxvEdgeVnicBinding
|
||||||
mock.patch.object(edge_utils, "_update_internal_interface").start()
|
mock.patch.object(edge_utils, "update_internal_interface").start()
|
||||||
|
|
||||||
super(NsxVPluginWithMdV2TestCase, self).setUp(
|
super(NsxVPluginWithMdV2TestCase, self).setUp(
|
||||||
plugin=plugin, ext_mgr=ext_mgr,
|
plugin=plugin, ext_mgr=ext_mgr,
|
||||||
|
@ -3255,7 +3255,7 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase,
|
|||||||
TestExclusiveRouterTestCase,
|
TestExclusiveRouterTestCase,
|
||||||
self).test_router_add_interface_multiple_ipv6_subnets_same_net()
|
self).test_router_add_interface_multiple_ipv6_subnets_same_net()
|
||||||
|
|
||||||
def _fake_update_edge(self, edge_id, request):
|
def _fake_rename_edge(self, edge_id, name):
|
||||||
raise vcns_exc.VcnsApiException(
|
raise vcns_exc.VcnsApiException(
|
||||||
status=400, header={'status': 200}, uri='fake_url', response='')
|
status=400, header={'status': 200}, uri='fake_url', response='')
|
||||||
|
|
||||||
@ -3272,8 +3272,8 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase,
|
|||||||
return_value=available_edge):
|
return_value=available_edge):
|
||||||
# Mock for update_edge task failure
|
# Mock for update_edge task failure
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
p.nsx_v.vcns, 'update_edge',
|
p.edge_manager.nsxv_manager, 'rename_edge',
|
||||||
side_effect=self._fake_update_edge):
|
side_effect=self._fake_rename_edge):
|
||||||
router = {'router': {'admin_state_up': True,
|
router = {'router': {'admin_state_up': True,
|
||||||
'name': 'e161be1d-0d0d-4046-9823-5a593d94f72c',
|
'name': 'e161be1d-0d0d-4046-9823-5a593d94f72c',
|
||||||
'tenant_id': context.get_admin_context().tenant_id,
|
'tenant_id': context.get_admin_context().tenant_id,
|
||||||
|
@ -128,12 +128,8 @@ class EdgeDHCPManagerTestCase(EdgeUtilsTestCaseMixin):
|
|||||||
self.edge_manager.create_dhcp_edge_service(self.ctx,
|
self.edge_manager.create_dhcp_edge_service(self.ctx,
|
||||||
fake_network['id'],
|
fake_network['id'],
|
||||||
fake_subnet)
|
fake_subnet)
|
||||||
resource_id = (vcns_const.DHCP_EDGE_PREFIX + fake_network['id'])[:36]
|
self.nsxv_manager.rename_edge.assert_called_once_with('edge-1',
|
||||||
self.nsxv_manager.update_edge.assert_called_once_with(
|
mock.ANY)
|
||||||
self.ctx, resource_id, 'edge-1', mock.ANY, None,
|
|
||||||
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['dhcp'],
|
|
||||||
dist=False, set_errors=True,
|
|
||||||
availability_zone=mock.ANY)
|
|
||||||
|
|
||||||
def test_get_random_available_edge(self):
|
def test_get_random_available_edge(self):
|
||||||
available_edge_ids = ['edge-1', 'edge-2']
|
available_edge_ids = ['edge-1', 'edge-2']
|
||||||
@ -700,10 +696,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
|
|||||||
availability_zone=self.az)
|
availability_zone=self.az)
|
||||||
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
|
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
|
||||||
nsxv_constants.SERVICE_EDGE + '-edge-' + str(0))
|
nsxv_constants.SERVICE_EDGE + '-edge-' + str(0))
|
||||||
self.nsxv_manager.update_edge.assert_has_calls(
|
self.nsxv_manager.rename_edge.assert_has_calls(
|
||||||
[mock.call(self.ctx, 'fake_id', edge_id, 'fake_name', None,
|
[mock.call(edge_id, 'fake_name')])
|
||||||
set_errors=True, appliance_size=nsxv_constants.LARGE,
|
|
||||||
dist=False, availability_zone=self.az)])
|
|
||||||
|
|
||||||
def test_allocate_compact_edge_appliance_with_default(self):
|
def test_allocate_compact_edge_appliance_with_default(self):
|
||||||
self.edge_manager.edge_pool_dicts = self.default_edge_pool_dicts
|
self.edge_manager.edge_pool_dicts = self.default_edge_pool_dicts
|
||||||
@ -719,10 +713,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
|
|||||||
availability_zone=self.az)
|
availability_zone=self.az)
|
||||||
edge_id = (EDGE_AVAIL + nsxv_constants.COMPACT + '-' +
|
edge_id = (EDGE_AVAIL + nsxv_constants.COMPACT + '-' +
|
||||||
nsxv_constants.SERVICE_EDGE + '-edge-' + str(0))
|
nsxv_constants.SERVICE_EDGE + '-edge-' + str(0))
|
||||||
self.nsxv_manager.update_edge.assert_has_calls(
|
self.nsxv_manager.rename_edge.assert_has_calls(
|
||||||
[mock.call(self.ctx, 'fake_id', edge_id, 'fake_name', None,
|
[mock.call(edge_id, 'fake_name')])
|
||||||
set_errors=True, appliance_size=nsxv_constants.COMPACT,
|
|
||||||
dist=False, availability_zone=self.az)])
|
|
||||||
|
|
||||||
def test_allocate_large_edge_appliance_with_vdr(self):
|
def test_allocate_large_edge_appliance_with_vdr(self):
|
||||||
self.edge_manager.edge_pool_dicts = self.vdr_edge_pool_dicts
|
self.edge_manager.edge_pool_dicts = self.vdr_edge_pool_dicts
|
||||||
@ -738,10 +730,8 @@ class EdgeManagerTestCase(EdgeUtilsTestCaseMixin):
|
|||||||
availability_zone=self.az)
|
availability_zone=self.az)
|
||||||
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
|
edge_id = (EDGE_AVAIL + nsxv_constants.LARGE + '-' +
|
||||||
nsxv_constants.VDR_EDGE + '-edge-' + str(0))
|
nsxv_constants.VDR_EDGE + '-edge-' + str(0))
|
||||||
self.nsxv_manager.update_edge.assert_has_calls(
|
self.nsxv_manager.rename_edge.assert_has_calls(
|
||||||
[mock.call(self.ctx, 'fake_id', edge_id, 'fake_name', None,
|
[mock.call(edge_id, 'fake_name')])
|
||||||
set_errors=True, appliance_size=nsxv_constants.LARGE,
|
|
||||||
dist=True, availability_zone=self.az)])
|
|
||||||
|
|
||||||
def test_free_edge_appliance_with_empty(self):
|
def test_free_edge_appliance_with_empty(self):
|
||||||
self.edge_manager._clean_all_error_edge_bindings = mock.Mock()
|
self.edge_manager._clean_all_error_edge_bindings = mock.Mock()
|
||||||
|
@ -347,7 +347,7 @@ class VcnsDriverTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
def complete_edge_creation(
|
def complete_edge_creation(
|
||||||
self, context, edge_id, name, router_id, dist, deploy_successful,
|
self, context, edge_id, name, router_id, dist, deploy_successful,
|
||||||
availability_zone=None):
|
availability_zone=None, deploy_metadata=False):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _deploy_edge(self):
|
def _deploy_edge(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user