]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add `osd blacklist clear` 6945/head
authorJohn Spray <john.spray@redhat.com>
Tue, 15 Dec 2015 17:19:30 +0000 (17:19 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 16 Dec 2015 12:02:36 +0000 (12:02 +0000)
This is just like 'blacklist rm' except it removes
everything.  Useful if you've got a whole bunch of
things in your blacklist and you don't want to wait
for N "blacklist rm" commands to run.

Signed-off-by: John Spray <john.spray@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 5b6fbf25c7f88f287ba1196b2cc5d705d846847f..8152c6477252b781a14f97e20302846e746a41dc 100755 (executable)
@@ -1008,6 +1008,12 @@ function test_mon_osd()
   expect_false "ceph osd blacklist $bl/-1"
   expect_false "ceph osd blacklist $bl/foo"
 
+  # Test `clear`
+  ceph osd blacklist add $bl
+  ceph osd blacklist ls | grep $bl
+  ceph osd blacklist clear
+  expect_false "ceph osd blacklist ls | grep $bl"
+
   #
   # osd crush
   #
index 8d09f91fba040b1501270520cb89e04dfc53ac63..0a1122d98a5891bf2d343ae277fd553effaf8fd0 100644 (file)
@@ -456,6 +456,8 @@ COMMAND("osd lspools " \
        "name=auid,type=CephInt,req=false", \
        "list pools", "osd", "r", "cli,rest")
 COMMAND("osd blacklist ls", "show blacklisted clients", "osd", "r", "cli,rest")
+COMMAND("osd blacklist clear", "clear all blacklisted clients", "osd", "rw",
+        "cli,rest")
 COMMAND("osd crush rule list", "list crush rules", "osd", "r", "cli,rest")
 COMMAND("osd crush rule ls", "list crush rules", "osd", "r", "cli,rest")
 COMMAND("osd crush rule dump " \
index 3e7cd35a164bb46f5ae8e843fa9fe3099eeb8cf3..a5bee6a6402ffb61aeae8525def5773b38d73d77 100644 (file)
@@ -6551,6 +6551,18 @@ done:
                                              get_last_committed() + 1));
     return true;
 
+  } else if (prefix == "osd blacklist clear") {
+    pending_inc.new_blacklist.clear();
+    std::list<std::pair<entity_addr_t,utime_t > > blacklist;
+    osdmap.get_blacklist(&blacklist);
+    for (const auto &entry : blacklist) {
+      pending_inc.old_blacklist.push_back(entry.first);
+    }
+    ss << " removed all blacklist entries";
+    getline(ss, rs);
+    wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs,
+                                              get_last_committed() + 1));
+    return true;
   } else if (prefix == "osd blacklist") {
     string addrstr;
     cmd_getval(g_ceph_context, cmdmap, "addr", addrstr);