Skip to content

Commit 3481265

Browse files
Paul Bourkestevemar
authored andcommitted
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
1 parent 5636d99 commit 3481265

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

doc/source/command-objects/backup.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Create new backup
1818
[--description <description>]
1919
[--snapshot <snapshot>]
2020
[--force]
21+
[--incremental]
2122
<volume>
2223
2324
.. option:: --container <container>
@@ -44,6 +45,12 @@ Create new backup
4445

4546
*Volume version 2 only*
4647

48+
.. option:: --incremental
49+
50+
Perform an incremental backup
51+
52+
*Volume version 2 only*
53+
4754
.. _backup_create-backup:
4855
.. describe:: <volume>
4956

openstackclient/tests/volume/v2/test_backup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def test_backup_create(self):
7979
"--description", self.new_backup.description,
8080
"--container", self.new_backup.container,
8181
"--force",
82+
"--incremental",
8283
"--snapshot", self.new_backup.snapshot_id,
8384
self.new_backup.volume_id,
8485
]
@@ -87,6 +88,7 @@ def test_backup_create(self):
8788
("description", self.new_backup.description),
8889
("container", self.new_backup.container),
8990
("force", True),
91+
("incremental", True),
9092
("snapshot", self.new_backup.snapshot_id),
9193
("volume", self.new_backup.volume_id),
9294
]
@@ -100,6 +102,7 @@ def test_backup_create(self):
100102
name=self.new_backup.name,
101103
description=self.new_backup.description,
102104
force=True,
105+
incremental=True,
103106
snapshot_id=self.new_backup.snapshot_id,
104107
)
105108
self.assertEqual(self.columns, columns)
@@ -126,6 +129,7 @@ def test_backup_create_without_name(self):
126129
name=None,
127130
description=self.new_backup.description,
128131
force=False,
132+
incremental=False,
129133
snapshot_id=None,
130134
)
131135
self.assertEqual(self.columns, columns)

openstackclient/volume/v2/backup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def get_parser(self, prog_name):
5959
default=False,
6060
help=_("Allow to back up an in-use volume")
6161
)
62+
parser.add_argument(
63+
'--incremental',
64+
action='store_true',
65+
default=False,
66+
help=_("Perform an incremental backup")
67+
)
6268
return parser
6369

6470
def take_action(self, parsed_args):
@@ -75,6 +81,7 @@ def take_action(self, parsed_args):
7581
name=parsed_args.name,
7682
description=parsed_args.description,
7783
force=parsed_args.force,
84+
incremental=parsed_args.incremental,
7885
snapshot_id=snapshot_id,
7986
)
8087
backup._info.pop("links", None)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Add ``--incremental`` option to ``backup create`` command to allow users to
5+
create incremental backups.
6+
[Bug `1600196 <https://bugs.launchpad.net/python-openstackclient/+bug/1600196>`_]

0 commit comments

Comments
 (0)