From 3ac090881314f4678d01a898307337172be7a7d1 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 16 Jan 2017 23:03:16 -0800 Subject: [PATCH] NSX|V: ensure that metata port cleanup is done We need to ensure that the metadata port is correctly deleted when a edge is recycled. We need an elevated context to do this. Change-Id: Ib321dd7b4452427600170eba72c6f26bac2bc8b8 --- vmware_nsx/plugins/nsx_v/md_proxy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index a42bc97271..09cff1bbf0 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -692,7 +692,8 @@ class NsxVMetadataProxyHandler(object): filters = { 'network_id': [self.internal_net], 'device_id': [rtr_id]} - ports = self.nsxv_plugin.get_ports(context, filters=filters) + ctx = context.elevated() + ports = self.nsxv_plugin.get_ports(ctx, filters=filters) if ports: if warn: @@ -701,7 +702,7 @@ class NsxVMetadataProxyHandler(object): {'port': ports[0]['id'], 'router': rtr_id}) try: self.nsxv_plugin.delete_port( - context, ports[0]['id'], + ctx, ports[0]['id'], l3_port_check=False) except Exception as e: LOG.error(_LE("Failed to delete md_proxy port %(port)s: "