Add PVC version to cluster status output

This commit is contained in:
Joshua Boniface 2023-02-22 16:05:28 -05:00
parent 32c36c866b
commit e773211293
4 changed files with 27 additions and 1 deletions

View File

@ -486,6 +486,10 @@ class API_Status(Resource):
type: string
description: The current primary coordinator node
example: pvchv1
pvc_version:
type: string
description: The PVC version of the current primary coordinator node
example: 0.9.61
upstream_ip:
type: string
description: The cluster upstream IP address in CIDR format

View File

@ -182,6 +182,13 @@ def format_info(cluster_information, oformat):
ansiprint.purple(), ansiprint.end(), cluster_information["primary_node"]
)
)
ainformation.append(
"{}PVC Version:{} {}".format(
ansiprint.purple(),
ansiprint.end(),
cluster_information.get("pvc_version", "N/A"),
)
)
ainformation.append(
"{}Cluster upstream IP:{} {}".format(
ansiprint.purple(), ansiprint.end(), cluster_information["upstream_ip"]

View File

@ -194,6 +194,15 @@ def getClusterInformation(zkhandler):
# Get node information object list
retcode, node_list = pvc_node.get_list(zkhandler, None)
# Get primary node
primary_node = common.getPrimaryNode(zkhandler)
# Get PVC version of primary node
pvc_version = "0.0.0"
for node in node_list:
if node["name"] == primary_node:
pvc_version = node["pvc_version"]
# Get vm information object list
retcode, vm_list = pvc_vm.get_list(zkhandler, None, None, None, None)
@ -295,7 +304,8 @@ def getClusterInformation(zkhandler):
),
"node_health": getNodeHealth(zkhandler, node_list),
"maintenance": maintenance_state,
"primary_node": common.getPrimaryNode(zkhandler),
"primary_node": primary_node,
"pvc_version": pvc_version,
"upstream_ip": zkhandler.read("base.config.upstream_ip"),
"nodes": formatted_node_states,
"vms": formatted_vm_states,

View File

@ -103,6 +103,11 @@
"example": "pvchv1",
"type": "string"
},
"pvc_version": {
"description": "The PVC version of the current primary coordinator node",
"example": "0.9.61",
"type": "string"
},
"snapshots": {
"description": "The total number of snapshots in the storage cluster",
"type": "integer"