Add support for replacing/refreshing OSDs

Adds commands to both replace an OSD disk, and refresh (reimport) an
existing OSD disk on a new node. This handles the cases where an OSD
disk should be replaced (either due to upgrades or failures) or where a
node is rebuilt in-place and an existing OSD must be re-imported to it.

This should avoid the need to do a full remove/add sequence for either
case.

Also cleans up some aspects of OSD removal that are identical between
methods (e.g. using safe-to-destroy and sleeping after stopping) and
fixes a bug if an OSD does not truly exist when the daemon starts up.
This commit is contained in:
2022-05-06 15:31:58 -04:00
parent 8027a6efdc
commit 7a40c7a55b
7 changed files with 853 additions and 37 deletions

View File

@ -5094,6 +5094,13 @@
"delete": {
"description": "Note: This task may take up to 30s to complete and return<br/>Warning: This operation may have unintended consequences for the storage cluster; ensure the cluster can support removing the OSD before proceeding",
"parameters": [
{
"description": "Force removal even if some step(s) fail",
"in": "query",
"name": "force",
"required": "flase",
"type": "boolean"
},
{
"description": "A confirmation string to ensure that the API consumer really means it",
"in": "query",
@ -5141,6 +5148,73 @@
"tags": [
"storage / ceph"
]
},
"post": {
"description": "Note: This task may take up to 30s to complete and return",
"parameters": [
{
"description": "The block device (e.g. \"/dev/sdb\", \"/dev/disk/by-path/...\", etc.) or detect string (\"detect:NAME:SIZE:ID\") to replace the OSD onto",
"in": "query",
"name": "device",
"required": true,
"type": "string"
},
{
"description": "The Ceph CRUSH weight for the replaced OSD",
"in": "query",
"name": "weight",
"required": true,
"type": "number"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Message"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/Message"
}
}
},
"summary": "Replace a Ceph OSD in the cluster",
"tags": [
"storage / ceph"
]
},
"put": {
"description": "Note: This task may take up to 30s to complete and return",
"parameters": [
{
"description": "The block device (e.g. \"/dev/sdb\", \"/dev/disk/by-path/...\", etc.) or detect string (\"detect:NAME:SIZE:ID\") that the OSD should be using",
"in": "query",
"name": "device",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Message"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/Message"
}
}
},
"summary": "Refresh (reimport) a Ceph OSD in the cluster",
"tags": [
"storage / ceph"
]
}
},
"/api/v1/storage/ceph/osd/{osdid}/state": {