Skip to content

Commit

Permalink
qa/tasks: Nothing to clean up if the volume was not created
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
joscollin committed Jan 3, 2020
1 parent ffda5f6 commit 67e43f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qa/tasks/cephfs/test_volumes.py
Expand Up @@ -129,10 +129,10 @@ def test_volume_create(self):
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")

Expand Down

0 comments on commit 67e43f4

Please sign in to comment.