From 383185bfbae74797cdb44f50b4bf651422800ff1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 7 Aug 2015 16:14:09 -0400 Subject: [PATCH] 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 --- qa/workunits/cephtool/test.sh | 2 +- src/mon/MonCommands.h | 4 ++-- src/mon/OSDMonitor.cc | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index f84031aa44f..86d72aead6b 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -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 diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index e4da778cbd3..72416c13a2e 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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 ", "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 ", "osd", "rw", "cli,rest") COMMAND("osd cluster_snap", "take cluster snapshot (disabled)", \ "osd", "r", "") diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 16b3e4e3346..1a97bb88f35 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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;