]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: Nothing to clean up if the volume was not created 32459/head
authorJos Collin <jcollin@redhat.com>
Fri, 3 Jan 2020 06:38:35 +0000 (12:08 +0530)
committerJos Collin <jcollin@redhat.com>
Fri, 3 Jan 2020 10:25:56 +0000 (15:55 +0530)
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>
qa/tasks/cephfs/test_volumes.py

index c94747097ec19092b090e35b10c814a6039834b6..1247da956418ee7c12844e31d671adcd9a282544 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")