From eb06c1494efa972d38bda0c1358fd8d3f1953f39 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 25 Aug 2020 12:43:16 -0400 Subject: [PATCH] Add API spec for benchmark results --- api-daemon/pvcapid/flaskapi.py | 106 ++++++++++++++++- docs/manuals/swagger.json | 202 +++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 3 deletions(-) diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index d1852818..562a9f55 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -2619,15 +2619,115 @@ class API_Storage_Ceph_Benchmark(Resource): --- tags: - storage / ceph + parameters: + - in: query + name: job + type: string + required: false + description: A single job name to limit results to responses: 200: description: OK schema: type: object + id: storagebenchmark properties: - tbd: + id: + type: string (containing integer) + description: The database ID of the test result + job: + type: string + description: The job name (an ISO date) of the test result + benchmark_result: type: object - description: TBD + properties: + test_name: + type: object + properties: + overall: + type: object + properties: + iosize: + type: string (integer) + description: The total size of the benchmark data + bandwidth: + type: string (integer) + description: The average bandwidth (KiB/s) + iops: + type: string (integer) + description: The average IOPS + runtime: + type: string (integer) + description: The total test time in milliseconds + latency: + type: object + properties: + min: + type: string (integer) + description: The minimum latency measurement + max: + type: string (integer) + description: The maximum latency measurement + mean: + type: string (float) + description: The mean latency measurement + stdev: + type: string (float) + description: The standard deviation of latency + bandwidth: + type: object + properties: + min: + type: string (integer) + description: The minimum bandwidth (KiB/s) measurement + max: + type: string (integer) + description: The maximum bandwidth (KiB/s) measurement + mean: + type: string (float) + description: The mean bandwidth (KiB/s) measurement + stdev: + type: string (float) + description: The standard deviation of bandwidth + numsamples: + type: string (integer) + description: The number of samples taken during the test + iops: + type: object + properties: + min: + type: string (integer) + description: The minimum IOPS measurement + max: + type: string (integer) + description: The maximum IOPS measurement + mean: + type: string (float) + description: The mean IOPS measurement + stdev: + type: string (float) + description: The standard deviation of IOPS + numsamples: + type: string (integer) + description: The number of samples taken during the test + cpu: + type: object + properties: + user: + type: string (float percentage) + description: The percentage of test time spent in user space + system: + type: string (float percentage) + description: The percentage of test time spent in system (kernel) space + ctxsw: + type: string (integer) + description: The number of context switches during the test + majfault: + type: string (integer) + description: The number of major page faults during the test + minfault: + type: string (integer) + description: The number of minor page faults during the test """ return api_benchmark.list_benchmarks(reqargs.get('job', None)) @@ -2652,7 +2752,7 @@ class API_Storage_Ceph_Benchmark(Resource): description: OK schema: type: string - description: The job ID of the benchmark + description: The Celery job ID of the benchmark (unused elsewhere) """ # Verify that the pool is valid _list, code = api_helper.ceph_pool_list(reqargs.get('pool', None), is_fuzzy=False) diff --git a/docs/manuals/swagger.json b/docs/manuals/swagger.json index f37908c7..b91d2549 100644 --- a/docs/manuals/swagger.json +++ b/docs/manuals/swagger.json @@ -62,6 +62,11 @@ "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", @@ -799,6 +804,146 @@ }, "type": "object" }, + "storagebenchmark": { + "properties": { + "benchmark_result": { + "properties": { + "test_name": { + "properties": { + "bandwidth": { + "properties": { + "max": { + "description": "The maximum bandwidth (KiB/s) measurement", + "type": "string (integer)" + }, + "mean": { + "description": "The mean bandwidth (KiB/s) measurement", + "type": "string (float)" + }, + "min": { + "description": "The minimum bandwidth (KiB/s) measurement", + "type": "string (integer)" + }, + "numsamples": { + "description": "The number of samples taken during the test", + "type": "string (integer)" + }, + "stdev": { + "description": "The standard deviation of bandwidth", + "type": "string (float)" + } + }, + "type": "object" + }, + "cpu": { + "properties": { + "ctxsw": { + "description": "The number of context switches during the test", + "type": "string (integer)" + }, + "majfault": { + "description": "The number of major page faults during the test", + "type": "string (integer)" + }, + "minfault": { + "description": "The number of minor page faults during the test", + "type": "string (integer)" + }, + "system": { + "description": "The percentage of test time spent in system (kernel) space", + "type": "string (float percentage)" + }, + "user": { + "description": "The percentage of test time spent in user space", + "type": "string (float percentage)" + } + }, + "type": "object" + }, + "iops": { + "properties": { + "max": { + "description": "The maximum IOPS measurement", + "type": "string (integer)" + }, + "mean": { + "description": "The mean IOPS measurement", + "type": "string (float)" + }, + "min": { + "description": "The minimum IOPS measurement", + "type": "string (integer)" + }, + "numsamples": { + "description": "The number of samples taken during the test", + "type": "string (integer)" + }, + "stdev": { + "description": "The standard deviation of IOPS", + "type": "string (float)" + } + }, + "type": "object" + }, + "latency": { + "properties": { + "max": { + "description": "The maximum latency measurement", + "type": "string (integer)" + }, + "mean": { + "description": "The mean latency measurement", + "type": "string (float)" + }, + "min": { + "description": "The minimum latency measurement", + "type": "string (integer)" + }, + "stdev": { + "description": "The standard deviation of latency", + "type": "string (float)" + } + }, + "type": "object" + }, + "overall": { + "properties": { + "bandwidth": { + "description": "The average bandwidth (KiB/s)", + "type": "string (integer)" + }, + "iops": { + "description": "The average IOPS", + "type": "string (integer)" + }, + "iosize": { + "description": "The total size of the benchmark data", + "type": "string (integer)" + }, + "runtime": { + "description": "The total test time in milliseconds", + "type": "string (integer)" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "id": { + "description": "The database ID of the test result", + "type": "string (containing integer)" + }, + "job": { + "description": "The job name (an ISO date) of the test result", + "type": "string" + } + }, + "type": "object" + }, "system-template": { "properties": { "id": { @@ -2335,6 +2480,12 @@ "name": "start_vm", "required": false, "type": "boolean" + }, + { + "description": "Script install() function keywork argument in \"arg=data\" format; may be specified multiple times to add multiple arguments", + "in": "query", + "name": "arg", + "type": "string" } ], "responses": { @@ -4214,6 +4365,57 @@ ] } }, + "/api/v1/storage/ceph/benchmark": { + "get": { + "description": "", + "parameters": [ + { + "description": "A single job name to limit results to", + "in": "query", + "name": "job", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/storagebenchmark" + } + } + }, + "summary": "List results from benchmark jobs", + "tags": [ + "storage / ceph" + ] + }, + "post": { + "description": "", + "parameters": [ + { + "description": "The PVC storage pool to benchmark", + "in": "query", + "name": "pool", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "description": "The Celery job ID of the benchmark (unused elsewhere)", + "type": "string" + } + } + }, + "summary": "Execute a storage benchmark against a storage pool", + "tags": [ + "storage / ceph" + ] + } + }, "/api/v1/storage/ceph/option": { "post": { "description": "",