From 4cdf1f7247eba88154ffd2c4a511f842363d8d87 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 7 Jun 2020 02:15:33 -0400 Subject: [PATCH] Add statistics values to the API --- api-daemon/pvcapid/flaskapi.py | 81 +++++++++++++++++++++++ docs/manuals/swagger.json | 116 +++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index c67956e0..001de8b2 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -803,12 +803,57 @@ class API_VM_Root(Resource): memory: type: integer description: The assigned RAM of the VM in MB + memory_stats: + type: object + properties: + actual: + type: integer + description: The total active memory of the VM in kB + swap_in: + type: integer + description: The amount of swapped in data in kB + swap_out: + type: integer + description: The amount of swapped out data in kB + major_fault: + type: integer + description: The number of major page faults + minor_fault: + type: integer + description: The number of minor page faults + unused: + type: integer + description: The amount of memory left completely unused by the system in kB + available: + type: integer + description: The total amount of usable memory as seen by the domain in kB + usable: + type: integer + description: How much the balloon can be inflated without pushing the guest system to swap in kB + last_update: + type: integer + description: Timestamp of the last update of statistics, in seconds + rss: + type: integer + description: The Resident Set Size of the process running the domain in kB vcpu: type: integer description: The assigned vCPUs of the VM vcpu_topology: type: string description: The topology of the assigned vCPUs in Sockets/Cores/Threads format + vcpu_stats: + type: object + properties: + cpu_time: + type: integer + description: The active CPU time for all vCPUs + user_time: + type: integer + description: vCPU user time + system_time: + type: integer + description: vCPU system time type: type: string description: The type of the VM @@ -847,6 +892,30 @@ class API_VM_Root(Resource): model: type: string description: The virtual network device model + rd_bytes: + type: integer + description: The number of read bytes on the interface + rd_packets: + type: integer + description: The number of read packets on the interface + rd_errors: + type: integer + description: The number of read errors on the interface + rd_drops: + type: integer + description: The number of read drops on the interface + wr_bytes: + type: integer + description: The number of write bytes on the interface + wr_packets: + type: integer + description: The number of write packets on the interface + wr_errors: + type: integer + description: The number of write errors on the interface + wr_drops: + type: integer + description: The number of write drops on the interface disks: type: array description: The PVC storage volumes attached to the VM @@ -865,6 +934,18 @@ class API_VM_Root(Resource): bus: type: string description: The virtual bus of the volume in the VM + rd_req: + type: integer + description: The number of read requests from the volume + rd_bytes: + type: integer + description: The number of read bytes from the volume + wr_req: + type: integer + description: The number of write requests to the volume + wr_bytes: + type: integer + description: The number of write bytes to the volume controllers: type: array description: The device controllers attached to the VM diff --git a/docs/manuals/swagger.json b/docs/manuals/swagger.json index 61ceb3e6..5bc79e2a 100644 --- a/docs/manuals/swagger.json +++ b/docs/manuals/swagger.json @@ -908,9 +908,25 @@ "description": "The full name of the volume in \"pool/volume\" format", "type": "string" }, + "rd_bytes": { + "description": "The number of read bytes from the volume", + "type": "integer" + }, + "rd_req": { + "description": "The number of read requests from the volume", + "type": "integer" + }, "type": { "description": "The type of volume", "type": "string" + }, + "wr_bytes": { + "description": "The number of write bytes to the volume", + "type": "integer" + }, + "wr_req": { + "description": "The number of write requests to the volume", + "type": "integer" } }, "type": "object" @@ -944,6 +960,51 @@ "description": "The assigned RAM of the VM in MB", "type": "integer" }, + "memory_stats": { + "properties": { + "actual": { + "description": "The total active memory of the VM in kB", + "type": "integer" + }, + "available": { + "description": "The total amount of usable memory as seen by the domain in kB", + "type": "integer" + }, + "last_update": { + "description": "Timestamp of the last update of statistics, in seconds", + "type": "integer" + }, + "major_fault": { + "description": "The number of major page faults", + "type": "integer" + }, + "minor_fault": { + "description": "The number of minor page faults", + "type": "integer" + }, + "rss": { + "description": "The Resident Set Size of the process running the domain in kB", + "type": "integer" + }, + "swap_in": { + "description": "The amount of swapped in data in kB", + "type": "integer" + }, + "swap_out": { + "description": "The amount of swapped out data in kB", + "type": "integer" + }, + "unused": { + "description": "The amount of memory left completely unused by the system in kB", + "type": "integer" + }, + "usable": { + "description": "How much the balloon can be inflated without pushing the guest system to swap in kB", + "type": "integer" + } + }, + "type": "object" + }, "migrated": { "description": "Whether the VM has been migrated, either \"no\" or \"from \"", "type": "string" @@ -964,6 +1025,22 @@ "description": "The virtual network device model", "type": "string" }, + "rd_bytes": { + "description": "The number of read bytes on the interface", + "type": "integer" + }, + "rd_drops": { + "description": "The number of read drops on the interface", + "type": "integer" + }, + "rd_errors": { + "description": "The number of read errors on the interface", + "type": "integer" + }, + "rd_packets": { + "description": "The number of read packets on the interface", + "type": "integer" + }, "source": { "description": "The parent network bridge on the node", "type": "string" @@ -971,6 +1048,22 @@ "type": { "description": "The PVC network type", "type": "string" + }, + "wr_bytes": { + "description": "The number of write bytes on the interface", + "type": "integer" + }, + "wr_drops": { + "description": "The number of write drops on the interface", + "type": "integer" + }, + "wr_errors": { + "description": "The number of write errors on the interface", + "type": "integer" + }, + "wr_packets": { + "description": "The number of write packets on the interface", + "type": "integer" } }, "type": "object" @@ -1016,6 +1109,23 @@ "description": "The assigned vCPUs of the VM", "type": "integer" }, + "vcpu_stats": { + "properties": { + "cpu_time": { + "description": "The active CPU time for all vCPUs", + "type": "integer" + }, + "system_time": { + "description": "vCPU system time", + "type": "integer" + }, + "user_time": { + "description": "vCPU user time", + "type": "integer" + } + }, + "type": "object" + }, "vcpu_topology": { "description": "The topology of the assigned vCPUs in Sockets/Cores/Threads format", "type": "string" @@ -5497,6 +5607,12 @@ "in": "query", "name": "wait", "type": "boolean" + }, + { + "description": "Whether to enforce live migration and disable shutdown-based fallback migration", + "in": "query", + "name": "force_live", + "type": "boolean" } ], "responses": {