Merge "NSX|v fix some host group placement issues"
This commit is contained in:
commit
54cc890227
@ -427,11 +427,13 @@ class EdgeApplianceDriver(object):
|
||||
|
||||
self.callbacks.complete_edge_creation(
|
||||
context, edge_id, name, router_id, dist, True,
|
||||
availability_zone, deploy_metadata=deploy_metadata)
|
||||
availability_zone=availability_zone,
|
||||
deploy_metadata=deploy_metadata)
|
||||
|
||||
except exceptions.VcnsApiException:
|
||||
self.callbacks.complete_edge_creation(
|
||||
context, edge_id, name, router_id, dist, False)
|
||||
context, edge_id, name, router_id, dist, False,
|
||||
availability_zone=availability_zone)
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception("NSXv: deploy edge failed.")
|
||||
return edge_id
|
||||
|
@ -721,7 +721,8 @@ class EdgeManager(object):
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
self.nsxv_manager.callbacks.complete_edge_creation(
|
||||
context, edge_id, lrouter['name'], lrouter['id'], dist,
|
||||
True, deploy_metadata=deploy_metadata)
|
||||
True, availability_zone=availability_zone,
|
||||
deploy_metadata=deploy_metadata)
|
||||
|
||||
try:
|
||||
self.nsxv_manager.rename_edge(edge_id, name)
|
||||
@ -2660,7 +2661,7 @@ class NsxVCallbacks(object):
|
||||
|
||||
if deploy_successful:
|
||||
metadata_proxy_handler = self.plugin.get_metadata_proxy_handler(
|
||||
availability_zone)
|
||||
availability_zone.name)
|
||||
if deploy_metadata and metadata_proxy_handler:
|
||||
LOG.debug('Update metadata for resource %s',
|
||||
router_id)
|
||||
|
@ -367,14 +367,14 @@ def change_edge_appliance_reservations(properties):
|
||||
LOG.error("%s", str(e))
|
||||
|
||||
|
||||
def _update_host_group_for_edge(nsxv, dvs_mng, edge_id, edge):
|
||||
def _update_host_group_for_edge(nsxv, cluster_mng, edge_id, edge):
|
||||
if edge.get('type') == 'gatewayServices':
|
||||
try:
|
||||
az_name, size = _get_edge_az_and_size(edge_id)
|
||||
zones = nsx_az.NsxVAvailabilityZones()
|
||||
az = zones.get_availability_zone(az_name)
|
||||
edge_utils.update_edge_host_groups(nsxv, edge_id,
|
||||
dvs_mng, az,
|
||||
cluster_mng, az,
|
||||
validate=True)
|
||||
except Exception as e:
|
||||
LOG.error("Failed to update edge %(id)s - %(e)s",
|
||||
@ -385,7 +385,7 @@ def _update_host_group_for_edge(nsxv, dvs_mng, edge_id, edge):
|
||||
|
||||
|
||||
def change_edge_hostgroup(properties):
|
||||
dvs_mng = dvs.DvsManager()
|
||||
cluster_mng = dvs.ClusterManager()
|
||||
if properties.get('hostgroup').lower() == "update":
|
||||
edge_id = properties.get('edge-id')
|
||||
try:
|
||||
@ -396,19 +396,19 @@ def change_edge_hostgroup(properties):
|
||||
# edge_result[0] is response status code
|
||||
# edge_result[1] is response body
|
||||
edge = edge_result[1]
|
||||
_update_host_group_for_edge(nsxv, dvs_mng,
|
||||
_update_host_group_for_edge(nsxv, cluster_mng,
|
||||
edge_id, edge)
|
||||
elif properties.get('hostgroup').lower() == "all":
|
||||
edges = utils.get_nsxv_backend_edges()
|
||||
for edge in edges:
|
||||
edge_id = edge['id']
|
||||
_update_host_group_for_edge(nsxv, dvs_mng,
|
||||
_update_host_group_for_edge(nsxv, cluster_mng,
|
||||
edge_id, edge)
|
||||
elif properties.get('hostgroup').lower() == "clean":
|
||||
azs = nsx_az.NsxVAvailabilityZones()
|
||||
for az in azs.list_availability_zones_objects():
|
||||
try:
|
||||
edge_utils.clean_host_groups(dvs_mng, az)
|
||||
edge_utils.clean_host_groups(cluster_mng, az)
|
||||
except Exception:
|
||||
LOG.error("Failed to clean AZ %s", az.name)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user