Merge "Add support to incremental backups in cinder"
This commit is contained in:
@@ -347,6 +347,10 @@ class ShellTest(utils.TestCase):
|
||||
self.run_command('backup-create 1234')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_backup_incremental(self):
|
||||
self.run_command('backup-create 1234 --incremental')
|
||||
self.assert_called('POST', '/backups')
|
||||
|
||||
def test_restore(self):
|
||||
self.run_command('backup-restore 1234')
|
||||
self.assert_called('POST', '/backups/1234/restore')
|
||||
|
@@ -26,6 +26,16 @@ class VolumeBackupsTest(utils.TestCase):
|
||||
cs.backups.create('2b695faf-b963-40c8-8464-274008fbcef4')
|
||||
cs.assert_called('POST', '/backups')
|
||||
|
||||
def test_create_full(self):
|
||||
cs.backups.create('2b695faf-b963-40c8-8464-274008fbcef4',
|
||||
None, None, False)
|
||||
cs.assert_called('POST', '/backups')
|
||||
|
||||
def test_create_incremental(self):
|
||||
cs.backups.create('2b695faf-b963-40c8-8464-274008fbcef4',
|
||||
None, None, True)
|
||||
cs.assert_called('POST', '/backups')
|
||||
|
||||
def test_get(self):
|
||||
backup_id = '76a17945-3c6f-435c-975b-b5685db10b62'
|
||||
cs.backups.get(backup_id)
|
||||
|
@@ -1150,6 +1150,10 @@ def do_retype(cs, args):
|
||||
metavar='<description>',
|
||||
default=None,
|
||||
help='Backup description. Default=None.')
|
||||
@utils.arg('--incremental',
|
||||
action='store_true',
|
||||
help='Incremental backup. Default=False.',
|
||||
default=False)
|
||||
@utils.service_type('volumev2')
|
||||
def do_backup_create(cs, args):
|
||||
"""Creates a volume backup."""
|
||||
@@ -1163,7 +1167,8 @@ def do_backup_create(cs, args):
|
||||
backup = cs.backups.create(volume.id,
|
||||
args.container,
|
||||
args.name,
|
||||
args.description)
|
||||
args.description,
|
||||
args.incremental)
|
||||
|
||||
info = {"volume_id": volume.id}
|
||||
info.update(backup._info)
|
||||
|
@@ -35,19 +35,22 @@ class VolumeBackupManager(base.ManagerWithFind):
|
||||
resource_class = VolumeBackup
|
||||
|
||||
def create(self, volume_id, container=None,
|
||||
name=None, description=None):
|
||||
name=None, description=None,
|
||||
incremental=False):
|
||||
"""Creates a volume backup.
|
||||
|
||||
:param volume_id: The ID of the volume to backup.
|
||||
:param container: The name of the backup service container.
|
||||
:param name: The name of the backup.
|
||||
:param description: The description of the backup.
|
||||
:param incremental: Incremental backup.
|
||||
:rtype: :class:`VolumeBackup`
|
||||
"""
|
||||
body = {'backup': {'volume_id': volume_id,
|
||||
'container': container,
|
||||
'name': name,
|
||||
'description': description}}
|
||||
'description': description,
|
||||
'incremental': incremental}}
|
||||
return self._create('/backups', body, 'backup')
|
||||
|
||||
def get(self, backup_id):
|
||||
|
Reference in New Issue
Block a user