Make snapshot and backup name optional
Cinder does not require snapshot and backup name. These arguments are optional. Change-Id: I05d59efc9642205a25684bf0b77758328296d959
This commit is contained in:
parent
e49c3f6682
commit
311e775c81
@ -77,6 +77,30 @@ class TestBackupCreate(TestBackup):
|
||||
self.assertEqual(columns, volume_fakes.BACKUP_columns)
|
||||
self.assertEqual(data, volume_fakes.BACKUP_data)
|
||||
|
||||
def test_backup_create_without_name(self):
|
||||
arglist = [
|
||||
volume_fakes.volume_id,
|
||||
"--description", volume_fakes.backup_description,
|
||||
"--container", volume_fakes.backup_name
|
||||
]
|
||||
verifylist = [
|
||||
("volume", volume_fakes.volume_id),
|
||||
("description", volume_fakes.backup_description),
|
||||
("container", volume_fakes.backup_name)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.backups_mock.create.assert_called_with(
|
||||
volume_fakes.volume_id,
|
||||
container=volume_fakes.backup_name,
|
||||
name=None,
|
||||
description=volume_fakes.backup_description
|
||||
)
|
||||
self.assertEqual(columns, volume_fakes.BACKUP_columns)
|
||||
self.assertEqual(data, volume_fakes.BACKUP_data)
|
||||
|
||||
|
||||
class TestBackupDelete(TestBackup):
|
||||
|
||||
|
@ -75,6 +75,30 @@ class TestSnapshotCreate(TestSnapshot):
|
||||
self.assertEqual(columns, volume_fakes.SNAPSHOT_columns)
|
||||
self.assertEqual(data, volume_fakes.SNAPSHOT_data)
|
||||
|
||||
def test_snapshot_create_without_name(self):
|
||||
arglist = [
|
||||
volume_fakes.volume_id,
|
||||
"--description", volume_fakes.snapshot_description,
|
||||
"--force"
|
||||
]
|
||||
verifylist = [
|
||||
("volume", volume_fakes.volume_id),
|
||||
("description", volume_fakes.snapshot_description),
|
||||
("force", True)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.snapshots_mock.create.assert_called_with(
|
||||
volume_fakes.volume_id,
|
||||
force=True,
|
||||
name=None,
|
||||
description=volume_fakes.snapshot_description
|
||||
)
|
||||
self.assertEqual(columns, volume_fakes.SNAPSHOT_columns)
|
||||
self.assertEqual(data, volume_fakes.SNAPSHOT_data)
|
||||
|
||||
|
||||
class TestSnapshotDelete(TestSnapshot):
|
||||
|
||||
|
@ -41,7 +41,6 @@ class CreateBackup(command.ShowOne):
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
metavar='<name>',
|
||||
required=False,
|
||||
help='Name of the backup',
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -36,7 +36,6 @@ class CreateSnapshot(command.ShowOne):
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
metavar='<name>',
|
||||
required=True,
|
||||
help='Name of the snapshot',
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -35,7 +35,6 @@ class CreateBackup(command.ShowOne):
|
||||
parser.add_argument(
|
||||
"--name",
|
||||
metavar="<name>",
|
||||
required=True,
|
||||
help="Name of the backup"
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -36,7 +36,6 @@ class CreateSnapshot(command.ShowOne):
|
||||
parser.add_argument(
|
||||
"--name",
|
||||
metavar="<name>",
|
||||
required=True,
|
||||
help="Name of the snapshot"
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Make ``--name`` optional in ``volume snapshot create`` and
|
||||
``volume backup create`` commands.
|
Loading…
Reference in New Issue
Block a user