Remove a redundant wait_for_backup_deletion()

The rest_client module has a basic function wait_for_resource_deletion()
and it is enough to implement a small function is_resource_deleted()
in each service client for the same function.
This patch removes the wait_for_backup_deletion() and implement the
is_resource_deleted() for the code cleanup.

Partially implements blueprint consistent-service-method-names

Change-Id: I7c07f1cdde86be850f50825db01eb35c62497820
This commit is contained in:
Ken'ichi Ohmichi 2016-08-03 14:35:46 -07:00
parent 563363b00a
commit 153b3d9207
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):
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):
return json.loads(base64.decodestring(backup_url))

View File

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