NSX-V| Adding datacenter to availability zones config
The datacenter_moid will be a part of each availability zone. If not configured inside the AZ, the global (default) one will be used. Change-Id: I80d8dfdaaeb1745f5f2fa59a80b5f8c74d2d7b31
This commit is contained in:
parent
0159ebf161
commit
72af9f1b34
@ -702,6 +702,9 @@ nsxv_az_opts = [
|
||||
'that active/backup edges are placed in the listed '
|
||||
'host groups. 2 predefined host groups need to be '
|
||||
'configured.')),
|
||||
cfg.StrOpt('datacenter_moid',
|
||||
help=_('(Optional) Identifying the ID of datacenter to deploy '
|
||||
'NSX Edges')),
|
||||
cfg.ListOpt('backup_edge_pool',
|
||||
help=_("(Optional) Defines edge pool's management range for "
|
||||
"the availability zone. If not defined, the global one "
|
||||
|
@ -60,6 +60,7 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone):
|
||||
# Some parameters are not supported in this format.
|
||||
# using the global ones instead.
|
||||
self.ha_placement_random = cfg.CONF.nsxv.ha_placement_random
|
||||
self.datacenter_moid = cfg.CONF.nsxv.datacenter_moid
|
||||
self.backup_edge_pool = cfg.CONF.nsxv.backup_edge_pool
|
||||
self.external_network = cfg.CONF.nsxv.external_network
|
||||
self.vdn_scope_id = cfg.CONF.nsxv.vdn_scope_id
|
||||
@ -102,6 +103,10 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone):
|
||||
self.ha_placement_random = (
|
||||
cfg.CONF.nsxv.ha_placement_random)
|
||||
|
||||
self.datacenter_moid = az_info.get('datacenter_moid')
|
||||
if not self.datacenter_moid:
|
||||
self.datacenter_moid = cfg.CONF.nsxv.datacenter_moid
|
||||
|
||||
self.backup_edge_pool = az_info.get('backup_edge_pool', [])
|
||||
if not self.backup_edge_pool:
|
||||
self.backup_edge_pool = cfg.CONF.nsxv.backup_edge_pool
|
||||
@ -170,6 +175,7 @@ class NsxVAvailabilityZone(common_az.ConfiguredAvailabilityZone):
|
||||
self.edge_ha = cfg.CONF.nsxv.edge_ha
|
||||
self.ha_datastore_id = cfg.CONF.nsxv.ha_datastore_id
|
||||
self.ha_placement_random = cfg.CONF.nsxv.ha_placement_random
|
||||
self.datacenter_moid = cfg.CONF.nsxv.datacenter_moid
|
||||
self.backup_edge_pool = cfg.CONF.nsxv.backup_edge_pool
|
||||
self.az_metadata_support = True
|
||||
self.mgt_net_moid = cfg.CONF.nsxv.mgt_net_moid
|
||||
@ -213,4 +219,6 @@ class NsxVAvailabilityZones(common_az.ConfiguredAvailabilityZones):
|
||||
resources.append(az.vdn_scope_id)
|
||||
if az.mgt_net_moid:
|
||||
resources.append(az.mgt_net_moid)
|
||||
if az.datacenter_moid:
|
||||
resources.append(az.datacenter_moid)
|
||||
return resources
|
||||
|
@ -386,7 +386,7 @@ class EdgeApplianceDriver(object):
|
||||
|
||||
edge_name = name
|
||||
edge = self._assemble_edge(
|
||||
edge_name, datacenter_moid=self.datacenter_moid,
|
||||
edge_name, datacenter_moid=availability_zone.datacenter_moid,
|
||||
deployment_container_id=self.deployment_container_id,
|
||||
appliance_size=appliance_size, remote_access=False, dist=dist,
|
||||
edge_ha=availability_zone.edge_ha)
|
||||
@ -459,7 +459,7 @@ class EdgeApplianceDriver(object):
|
||||
set_errors=False, availability_zone=None):
|
||||
"""Update edge name."""
|
||||
edge = self._assemble_edge(
|
||||
name, datacenter_moid=self.datacenter_moid,
|
||||
name, datacenter_moid=availability_zone.datacenter_moid,
|
||||
deployment_container_id=self.deployment_container_id,
|
||||
appliance_size=appliance_size, remote_access=False, dist=dist,
|
||||
edge_ha=availability_zone.edge_ha)
|
||||
|
@ -40,7 +40,6 @@ class VcnsDriver(edge_appliance_driver.EdgeApplianceDriver,
|
||||
self.vcns_passwd = cfg.CONF.nsxv.password
|
||||
self.ca_file = cfg.CONF.nsxv.ca_file
|
||||
self.insecure = cfg.CONF.nsxv.insecure
|
||||
self.datacenter_moid = cfg.CONF.nsxv.datacenter_moid
|
||||
self.deployment_container_id = cfg.CONF.nsxv.deployment_container_id
|
||||
self._pid = None
|
||||
self._task_manager = None
|
||||
|
@ -44,6 +44,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
|
||||
ha_datastore_id="hastore",
|
||||
backup_edge_pool=DEF_AZ_POOL,
|
||||
ha_placement_random=False,
|
||||
datacenter_moid="datacenter",
|
||||
mgt_net_moid="portgroup-407",
|
||||
mgt_net_proxy_ips=["1.1.1.1"],
|
||||
mgt_net_proxy_netmask="255.255.255.0",
|
||||
@ -64,6 +65,10 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
|
||||
cfg.CONF.set_override("ha_placement_random",
|
||||
ha_placement_random,
|
||||
group=self.group_name)
|
||||
if datacenter_moid is not None:
|
||||
cfg.CONF.set_override("datacenter_moid",
|
||||
datacenter_moid,
|
||||
group=self.group_name)
|
||||
if backup_edge_pool is not None:
|
||||
cfg.CONF.set_override("backup_edge_pool", backup_edge_pool,
|
||||
group=self.group_name)
|
||||
@ -100,6 +105,7 @@ class NsxvAvailabilityZonesTestCase(base.BaseTestCase):
|
||||
self.assertTrue(az.edge_ha)
|
||||
self.assertEqual("hastore", az.ha_datastore_id)
|
||||
self.assertFalse(az.ha_placement_random)
|
||||
self.assertEqual("datacenter", az.datacenter_moid)
|
||||
self.assertEqual(DEF_AZ_POOL, az.backup_edge_pool)
|
||||
self.assertEqual("portgroup-407", az.mgt_net_moid)
|
||||
self.assertEqual(["1.1.1.1"], az.mgt_net_proxy_ips)
|
||||
|
Loading…
Reference in New Issue
Block a user