diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 84931555..01e0b79b 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -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 diff --git a/client-cli/pvc/cli_lib/cluster.py b/client-cli/pvc/cli_lib/cluster.py index dab99c37..d0ce968a 100644 --- a/client-cli/pvc/cli_lib/cluster.py +++ b/client-cli/pvc/cli_lib/cluster.py @@ -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"] diff --git a/daemon-common/cluster.py b/daemon-common/cluster.py index a5139997..645dc165 100644 --- a/daemon-common/cluster.py +++ b/daemon-common/cluster.py @@ -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, diff --git a/docs/manuals/swagger.json b/docs/manuals/swagger.json index dd8cce8d..9096fb79 100644 --- a/docs/manuals/swagger.json +++ b/docs/manuals/swagger.json @@ -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"