Merge "Remove a redundant wait_for_backup_deletion()"

This commit is contained in:
Jenkins 2016-08-04 18:24:27 +00:00 committed by Gerrit Code Review
commit 1a8c2d4aa5
2 changed files with 7 additions and 12 deletions

View File

@ -43,7 +43,7 @@ class VolumesBackupsAdminV2Test(base.BaseVolumeAdminTest):
def _delete_backup(self, backup_id): def _delete_backup(self, backup_id):
self.admin_backups_client.delete_backup(backup_id) self.admin_backups_client.delete_backup(backup_id)
self.admin_backups_client.wait_for_backup_deletion(backup_id) self.admin_backups_client.wait_for_resource_deletion(backup_id)
def _decode_url(self, backup_url): def _decode_url(self, backup_url):
return json.loads(base64.decodestring(backup_url)) return json.loads(base64.decodestring(backup_url))

View File

@ -116,14 +116,9 @@ class BaseBackupsClient(rest_client.RestClient):
self.build_timeout)) self.build_timeout))
raise exceptions.TimeoutException(message) raise exceptions.TimeoutException(message)
def wait_for_backup_deletion(self, backup_id): def is_resource_deleted(self, id):
"""Waits for backup deletion""" try:
start_time = int(time.time()) self.show_backup(id)
while True: except lib_exc.NotFound:
try: return True
self.show_backup(backup_id) return False
except lib_exc.NotFound:
return
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException
time.sleep(self.build_interval)