From e9aa545e9b6b5ec4d7e38fdede4c95ff7479943e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 22 Feb 2023 00:06:52 -0500 Subject: [PATCH] Update API specification --- api-daemon/pvcapid/flaskapi.py | 66 +++++++++++++++++++++--- docs/manuals/swagger.json | 93 ++++++++++++++++++++++++++++++---- 2 files changed, 141 insertions(+), 18 deletions(-) diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 1628a080..68dfb443 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -448,14 +448,40 @@ class API_Status(Resource): type: object id: ClusterStatus properties: - health: + cluster_health: + type: object + properties: + health: + type: integer + description: The overall health (%) of the cluster + example: 100 + messages: + type: array + description: A list of health event strings + items: + type: string + example: "hv1: plugin 'nics': bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps" + node_health: + type: object + properties: + hvX: + type: object + description: A node entry for per-node health details, one per node in the cluster + properties: + health: + type: integer + description: The health (%) of the node + example: 100 + messages: + type: array + description: A list of health event strings + items: + type: string + example: "'nics': bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps" + maintenance: type: string - description: The overall cluster health - example: Optimal - storage_health: - type: string - description: The overall storage cluster health - example: Optimal + description: Whether the cluster is in maintenance mode or not (string boolean) + example: true primary_node: type: string description: The current primary coordinator node @@ -605,6 +631,32 @@ class API_Node_Root(Resource): arch: type: string description: The architecture of the CPU + health: + type: integer + description: The overall health (%) of the node + example: 100 + health_details: + type: array + description: A list of health plugin results + items: + type: object + properties: + name: + type: string + description: The name of the health plugin + example: nics + last_run: + type: integer + description: The UNIX timestamp (s) of the last plugin run + example: 1676786078 + health_delta: + type: integer + description: The health delta (negatively applied to the health percentage) of the plugin's current state + example: 10 + message: + type: string + description: The output message of the plugin + example: "bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps" load: type: number format: float diff --git a/docs/manuals/swagger.json b/docs/manuals/swagger.json index 03001f4d..2212b596 100644 --- a/docs/manuals/swagger.json +++ b/docs/manuals/swagger.json @@ -15,15 +15,57 @@ }, "ClusterStatus": { "properties": { - "health": { - "description": "The overall cluster health", - "example": "Optimal", + "cluster_health": { + "properties": { + "health": { + "description": "The overall health (%) of the cluster", + "example": 100, + "type": "integer" + }, + "messages": { + "description": "A list of health event strings", + "items": { + "example": "hv1: plugin 'nics': bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps", + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "maintenance": { + "description": "Whether the cluster is in maintenance mode or not (string boolean)", + "example": true, "type": "string" }, "networks": { "description": "The total number of networks in the cluster", "type": "integer" }, + "node_health": { + "properties": { + "hvX": { + "description": "A node entry for per-node health details, one per node in the cluster", + "properties": { + "health": { + "description": "The health (%) of the node", + "example": 100, + "type": "integer" + }, + "messages": { + "description": "A list of health event strings", + "items": { + "example": "'nics': bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps", + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "type": "object" + }, "nodes": { "properties": { "state-combination": { @@ -65,11 +107,6 @@ "description": "The total number of snapshots in the storage cluster", "type": "integer" }, - "storage_health": { - "description": "The overall storage cluster health", - "example": "Optimal", - "type": "string" - }, "upstream_ip": { "description": "The cluster upstream IP address in CIDR format", "example": "10.0.0.254/24", @@ -456,6 +493,40 @@ "description": "The number of running domains (VMs)", "type": "integer" }, + "health": { + "description": "The overall health (%) of the node", + "example": 100, + "type": "integer" + }, + "health_details": { + "description": "A list of health plugin results", + "items": { + "properties": { + "health_delta": { + "description": "The health delta (negatively applied to the health percentage) of the plugin's current state", + "example": 10, + "type": "integer" + }, + "last_run": { + "description": "The UNIX timestamp (s) of the last plugin run", + "example": 1676786078, + "type": "integer" + }, + "message": { + "description": "The output message of the plugin", + "example": "bond0 DEGRADED with 1 active slaves, bond0 OK at 10000 Mbps", + "type": "string" + }, + "name": { + "description": "The name of the health plugin", + "example": "nics", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, "kernel": { "desription": "The running kernel version from uname", "type": "string" @@ -6177,7 +6248,7 @@ "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference", "enum": [ "mem", - "memfree", + "memprov", "vcpus", "load", "vms", @@ -6336,7 +6407,7 @@ "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference", "enum": [ "mem", - "memfree", + "memprov", "vcpus", "load", "vms", @@ -6597,7 +6668,7 @@ "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference", "enum": [ "mem", - "memfree", + "memprov", "vcpus", "load", "vms",