]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: Nothing to clean up if the volume was not created
authorJos Collin <jcollin@redhat.com>
Fri, 3 Jan 2020 06:38:35 +0000 (12:08 +0530)
committerRamana Raja <rraja@redhat.com>
Wed, 12 Feb 2020 10:11:59 +0000 (05:11 -0500)
There are only 2 cases which needs cleanup:
1. The volume is successfully created
2. The volume is successfully created but create_mds fails

In either case, we could do a 'volume rm'.

Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit 67e43f466826f121d7649da33954b5b6a5454101)

qa/tasks/cephfs/test_volumes.py

index ed053ada2c16e72be82f12982123dc0fea50e6eb..1a926b5db34c1909ad348f8f8b095b0b06392e4f 100644 (file)
@@ -129,10 +129,10 @@ class TestVolumes(CephFSTestCase):
         volname = self._generate_random_volume_name()
         self._fs_cmd("volume", "create", volname)
         volumels = json.loads(self._fs_cmd("volume", "ls"))
-        try:
-            if (not (volname in ([volume['name'] for volume in volumels]))):
-                raise RuntimeError("Error creating volume '{0}'".format(volname))
-        finally:
+
+        if not (volname in ([volume['name'] for volume in volumels])):
+            raise RuntimeError("Error creating volume '{0}'".format(volname))
+        else:
             # clean up
             self._fs_cmd("volume", "rm", volname, "--yes-i-really-mean-it")