From f8fb0569035a19fbee5eeff10f5afbc9864f9760 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Thu, 1 Jun 2017 10:52:08 +0300 Subject: [PATCH] NSX|V AZ validation message Add more informative error message when the availability zones validation fails. Change-Id: I8052e7e0bcaac3281e8509551f5cb8a3700ff96e --- vmware_nsx/plugins/nsx_v/availability_zones.py | 6 ++++-- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/availability_zones.py b/vmware_nsx/plugins/nsx_v/availability_zones.py index b1a6b9c541..dcae7e46e1 100644 --- a/vmware_nsx/plugins/nsx_v/availability_zones.py +++ b/vmware_nsx/plugins/nsx_v/availability_zones.py @@ -214,8 +214,10 @@ class NsxVAvailabilityZones(common_az.ConfiguredAvailabilityZones): """ resources = set() for az in self.list_availability_zones_objects(): - resources.add(az.resource_pool) - resources.add(az.datastore_id) + if az.resource_pool: + resources.add(az.resource_pool) + if az.datastore_id: + resources.add(az.datastore_id) if az.ha_datastore_id: resources.add(az.ha_datastore_id) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index f7e55d7fe2..d48fa9e3ec 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -4308,7 +4308,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # Add the availability zones resources az_resources = self._availability_zones_data.get_inventory() for res in az_resources: - inventory.append((res, 'availability_zones')) + inventory.append((res, 'availability_zone ' + res)) if cfg.CONF.nsxv.use_nsx_policies: # if use_nsx_policies=True, the default policy must be defined