]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: ceph-objectstore-tool add remove --force with bad snapset test 30081/head
authorDavid Zafman <dzafman@redhat.com>
Tue, 27 Aug 2019 19:48:31 +0000 (19:48 +0000)
committerPrashant D <pdhange@redhat.com>
Mon, 2 Sep 2019 23:09:50 +0000 (19:09 -0400)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 87d80eb41774a95e6ff854e110233d36728b2817)

Conflicts:
qa/standalone/special/ceph_objectstore_tool.py : Resolved in test_removeall

qa/standalone/special/ceph_objectstore_tool.py

index 86ae5d9a013b120c28c290b62e4f31df1effd166..6da6d957ce9ded6c7cad209a08e4668e3c2ec706 100755 (executable)
@@ -604,6 +604,7 @@ def test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR, REP_N
     errors=0
     print("Test removeall")
     kill_daemons()
+    test_force_remove = 0
     for nspace in db.keys():
         for basename in db[nspace].keys():
             JSON = db[nspace][basename]['json']
@@ -619,6 +620,25 @@ def test_removeall(CFSD_PREFIX, db, OBJREPPGS, REP_POOL, CEPH_BIN, OSDDIR, REP_N
                     if int(basename.split(REP_NAME)[1]) <= int(NUM_CLONED_REP_OBJECTS):
                         cmd = (CFSD_PREFIX + "'{json}' remove").format(osd=osd, json=JSON)
                         errors += test_failure(cmd, "Snapshots are present, use removeall to delete everything")
+                        if not test_force_remove:
+
+                            cmd = (CFSD_PREFIX + " '{json}' set-attr snapset /dev/null").format(osd=osd, json=JSON)
+                            logging.debug(cmd)
+                            ret = call(cmd, shell=True, stdout=nullfd, stderr=nullfd)
+                            if ret != 0:
+                                logging.error("Test set-up to corrupt snapset failed for {json}".format(json=JSON))
+                                errors += 1
+                                # Do the removeall since this test failed to set-up
+                            else:
+                                test_force_remove = 1
+
+                                cmd = (CFSD_PREFIX + " '{json}' --force remove").format(osd=osd, json=JSON)
+                                logging.debug(cmd)
+                                ret = call(cmd, shell=True, stdout=nullfd, stderr=nullfd)
+                                if ret != 0:
+                                    logging.error("forced remove with corrupt snapset failed for {json}".format(json=JSON))
+                                    errors += 1
+                                continue
 
                     cmd = (CFSD_PREFIX + " --force --dry-run '{json}' remove").format(osd=osd, json=JSON)
                     logging.debug(cmd)