mon/OSDMonitor: osd set/unset sortbitwise

Add monitor command to flip the switch on the OSD hobject_t sort
order.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2015-08-07 16:14:09 -04:00
parent f02d7e7a75
commit 383185bfba
3 changed files with 13 additions and 4 deletions

View File

@ -967,7 +967,7 @@ function test_mon_osd()
ceph osd deep-scrub 0
ceph osd repair 0
for f in noup nodown noin noout noscrub nodeep-scrub nobackfill norebalance norecover notieragent full
for f in noup nodown noin noout noscrub nodeep-scrub nobackfill norebalance norecover notieragent full sortbitwise
do
ceph osd set $f
ceph osd unset $f

View File

@ -589,10 +589,10 @@ COMMAND("osd erasure-code-profile ls", \
"list all erasure code profiles", \
"osd", "r", "cli,rest")
COMMAND("osd set " \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent", \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent|sortbitwise", \
"set <key>", "osd", "rw", "cli,rest")
COMMAND("osd unset " \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent", \
"name=key,type=CephChoices,strings=full|pause|noup|nodown|noout|noin|nobackfill|norebalance|norecover|noscrub|nodeep-scrub|notieragent|sortbitwise", \
"unset <key>", "osd", "rw", "cli,rest")
COMMAND("osd cluster_snap", "take cluster snapshot (disabled)", \
"osd", "r", "")

View File

@ -5828,7 +5828,14 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
return prepare_set_flag(op, CEPH_OSDMAP_NODEEP_SCRUB);
else if (key == "notieragent")
return prepare_set_flag(op, CEPH_OSDMAP_NOTIERAGENT);
else {
else if (key == "sortbitwise") {
if (osdmap.get_up_osd_features() & CEPH_FEATURE_OSD_BITWISE_HOBJ_SORT) {
return prepare_set_flag(op, CEPH_OSDMAP_SORTBITWISE);
} else {
ss << "not all up OSDs have OSD_BITWISE_HOBJ_SORT feature";
err = -EPERM;
}
} else {
ss << "unrecognized flag '" << key << "'";
err = -EINVAL;
}
@ -5860,6 +5867,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
return prepare_unset_flag(op, CEPH_OSDMAP_NODEEP_SCRUB);
else if (key == "notieragent")
return prepare_unset_flag(op, CEPH_OSDMAP_NOTIERAGENT);
else if (key == "sortbitwise")
return prepare_unset_flag(op, CEPH_OSDMAP_SORTBITWISE);
else {
ss << "unrecognized flag '" << key << "'";
err = -EINVAL;