]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tasks/cephfs: use "blacklist clear"
authorJohn Spray <john.spray@redhat.com>
Wed, 22 Jun 2016 12:01:20 +0000 (13:01 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 30 Jun 2016 22:44:20 +0000 (23:44 +0100)
... instead of iterating over all blacklist entries.  Fall
back to the old way if the new way doesn't work (i.e. on
old ceph)

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/cephfs_test_case.py

index 29855d90d5a70d533edb2094a52d98f27b667aea..73499da7ba99cdaa6cd785babe827b3b0abf709c 100644 (file)
@@ -127,10 +127,15 @@ class CephFSTestCase(unittest.TestCase):
 
         # In case anything is in the OSD blacklist list, clear it out.  This is to avoid
         # the OSD map changing in the background (due to blacklist expiry) while tests run.
-        blacklist = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd", "dump", "--format=json-pretty"))['blacklist']
-        log.info("Removing {0} blacklist entries".format(len(blacklist)))
-        for addr, blacklisted_at in blacklist.items():
-            self.fs.mon_manager.raw_cluster_cmd("osd", "blacklist", "rm", addr)
+        try:
+            self.fs.mon_manager.raw_cluster_cmd("osd", "blacklist", "clear")
+        except CommandFailedError:
+            # Fallback for older Ceph cluster
+            blacklist = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd",
+                                  "dump", "--format=json-pretty"))['blacklist']
+            log.info("Removing {0} blacklist entries".format(len(blacklist)))
+            for addr, blacklisted_at in blacklist.items():
+                self.fs.mon_manager.raw_cluster_cmd("osd", "blacklist", "rm", addr)
 
         # In case some test messed with auth caps, reset them
         client_mount_ids = [m.client_id for m in self.mounts]