From c20985c0402214ffecae3d04465854d8385f28de Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 4 Dec 2016 10:54:54 +0200 Subject: [PATCH] NSX|v fix get_network_availability_zones method signature get_network_availability_zones function should not get the context as an arg, to match the neutron function signature Instead we will use the admin context. Change-Id: If6c3817cb385910b5542aa5e9741a0ff1f012a81 --- vmware_nsx/plugins/nsx_v/plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 0229c8553d..ae15f73265 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -599,7 +599,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # update availability zones network[az_ext.AVAILABILITY_ZONES] = ( - self.get_network_availability_zones(context, network)) + self._get_network_availability_zones(context, network)) def _get_subnet_as_providers(self, context, subnet): net_id = subnet.get('network_id') @@ -2519,9 +2519,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # fallback return nsx_az.DEFAULT_NAME - def get_network_availability_zones(self, context, net_db): - """Return availability zones which a network belongs to.""" + def get_network_availability_zones(self, net_db): + context = n_context.get_admin_context() + return self._get_network_availability_zones(context, net_db) + def _get_network_availability_zones(self, context, net_db): + """Return availability zones which a network belongs to.""" resource_id = (vcns_const.DHCP_EDGE_PREFIX + net_db["id"])[:36] dhcp_edge_binding = nsxv_db.get_nsxv_router_binding( context.session, resource_id)