Merge "Fixes broken v1 and v2 api backup-restore"
This commit is contained in:
commit
aa0583eaf4
cinderclient
@ -533,6 +533,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {},
|
||||
{'restore': _stub_restore()})
|
||||
|
||||
def post_backups_1234_restore(self, **kw):
|
||||
return (200, {},
|
||||
{'restore': _stub_restore()})
|
||||
|
||||
#
|
||||
# QoSSpecs
|
||||
#
|
||||
|
@ -117,6 +117,14 @@ class ShellTest(utils.TestCase):
|
||||
self.run_command('delete 1234')
|
||||
self.assert_called('DELETE', '/volumes/1234')
|
||||
|
||||
def test_backup(self):
|
||||
self.run_command('backup-create 1234')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_restore(self):
|
||||
self.run_command('backup-restore 1234')
|
||||
self.assert_called('POST', '/backups/1234/restore')
|
||||
|
||||
def test_snapshot_list_filter_volume_id(self):
|
||||
self.run_command('snapshot-list --volume-id=1234')
|
||||
self.assert_called('GET', '/snapshots/detail?volume_id=1234')
|
||||
|
@ -540,6 +540,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {},
|
||||
{'restore': _stub_restore()})
|
||||
|
||||
def post_backups_1234_restore(self, **kw):
|
||||
return (200, {},
|
||||
{'restore': _stub_restore()})
|
||||
|
||||
#
|
||||
# QoSSpecs
|
||||
#
|
||||
|
@ -95,6 +95,14 @@ class ShellTest(utils.TestCase):
|
||||
self.run_command('delete 1234')
|
||||
self.assert_called('DELETE', '/volumes/1234')
|
||||
|
||||
def test_backup(self):
|
||||
self.run_command('backup-create 1234')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_restore(self):
|
||||
self.run_command('backup-restore 1234')
|
||||
self.assert_called('POST', '/backups/1234/restore')
|
||||
|
||||
def test_snapshot_list_filter_volume_id(self):
|
||||
self.run_command('snapshot-list --volume-id=1234')
|
||||
self.assert_called('GET', '/snapshots/detail?volume_id=1234')
|
||||
|
@ -840,8 +840,8 @@ def do_backup_delete(cs, args):
|
||||
@utils.service_type('volume')
|
||||
def do_backup_restore(cs, args):
|
||||
"""Restore a backup."""
|
||||
if args.volume:
|
||||
volume_id = utils.find_volume(cs, args.volume).id
|
||||
if args.volume_id:
|
||||
volume_id = utils.find_volume(cs, args.volume_id).id
|
||||
else:
|
||||
volume_id = None
|
||||
cs.restores.restore(args.backup, volume_id)
|
||||
|
@ -931,8 +931,8 @@ def do_backup_delete(cs, args):
|
||||
@utils.service_type('volumev2')
|
||||
def do_backup_restore(cs, args):
|
||||
"""Restore a backup."""
|
||||
if args.volume:
|
||||
volume_id = utils.find_volume(cs, args.volume).id
|
||||
if args.volume_id:
|
||||
volume_id = utils.find_volume(cs, args.volume_id).id
|
||||
else:
|
||||
volume_id = None
|
||||
cs.restores.restore(args.backup, volume_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user