Merge "NSX|P: No need to add resource name on update"

This commit is contained in:
Zuul 2019-01-15 08:42:35 +00:00 committed by Gerrit Code Review
commit 5de7e0444b

View File

@ -1094,8 +1094,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
new_enable_snat = router.enable_snat new_enable_snat = router.enable_snat
newaddr, newmask, _newnexthop = self._get_external_attachment_info( newaddr, newmask, _newnexthop = self._get_external_attachment_info(
context, router) context, router)
router_name = utils.get_name_and_uuid(router['name'] or 'router',
router['id'])
router_subnets = self._find_router_subnets( router_subnets = self._find_router_subnets(
context.elevated(), router_id) context.elevated(), router_id)
actions = self._get_update_router_gw_actions( actions = self._get_update_router_gw_actions(
@ -1116,11 +1114,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
if (actions['remove_router_link_port'] or if (actions['remove_router_link_port'] or
actions['add_router_link_port']): actions['add_router_link_port']):
# GW was changed # GW was changed
#TODO(asarfaty): adding the router name even though it was not self.nsxpolicy.tier1.update(router_id, tier0=new_tier0_uuid)
# changed because otherwise the NSX will set it to default.
# This code should be removed once NSX supports it.
self.nsxpolicy.tier1.update(router_id, name=router_name,
tier0=new_tier0_uuid)
# Set/Unset the router TZ to allow vlan switches traffic # Set/Unset the router TZ to allow vlan switches traffic
if cfg.CONF.nsx_p.allow_passthrough: if cfg.CONF.nsx_p.allow_passthrough:
@ -1329,13 +1323,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
#TODO(asarfaty): it is enough to validate only the new subnet, #TODO(asarfaty): it is enough to validate only the new subnet,
# and not all # and not all
self._validate_router_tz(context.elevated(), tier0_uuid, subnets) self._validate_router_tz(context.elevated(), tier0_uuid, subnets)
#TODO(asarfaty): adding the segment name even though it was not
# changed because otherwise the NSX will set it to default.
# This code should be removed once NSX supports it.
net = self._get_network(context, network_id)
net_name = utils.get_name_and_uuid(
net['name'] or 'network', network_id)
segment_id = self._get_network_nsx_segment_id(context, network_id) segment_id = self._get_network_nsx_segment_id(context, network_id)
subnet = self.get_subnet(context, info['subnet_ids'][0]) subnet = self.get_subnet(context, info['subnet_ids'][0])
cidr_prefix = int(subnet['cidr'].split('/')[1]) cidr_prefix = int(subnet['cidr'].split('/')[1])
@ -1343,7 +1330,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
pol_subnet = policy_defs.Subnet( pol_subnet = policy_defs.Subnet(
gateway_address=gw_addr) gateway_address=gw_addr)
self.nsxpolicy.segment.update(segment_id, self.nsxpolicy.segment.update(segment_id,
name=net_name,
tier1_id=router_id, tier1_id=router_id,
subnets=[pol_subnet]) subnets=[pol_subnet])