Browse Source

NSXV: validate metadata config for AZs

When an AZ is configured with a non-default DVS id, it must have a
metadata configuration as well.
The minimum required is the metadata edge IPs.

Change-Id: Iebbbf6e73975c67876a925a4d54a6a263c4da10f
(cherry picked from commit 8031a85420)
changes/80/813580/1
Kobi Samoray 8 months ago
parent
commit
49549133f8
  1. 8
      vmware_nsx/plugins/nsx_v/availability_zones.py
  2. 2
      vmware_nsx/tests/unit/nsx_v/test_availability_zones.py

8
vmware_nsx/plugins/nsx_v/availability_zones.py

@ -175,6 +175,14 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone):
self.mgt_net_default_gateway = (
cfg.CONF.nsxv.mgt_net_default_gateway)
elif (az_info.get('dvs_id') and
az_info['dvs_id'] != cfg.CONF.nsxv.dvs_id):
raise nsx_exc.NsxInvalidConfiguration(
opt_name="mgt_net_proxy_ips",
opt_value='None',
reason=(_("mgt_net_proxy_ips for availability zone "
"%s must specified when DVS id is non-default") %
az_name))
else:
self.az_metadata_support = False
self.mgt_net_moid = None

2
vmware_nsx/tests/unit/nsx_v/test_availability_zones.py

@ -185,7 +185,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
self.assertEqual(DEF_GLOBAL_POOL, az.backup_edge_pool)
def test_availability_zone_missing_metadata(self):
self._config_az(mgt_net_proxy_ips=None)
self._config_az(mgt_net_proxy_ips=None, dvs_id=None)
az = nsx_az.NsxVAvailabilityZone(self.az_name)
self.assertIsNone(az.mgt_net_moid)
self.assertEqual([], az.mgt_net_proxy_ips)

Loading…
Cancel
Save