Skip to content

Commit 3fc5853

Browse files
committed
volume: Volume names are optional
Who knew? Change-Id: I1c1a811c0db59250e8a20a87f25c2662bc3ab3e8 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent c6065c7 commit 3fc5853

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

openstackclient/tests/unit/volume/v2/test_volume.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,9 @@ def setUp(self):
108108
def test_volume_create_min_options(self):
109109
arglist = [
110110
'--size', str(self.new_volume.size),
111-
self.new_volume.name,
112111
]
113112
verifylist = [
114113
('size', self.new_volume.size),
115-
('name', self.new_volume.name),
116114
]
117115
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
118116

@@ -124,7 +122,7 @@ def test_volume_create_min_options(self):
124122
self.volumes_mock.create.assert_called_with(
125123
size=self.new_volume.size,
126124
snapshot_id=None,
127-
name=self.new_volume.name,
125+
name=None,
128126
description=None,
129127
volume_type=None,
130128
availability_zone=None,

openstackclient/volume/v2/volume.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ class CreateVolume(command.ShowOne):
8282
_description = _("Create new volume")
8383

8484
def get_parser(self, prog_name):
85-
parser = super(CreateVolume, self).get_parser(prog_name)
85+
parser = super().get_parser(prog_name)
8686
parser.add_argument(
8787
"name",
8888
metavar="<name>",
89+
nargs="?",
8990
help=_("Volume name"),
9091
)
9192
parser.add_argument(
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
The ``<name>`` argument for the ``volume create`` command is now optional.

0 commit comments

Comments
 (0)