From 14e2a4e421cc81fe278351d55c85b4f4ac953fc1 Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Fri, 24 Jul 2020 09:35:38 +0000 Subject: [PATCH] Fix KeyError exc in volumes_client is_resource_deleted method of v3 volumes_client was wrongly accessing id value of a volume causing KeyError - in case the being deleted volume was in error_deleting state. Closes-Bug: #1887980 Change-Id: I6cea9917c248ceaa8b7cd60d0a20a2bf7540d9b9 --- ...rror-bug-in-v3-volumes_client-ff5d9b894f2257c8.yaml | 10 ++++++++++ tempest/lib/services/volume/v3/volumes_client.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/Fix-KeyError-bug-in-v3-volumes_client-ff5d9b894f2257c8.yaml diff --git a/releasenotes/notes/Fix-KeyError-bug-in-v3-volumes_client-ff5d9b894f2257c8.yaml b/releasenotes/notes/Fix-KeyError-bug-in-v3-volumes_client-ff5d9b894f2257c8.yaml new file mode 100644 index 0000000000..bbb1901cee --- /dev/null +++ b/releasenotes/notes/Fix-KeyError-bug-in-v3-volumes_client-ff5d9b894f2257c8.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + is_resource_deleted method of v3 volumes_client might have returned + a KeyError exception due to an incorrect accessing of a volume id + in the case the volume was in error_deleting state. + incorrect code - volume['id'] + correct code - volume['volume']['id'] + More details about the issue can be found at + https://bugs.launchpad.net/tempest/+bug/1887980 diff --git a/tempest/lib/services/volume/v3/volumes_client.py b/tempest/lib/services/volume/v3/volumes_client.py index 4fb6d2ee56..9c6729b2cb 100644 --- a/tempest/lib/services/volume/v3/volumes_client.py +++ b/tempest/lib/services/volume/v3/volumes_client.py @@ -219,7 +219,7 @@ class VolumesClient(base_client.BaseClient): if volume["volume"]["status"] == "error_deleting": raise lib_exc.DeleteErrorException( "Volume %s failed to delete and is in error_deleting status" % - volume['id']) + volume['volume']['id']) return False @property