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
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index db28487..ce45ff6 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -419,8 +419,12 @@
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,