mirror of
https://github.com/ceph/ceph
synced 2025-02-24 03:27:10 +00:00
mon: drop weird/failed mon features debug cli
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
This commit is contained in:
parent
64eae76fbe
commit
545bc83568
@ -441,22 +441,6 @@ COMMAND("mon remove " \
|
||||
COMMAND("mon rm " \
|
||||
"name=name,type=CephString", \
|
||||
"remove monitor named <name>", "mon", "rw", "cli,rest")
|
||||
COMMAND("mon debug set_feature" \
|
||||
"name=feature_type,type=CephChoices,strings=persistent|optional " \
|
||||
"name=feature_name,type=CephString " \
|
||||
"name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
|
||||
"set provided feature on mon map", \
|
||||
"mon", "rw", "cli")
|
||||
COMMAND("mon debug list_features " \
|
||||
"name=feature_type,type=CephString,req=false", \
|
||||
"list available mon map features to be set/unset", \
|
||||
"mon", "rw", "cli")
|
||||
COMMAND("mon debug unset_feature " \
|
||||
"name=feature_type,type=CephChoices,strings=persistent|optional " \
|
||||
"name=feature_name,type=CephString " \
|
||||
"name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
|
||||
"unset provided feature from monmap", \
|
||||
"mon", "rw", "cli")
|
||||
|
||||
/*
|
||||
* OSD commands
|
||||
|
@ -331,123 +331,6 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format,
|
||||
if (f) {
|
||||
f->flush(ss);
|
||||
}
|
||||
} else if (boost::starts_with(command, "debug mon features")) {
|
||||
|
||||
// check if unsupported feature is set
|
||||
if (!cct->check_experimental_feature_enabled("mon_debug_features_commands")) {
|
||||
ss << "error: this is an experimental feature and is not enabled.";
|
||||
goto abort;
|
||||
}
|
||||
|
||||
if (command == "debug mon features list") {
|
||||
|
||||
mon_feature_t supported = ceph::features::mon::get_supported();
|
||||
mon_feature_t persistent = ceph::features::mon::get_persistent();
|
||||
|
||||
if (f) {
|
||||
|
||||
f->open_object_section("features");
|
||||
f->open_object_section("ceph-mon");
|
||||
supported.dump_with_value(f.get(), "supported");
|
||||
persistent.dump_with_value(f.get(), "persistent");
|
||||
f->close_section(); // ceph-mon
|
||||
f->open_object_section("monmap");
|
||||
monmap->persistent_features.dump_with_value(f.get(), "persistent");
|
||||
monmap->optional_features.dump_with_value(f.get(), "optional");
|
||||
mon_feature_t required = monmap->get_required_features();
|
||||
required.dump_with_value(f.get(), "required");
|
||||
f->close_section(); // monmap
|
||||
f->close_section(); // features
|
||||
|
||||
f->flush(ss);
|
||||
} else {
|
||||
ss << "only structured formats allowed when listing";
|
||||
}
|
||||
} else if (command == "debug mon features set" ||
|
||||
command == "debug mon features set_val" ||
|
||||
command == "debug mon features unset" ||
|
||||
command == "debug mon features unset_val") {
|
||||
|
||||
string n;
|
||||
if (!cmd_getval(cct, cmdmap, "feature", n)) {
|
||||
ss << "missing feature to set";
|
||||
goto abort;
|
||||
}
|
||||
|
||||
string f_type;
|
||||
bool do_persistent = false, do_optional = false;
|
||||
|
||||
if (cmd_getval(cct, cmdmap, "feature_type", f_type)) {
|
||||
if (f_type == "--persistent") {
|
||||
do_persistent = true;
|
||||
} else {
|
||||
do_optional = true;
|
||||
}
|
||||
}
|
||||
|
||||
mon_feature_t feature;
|
||||
|
||||
if (command == "debug mon features set" ||
|
||||
command == "debug mon features unset") {
|
||||
feature = ceph::features::mon::get_feature_by_name(n);
|
||||
if (feature == ceph::features::mon::FEATURE_NONE) {
|
||||
ss << "no such feature '" << n << "'";
|
||||
goto abort;
|
||||
}
|
||||
} else {
|
||||
uint64_t feature_val;
|
||||
string interr;
|
||||
feature_val = strict_strtoll(n.c_str(), 10, &interr);
|
||||
if (!interr.empty()) {
|
||||
ss << "unable to parse feature value: " << interr;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
feature = mon_feature_t(feature_val);
|
||||
}
|
||||
|
||||
bool do_unset = false;
|
||||
if (boost::ends_with(command, "unset") ||
|
||||
boost::ends_with(command, "unset_val")) {
|
||||
do_unset = true;
|
||||
}
|
||||
|
||||
ss << (do_unset? "un" : "") << "setting feature '";
|
||||
feature.print_with_value(ss);
|
||||
ss << "' on current monmap\n";
|
||||
ss << "please note this change is not persistent; "
|
||||
<< "changes to monmap will overwrite the changes\n";
|
||||
|
||||
if (!do_persistent && !do_optional) {
|
||||
if (ceph::features::mon::get_persistent().contains_all(feature)) {
|
||||
do_persistent = true;
|
||||
} else {
|
||||
do_optional = true;
|
||||
}
|
||||
}
|
||||
|
||||
ss << "\n" << (do_unset ? "un" : "") << "setting ";
|
||||
|
||||
mon_feature_t &target_feature = (do_persistent ?
|
||||
monmap->persistent_features : monmap->optional_features);
|
||||
|
||||
if (do_persistent) {
|
||||
ss << "persistent feature";
|
||||
} else {
|
||||
ss << "optional feature";
|
||||
}
|
||||
|
||||
if (do_unset) {
|
||||
target_feature.unset_feature(feature);
|
||||
} else {
|
||||
target_feature.set_feature(feature);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ss << "unrecognized command";
|
||||
}
|
||||
|
||||
} else {
|
||||
assert(0 == "bad AdminSocket command binding");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user