NSX|V: add HA status to admin list of edges

Enahnce the output of the edges. This will now habe the HA
status of the edges.

Change-Id: Ieadcf0cd5bb9609c1d76948f2eadf054dc3d27cf
This commit is contained in:
ashok2988 2017-11-17 15:19:09 +05:30 committed by Gary Kotton
parent 2db615d376
commit 87c40e8d5b
2 changed files with 10 additions and 4 deletions

View File

@ -49,7 +49,7 @@ nsxv = utils.get_nsxv_client()
def nsx_list_edges(resource, event, trigger, **kwargs):
"""List edges from NSXv backend"""
headers = ['id', 'name', 'type', 'size']
headers = ['id', 'name', 'type', 'size', 'ha']
edges = utils.get_nsxv_backend_edges()
if (kwargs.get('verbose')):
headers += ['syslog']

View File

@ -106,13 +106,19 @@ def get_nsxv_backend_edges():
edges = nsxv.get_edges()
backend_edges = []
for edge in edges:
summary = edge.get('appliancesSummary')
size = ha = None
if summary:
size = summary.get('applianceSize')
deployed_vms = summary.get('numberOfDeployedVms', 1)
ha = 'Enabled' if deployed_vms > 1 else 'Disabled'
# get all the relevant backend information for this edge
edge_data = {
'id': edge.get('id'),
'name': edge.get('name'),
'size': edge['appliancesSummary'].get(
'applianceSize') if edge.get('appliancesSummary') else None,
'type': edge.get('edgeType')
'size': size,
'type': edge.get('edgeType'),
'ha': ha,
}
backend_edges.append(edge_data)
return backend_edges