Merge "Revert "cinder backup force-delete when backup is error""

This commit is contained in:
Jenkins 2017-05-03 03:39:41 +00:00 committed by Gerrit Code Review
commit 6d95417bed
4 changed files with 5 additions and 29 deletions

View File

@ -1,9 +0,0 @@
---
features:
- |
As in the [doc]:
https://developer.openstack.org/api-ref/block-storage/v3/
#force-delete-a-backup.
* Force-deletes a backup(v2)

View File

@ -121,7 +121,7 @@ class VolumesBackupsAdminTest(base.BaseVolumeAdminTest):
'available') 'available')
@decorators.idempotent_id('47a35425-a891-4e13-961c-c45deea21e94') @decorators.idempotent_id('47a35425-a891-4e13-961c-c45deea21e94')
def test_volume_backup_reset_status_force_delete(self): def test_volume_backup_reset_status(self):
# Create a volume # Create a volume
volume = self.create_volume() volume = self.create_volume()
# Create a backup # Create a backup
@ -136,6 +136,3 @@ class VolumesBackupsAdminTest(base.BaseVolumeAdminTest):
status="error") status="error")
waiters.wait_for_volume_resource_status(self.admin_backups_client, waiters.wait_for_volume_resource_status(self.admin_backups_client,
backup['id'], 'error') backup['id'], 'error')
# Force delete a backup volume when backup is in error state.
self.admin_backups_client.force_delete_backup(backup['id'])
self.admin_backups_client.wait_for_resource_deletion(backup['id'])

View File

@ -144,8 +144,7 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
snapshot['id'], 'available') snapshot['id'], 'available')
return snapshot return snapshot
def create_backup(self, volume_id, backup_client=None, def create_backup(self, volume_id, backup_client=None, **kwargs):
wait_until="available", **kwargs):
"""Wrapper utility that returns a test backup.""" """Wrapper utility that returns a test backup."""
if backup_client is None: if backup_client is None:
backup_client = self.backups_client backup_client = self.backups_client
@ -155,12 +154,9 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
backup = backup_client.create_backup( backup = backup_client.create_backup(
volume_id=volume_id, **kwargs)['backup'] volume_id=volume_id, **kwargs)['backup']
self.addCleanup(backup_client.delete_backup, backup['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc, waiters.wait_for_volume_resource_status(backup_client, backup['id'],
backup_client.delete_backup, backup['id']) 'available')
waiters.wait_for_volume_resource_status(backup_client,
backup['id'],
wait_until)
return backup return backup
# NOTE(afazekas): these create_* and clean_* could be defined # NOTE(afazekas): these create_* and clean_* could be defined

View File

@ -55,14 +55,6 @@ class BackupsClient(rest_client.RestClient):
self.expected_success(202, resp.status) self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body) return rest_client.ResponseBody(resp, body)
def force_delete_backup(self, backup_id):
"""Force delete a backup volume."""
post_body = json.dumps({'os-force_delete': {}})
url = 'backups/%s/action' % backup_id
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp)
def show_backup(self, backup_id): def show_backup(self, backup_id):
"""Returns the details of a single backup.""" """Returns the details of a single backup."""
url = "backups/%s" % backup_id url = "backups/%s" % backup_id