From: Jos Collin Date: Fri, 3 Jan 2020 06:38:35 +0000 (+0530) Subject: qa/tasks: Nothing to clean up if the volume was not created X-Git-Tag: v15.1.0~297^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=67e43f466826f121d7649da33954b5b6a5454101;p=ceph.git qa/tasks: Nothing to clean up if the volume was not created 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 --- diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index c94747097ec19..1247da956418e 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -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")