From 423ae450dbc9ea21acf951553809808d53bf3584 Mon Sep 17 00:00:00 2001 From: "Gupta, Sangeet (sg774j)" Date: Thu, 4 Jun 2020 17:12:49 +0000 Subject: [PATCH] Fix 404 when deleteing volume group In delete_group() method the group is deleted first and then the volume information is fetched which internally trys to find all the related groups. As group delete request was placed earlier than volume list and the group might be deleted before volume list try to find the group information, it returns 404. This is race condition based on group is finish its deletion before list volume requests or not. Better is to fetch the information of volumes first and then delete the group. And use that volume info later to cleanup the volume also if requested. Change-Id: I5b52ebac2f325bfeda51773c90cb40e7f7e02c67 Closes-Bug: #1882116 --- tempest/api/volume/base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py index bcbcf43a26..7af5927133 100644 --- a/tempest/api/volume/base.py +++ b/tempest/api/volume/base.py @@ -233,12 +233,15 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest, return group def delete_group(self, group_id, delete_volumes=True): - self.groups_client.delete_group(group_id, delete_volumes) + group_vols = [] if delete_volumes: vols = self.volumes_client.list_volumes(detail=True)['volumes'] for vol in vols: if vol['group_id'] == group_id: - self.volumes_client.wait_for_resource_deletion(vol['id']) + group_vols.append(vol['id']) + self.groups_client.delete_group(group_id, delete_volumes) + for vol in group_vols: + self.volumes_client.wait_for_resource_deletion(vol) self.groups_client.wait_for_resource_deletion(group_id)