Add documentation of OSD endpoints and proper return

This commit is contained in:
Joshua Boniface 2020-01-06 12:54:18 -05:00
parent 27279c9686
commit 1122589b88
2 changed files with 296 additions and 5 deletions

View File

@ -2455,9 +2455,90 @@ class API_Storage_Ceph_OSD_Root(Resource):
@Authenticator @Authenticator
def get(self, reqargs): def get(self, reqargs):
""" """
TODO Return a list of Ceph OSDs in the cluster
---
tags:
- storage / ceph
definitions:
- schema:
type: object
id: osd
properties:
id:
type: string (containing integer)
description: The Ceph ID of the OSD
stats:
type: object
properties:
uuid:
type: string
description: The Ceph OSD UUID
up:
type: boolean integer
description: Whether OSD is in "up" state
in:
type: boolean integer
description: Whether OSD is in "in" state
primary_affinity:
type: integer
description: The Ceph primary affinity of the OSD
utilization:
type: number
description: The utilization percentage of the OSD
var:
type: number
description: The usage variability among OSDs
pgs:
type: integer
description: The number of placement groups on this OSD
kb:
type: integer
description: Size of the OSD in KB
weight:
type: number
description: The weight of the OSD in the CRUSH map
reweight:
type: number
description: The active cluster weight of the OSD
node:
type: string
description: The PVC node the OSD resides on
used:
type: string
description: The used space on the OSD in human-readable format
avail:
type: string
description: The free space on the OSD in human-readable format
wr_ops:
type: integer
description: Cluster-lifetime write operations to OSD
rd_ops:
type: integer
description: Cluster-lifetime read operations from OSD
wr_data:
type: integer
description: Cluster-lifetime write size to OSD
rd_data:
type: integer
description: Cluster-lifetime read size from OSD
state:
type: string
description: CSV of the current state of the OSD
parameters:
- in: query
name: limit
type: string
required: false
description: A OSD ID search limit; fuzzy by default, use ^/$ to force exact matches
responses:
200:
description: OK
schema:
type: array
items:
$ref: '#/definitions/osd'
""" """
api_helper.ceph_osd_list( return api_helper.ceph_osd_list(
reqargs.get('limit', None) reqargs.get('limit', None)
) )
@ -2514,7 +2595,15 @@ class API_Storage_Ceph_OSD_Element(Resource):
@Authenticator @Authenticator
def get(self, osdid): def get(self, osdid):
""" """
TODO Return information about Ceph OSD {osdid}
---
tags:
- storage / ceph
responses:
200:
description: OK
schema:
$ref: '#/definitions/osd'
""" """
return api_helper.ceph_osd_list( return api_helper.ceph_osd_list(
osdid osdid
@ -2565,7 +2654,19 @@ class API_Storage_Ceph_OSD_State(Resource):
@Authenticator @Authenticator
def get(self, osdid): def get(self, osdid):
""" """
TODO Return the current state of OSD {osdid}
---
tags:
- storage / ceph
responses:
200:
description: OK
schema:
type: object
properties:
state:
type: string
description: The current OSD state
""" """
return api_helper.ceph_osd_state( return api_helper.ceph_osd_state(
osdid osdid
@ -2577,7 +2678,22 @@ class API_Storage_Ceph_OSD_State(Resource):
@Authenticator @Authenticator
def post(self, osdid, reqargs): def post(self, osdid, reqargs):
""" """
TODO Set the current state of OSD {osdid}
---
tags:
- storage / ceph
parameters:
- in: query
name: state
type: string
required: true
description: Set the OSD to this state
responses:
200:
description: OK
schema:
type: object
id: Message
""" """
if reqargs.get('state', None) == 'in': if reqargs.get('state', None) == 'in':
return api_helper.ceph_osd_in( return api_helper.ceph_osd_in(

View File

@ -468,6 +468,92 @@
}, },
"type": "object" "type": "object"
}, },
"osd": {
"properties": {
"id": {
"description": "The Ceph ID of the OSD",
"type": "string (containing integer)"
},
"stats": {
"properties": {
"avail": {
"description": "The free space on the OSD in human-readable format",
"type": "string"
},
"in": {
"description": "Whether OSD is in \"in\" state",
"type": "boolean integer"
},
"kb": {
"description": "Size of the OSD in KB",
"type": "integer"
},
"node": {
"description": "The PVC node the OSD resides on",
"type": "string"
},
"pgs": {
"description": "The number of placement groups on this OSD",
"type": "integer"
},
"primary_affinity": {
"description": "The Ceph primary affinity of the OSD",
"type": "integer"
},
"rd_data": {
"description": "Cluster-lifetime read size from OSD",
"type": "integer"
},
"rd_ops": {
"description": "Cluster-lifetime read operations from OSD",
"type": "integer"
},
"reweight": {
"description": "The active cluster weight of the OSD",
"type": "number"
},
"state": {
"description": "CSV of the current state of the OSD",
"type": "string"
},
"up": {
"description": "Whether OSD is in \"up\" state",
"type": "boolean integer"
},
"used": {
"description": "The used space on the OSD in human-readable format",
"type": "string"
},
"utilization": {
"description": "The utilization percentage of the OSD",
"type": "number"
},
"uuid": {
"description": "The Ceph OSD UUID",
"type": "string"
},
"var": {
"description": "The usage variability among OSDs",
"type": "number"
},
"weight": {
"description": "The weight of the OSD in the CRUSH map",
"type": "number"
},
"wr_data": {
"description": "Cluster-lifetime write size to OSD",
"type": "integer"
},
"wr_ops": {
"description": "Cluster-lifetime write operations to OSD",
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
},
"pool": { "pool": {
"properties": { "properties": {
"name": { "name": {
@ -3599,6 +3685,33 @@
} }
}, },
"/api/v1/storage/ceph/osd": { "/api/v1/storage/ceph/osd": {
"get": {
"description": "",
"parameters": [
{
"description": "A OSD ID search limit; fuzzy by default, use ^/$ to force exact matches",
"in": "query",
"name": "limit",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"items": {
"$ref": "#/definitions/osd"
},
"type": "array"
}
}
},
"summary": "Return a list of Ceph OSDs in the cluster",
"tags": [
"storage / ceph"
]
},
"post": { "post": {
"description": "Note: This task may take up to 30s to complete and return", "description": "Note: This task may take up to 30s to complete and return",
"parameters": [ "parameters": [
@ -3680,6 +3793,68 @@
"tags": [ "tags": [
"storage / ceph" "storage / ceph"
] ]
},
"get": {
"description": "",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/osd"
}
}
},
"summary": "Return information about Ceph OSD {osdid}",
"tags": [
"storage / ceph"
]
}
},
"/api/v1/storage/ceph/osd/{osdid}/state": {
"get": {
"description": "",
"responses": {
"200": {
"description": "OK",
"schema": {
"properties": {
"state": {
"description": "The current OSD state",
"type": "string"
}
},
"type": "object"
}
}
},
"summary": "Return the current state of OSD {osdid}",
"tags": [
"storage / ceph"
]
},
"post": {
"description": "",
"parameters": [
{
"description": "Set the OSD to this state",
"in": "query",
"name": "state",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Message"
}
}
},
"summary": "Set the current state of OSD {osdid}",
"tags": [
"storage / ceph"
]
} }
}, },
"/api/v1/storage/ceph/pool": { "/api/v1/storage/ceph/pool": {