CLI for backup snapshots
This adds CLI support for backup snapshots. Server side change is here: https://review.openstack.org/#/c/243406/ Depends-on: Ib4ab9ca9dc72b30151154f3f96037f9ce3c9c540 Change-Id: I5b58d872c9b4842fae5f2e7a4ddfc6662a6c8d7a Implements: blueprint backup-snapshots
This commit is contained in:
parent
484c6e3a9c
commit
8fbbf7be94
@ -403,6 +403,10 @@ class ShellTest(utils.TestCase):
|
||||
self.run_command('backup-create 1234 --force')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_backup_snapshot(self):
|
||||
self.run_command('backup-create 1234 --snapshot-id 4321')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_restore(self):
|
||||
self.run_command('backup-restore 1234')
|
||||
self.assert_called('POST', '/backups/1234/restore')
|
||||
|
@ -42,6 +42,12 @@ class VolumeBackupsTest(utils.TestCase):
|
||||
None, None, False, True)
|
||||
cs.assert_called('POST', '/backups')
|
||||
|
||||
def test_create_snapshot(self):
|
||||
cs.backups.create('2b695faf-b963-40c8-8464-274008fbcef4',
|
||||
None, None, False, False,
|
||||
'3c706gbg-c074-51d9-9575-385119gcdfg5')
|
||||
cs.assert_called('POST', '/backups')
|
||||
|
||||
def test_get(self):
|
||||
backup_id = '76a17945-3c6f-435c-975b-b5685db10b62'
|
||||
cs.backups.get(backup_id)
|
||||
|
@ -1358,6 +1358,10 @@ def do_retype(cs, args):
|
||||
'of an "in-use" volume means your data is crash '
|
||||
'consistent. Default=False.',
|
||||
default=False)
|
||||
@utils.arg('--snapshot-id',
|
||||
metavar='<snapshot-id>',
|
||||
default=None,
|
||||
help='ID of snapshot to backup. Default=None.')
|
||||
@utils.service_type('volumev2')
|
||||
def do_backup_create(cs, args):
|
||||
"""Creates a volume backup."""
|
||||
@ -1373,7 +1377,8 @@ def do_backup_create(cs, args):
|
||||
args.name,
|
||||
args.description,
|
||||
args.incremental,
|
||||
args.force)
|
||||
args.force,
|
||||
args.snapshot_id)
|
||||
|
||||
info = {"volume_id": volume.id}
|
||||
info.update(backup._info)
|
||||
|
@ -39,7 +39,8 @@ class VolumeBackupManager(base.ManagerWithFind):
|
||||
|
||||
def create(self, volume_id, container=None,
|
||||
name=None, description=None,
|
||||
incremental=False, force=False):
|
||||
incremental=False, force=False,
|
||||
snapshot_id=None):
|
||||
"""Creates a volume backup.
|
||||
|
||||
:param volume_id: The ID of the volume to backup.
|
||||
@ -55,7 +56,8 @@ class VolumeBackupManager(base.ManagerWithFind):
|
||||
'name': name,
|
||||
'description': description,
|
||||
'incremental': incremental,
|
||||
'force': force, }}
|
||||
'force': force,
|
||||
'snapshot_id': snapshot_id, }}
|
||||
return self._create('/backups', body, 'backup')
|
||||
|
||||
def get(self, backup_id):
|
||||
|
Loading…
Reference in New Issue
Block a user