Add "--force" option to "backup create" command in volumev2
Cinder V2 API supports creating volume backup with "--force" option. However, OSC doesn't support this argument. So this patch add the "--force" option to allow users to back up a in-use volume. Change-Id: I326f8d6172b2830da4cf1317348af50142cc5490 Closes-Bug: #1596443
This commit is contained in:
parent
21ac9230e8
commit
fc719f998c
@ -16,6 +16,7 @@ Create new backup
|
|||||||
[--container <container>]
|
[--container <container>]
|
||||||
[--name <name>]
|
[--name <name>]
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
|
[--force]
|
||||||
<volume>
|
<volume>
|
||||||
|
|
||||||
.. option:: --container <container>
|
.. option:: --container <container>
|
||||||
@ -30,6 +31,10 @@ Create new backup
|
|||||||
|
|
||||||
Description of the backup
|
Description of the backup
|
||||||
|
|
||||||
|
.. option:: --force
|
||||||
|
|
||||||
|
Allow to back up an in-use volume
|
||||||
|
|
||||||
.. _backup_create-backup:
|
.. _backup_create-backup:
|
||||||
.. describe:: <volume>
|
.. describe:: <volume>
|
||||||
|
|
||||||
|
@ -72,12 +72,14 @@ class TestBackupCreate(TestBackup):
|
|||||||
"--name", self.new_backup.name,
|
"--name", self.new_backup.name,
|
||||||
"--description", self.new_backup.description,
|
"--description", self.new_backup.description,
|
||||||
"--container", self.new_backup.container,
|
"--container", self.new_backup.container,
|
||||||
|
"--force",
|
||||||
self.new_backup.volume_id,
|
self.new_backup.volume_id,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
("name", self.new_backup.name),
|
("name", self.new_backup.name),
|
||||||
("description", self.new_backup.description),
|
("description", self.new_backup.description),
|
||||||
("container", self.new_backup.container),
|
("container", self.new_backup.container),
|
||||||
|
("force", True),
|
||||||
("volume", self.new_backup.volume_id),
|
("volume", self.new_backup.volume_id),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -88,7 +90,8 @@ class TestBackupCreate(TestBackup):
|
|||||||
self.new_backup.volume_id,
|
self.new_backup.volume_id,
|
||||||
container=self.new_backup.container,
|
container=self.new_backup.container,
|
||||||
name=self.new_backup.name,
|
name=self.new_backup.name,
|
||||||
description=self.new_backup.description
|
description=self.new_backup.description,
|
||||||
|
force=True,
|
||||||
)
|
)
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, data)
|
self.assertEqual(self.data, data)
|
||||||
@ -112,7 +115,8 @@ class TestBackupCreate(TestBackup):
|
|||||||
self.new_backup.volume_id,
|
self.new_backup.volume_id,
|
||||||
container=self.new_backup.container,
|
container=self.new_backup.container,
|
||||||
name=None,
|
name=None,
|
||||||
description=self.new_backup.description
|
description=self.new_backup.description,
|
||||||
|
force=False,
|
||||||
)
|
)
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, data)
|
self.assertEqual(self.data, data)
|
||||||
|
@ -48,6 +48,12 @@ class CreateBackup(command.ShowOne):
|
|||||||
metavar="<container>",
|
metavar="<container>",
|
||||||
help=_("Optional backup container name")
|
help=_("Optional backup container name")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--force',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help=_("Allow to back up an in-use volume")
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -58,7 +64,8 @@ class CreateBackup(command.ShowOne):
|
|||||||
volume_id,
|
volume_id,
|
||||||
container=parsed_args.container,
|
container=parsed_args.container,
|
||||||
name=parsed_args.name,
|
name=parsed_args.name,
|
||||||
description=parsed_args.description
|
description=parsed_args.description,
|
||||||
|
force=parsed_args.force,
|
||||||
)
|
)
|
||||||
backup._info.pop("links", None)
|
backup._info.pop("links", None)
|
||||||
return zip(*sorted(six.iteritems(backup._info)))
|
return zip(*sorted(six.iteritems(backup._info)))
|
||||||
|
6
releasenotes/notes/bug-1596443-9e2af267e91d1643.yaml
Normal file
6
releasenotes/notes/bug-1596443-9e2af267e91d1643.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add ``--force`` option to ``backup create`` command to allow users to
|
||||||
|
back up an in-use volume.
|
||||||
|
[Bug `1596443 <https://bugs.launchpad.net/bugs/1596443>`_]
|
Loading…
Reference in New Issue
Block a user