summaryrefslogtreecommitdiff
path: root/tempest/scenario
diff options
context:
space:
mode:
authorSofia Enriquez <lsofia.enriquez@gmail.com>2022-05-26 19:33:47 +0000
committerSofia Enriquez <lsofia.enriquez@gmail.com>2022-05-26 21:04:11 +0000
commit404b55cd2f07327ab2acc58295ed2fcd222e3bc2 (patch)
tree050180a97517dc978cf51b0b28728dfbf6bf069a /tempest/scenario
parent569c7a89f54c94494fde46ce2aa4fbd26492e640 (diff)
downloadtempest-404b55cd2f07327ab2acc58295ed2fcd222e3bc2.tar.gz
Add verification when restoring backups
If you want to restore a backup, specifying only the backup ID, you will get a new volume. However, if you pass the volume_id argument, you are targeting the restore of an existing volume. The problem I am having is that restore_backup() adds a second call to addCleanup to an existing volume and this results in a 400 HTTP error. To fix this problem, I add a simple check when we want to use an existing volume without calling cleanup. Change-Id: I521f69091cdad60edfe4ed85368df5decc0a7f55
Diffstat (limited to 'tempest/scenario')
-rw-r--r--tempest/scenario/manager.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index db2848733..ce45ff654 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -419,8 +419,12 @@ class ScenarioTest(tempest.test.BaseTestCase):
body = self.backups_client.restore_backup(backup_id, **kwargs)
restore = body['restore']
- self.addCleanup(self.volumes_client.delete_volume,
- restore['volume_id'])
+
+ using_pre_existing_volume = kwargs.get('volume_id', False)
+ if not using_pre_existing_volume:
+ self.addCleanup(self.volumes_client.delete_volume,
+ restore['volume_id'])
+
waiters.wait_for_volume_resource_status(self.backups_client,
backup_id, 'available')
waiters.wait_for_volume_resource_status(self.volumes_client,