Do the same thing that we do with 'osd destroy'.
Signed-off-by: Sage Weil <sage@redhat.com>
return true;
}
} else if (prefix == "osd safe-to-destroy" ||
- prefix == "osd destroy") {
+ prefix == "osd destroy" ||
+ prefix == "osd purge") {
set<int> osds;
int r = 0;
if (prefix == "osd safe-to-destroy") {
r = -EBUSY;
}
- if (r && prefix == "osd destroy") {
+ if (r && (prefix == "osd destroy" ||
+ prefix == "osd purge")) {
string sure;
if (!cmd_getval(cct, cmdctx->cmdmap, "sure", sure) ||
sure != "--force") {
- ss << "\nYou can proceed with OSD removal by passing --force, but be warned that this will likely mean real, permanent data loss.";
+ ss << "\nYou can proceed by passing --force, but be warned that this will likely mean real, permanent data loss.";
} else {
r = 0;
}
cmdctx->reply(r, ss);
return true;
}
- if (prefix == "osd destroy") {
+ if (prefix == "osd destroy" ||
+ prefix == "osd purge") {
const string cmd =
"{"
- "\"prefix\": \"osd destroy-actual\", "
+ "\"prefix\": \"" + prefix + "-actual\", "
"\"id\": " + stringify(osds) + ", "
"\"sure\": \"--yes-i-really-mean-it\""
"}";
"but removes cephx keys, config-key data and lockbox keys, "\
"rendering data permanently unreadable.", \
"osd", "rw", "cli,rest")
+COMMAND("osd purge " \
+ "name=id,type=CephOsdName " \
+ "name=sure,type=CephString,req=false", \
+ "purge all osd data from the monitors including the OSD id " \
+ "and CRUSH position", \
+ "osd", "rw", "cli,rest")
COMMAND("osd safe-to-destroy name=ids,type=CephString,n=N",
"check whether osd(s) can be safely destroyed without reducing data durability",
"purge all traces of an OSD that was partially created but never " \
"started", \
"osd", "rw", "cli,rest")
-COMMAND("osd purge " \
+COMMAND_WITH_FLAG("osd purge-actual " \
"name=id,type=CephOsdName " \
"name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
"purge all osd data from the monitors. Combines `osd destroy`, " \
"`osd rm`, and `osd crush rm`.", \
- "osd", "rw", "cli,rest")
+ "osd", "rw", "cli,rest", FLAG(HIDDEN))
COMMAND("osd lost " \
"name=id,type=CephOsdName " \
"name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
}
} else if (prefix == "osd destroy-actual" ||
- prefix == "osd purge" ||
+ prefix == "osd purge-actual" ||
prefix == "osd purge-new") {
/* Destroying an OSD means that we don't expect to further make use of
* the OSDs data (which may even become unreadable after this operation),
bool is_destroy = (prefix == "osd destroy-actual");
if (!is_destroy) {
- assert("osd purge" == prefix ||
+ assert("osd purge-actual" == prefix ||
"osd purge-new" == prefix);
}