Add "--incremental" option to "backup create" command in volume v2

Cinder V2 API supports creating volume backup with "--incremental"
option. However, OSC doesn't support this argument. So this patch adds
the "--incremental" option to allow users to create incremental style
backups.

Change-Id: Iefac5f1a6c9ef006ad9c22d4250ae6df50504781
Closes-Bug: 1600196
This commit is contained in:
Paul Bourke 2016-07-08 11:25:25 +00:00 committed by Steve Martinelli
parent 5636d99a2b
commit 34812655a5
4 changed files with 24 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Create new backup
[--description <description>]
[--snapshot <snapshot>]
[--force]
[--incremental]
<volume>
.. option:: --container <container>
@ -44,6 +45,12 @@ Create new backup
*Volume version 2 only*
.. option:: --incremental
Perform an incremental backup
*Volume version 2 only*
.. _backup_create-backup:
.. describe:: <volume>

View File

@ -79,6 +79,7 @@ class TestBackupCreate(TestBackup):
"--description", self.new_backup.description,
"--container", self.new_backup.container,
"--force",
"--incremental",
"--snapshot", self.new_backup.snapshot_id,
self.new_backup.volume_id,
]
@ -87,6 +88,7 @@ class TestBackupCreate(TestBackup):
("description", self.new_backup.description),
("container", self.new_backup.container),
("force", True),
("incremental", True),
("snapshot", self.new_backup.snapshot_id),
("volume", self.new_backup.volume_id),
]
@ -100,6 +102,7 @@ class TestBackupCreate(TestBackup):
name=self.new_backup.name,
description=self.new_backup.description,
force=True,
incremental=True,
snapshot_id=self.new_backup.snapshot_id,
)
self.assertEqual(self.columns, columns)
@ -126,6 +129,7 @@ class TestBackupCreate(TestBackup):
name=None,
description=self.new_backup.description,
force=False,
incremental=False,
snapshot_id=None,
)
self.assertEqual(self.columns, columns)

View File

@ -59,6 +59,12 @@ class CreateBackup(command.ShowOne):
default=False,
help=_("Allow to back up an in-use volume")
)
parser.add_argument(
'--incremental',
action='store_true',
default=False,
help=_("Perform an incremental backup")
)
return parser
def take_action(self, parsed_args):
@ -75,6 +81,7 @@ class CreateBackup(command.ShowOne):
name=parsed_args.name,
description=parsed_args.description,
force=parsed_args.force,
incremental=parsed_args.incremental,
snapshot_id=snapshot_id,
)
backup._info.pop("links", None)

View File

@ -0,0 +1,6 @@
---
features:
- |
Add ``--incremental`` option to ``backup create`` command to allow users to
create incremental backups.
[Bug `1600196 <https://bugs.launchpad.net/python-openstackclient/+bug/1600196>`_]