From 67e43f466826f121d7649da33954b5b6a5454101 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Fri, 3 Jan 2020 12:08:35 +0530 Subject: [PATCH] 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 --- qa/tasks/cephfs/test_volumes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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") -- 2.39.5