Fix the policy argument in server-group-create

In the "server-group-create" command, multiple policies
can be specified currently. But only one item is allowed
in the nova side. So make the command allow only one policy.

Change-Id: Ifd2d084faa2b849d6ee466d9accbad21b6a4e11b
Closes-Bug: #1767287
This commit is contained in:
Takashi NATSUME 2018-04-27 16:54:09 +09:00 committed by Matt Riedemann
parent 460638436e
commit 57e9a5d34c
3 changed files with 11 additions and 2 deletions

View File

@ -3571,6 +3571,10 @@ class ShellTest(utils.TestCase):
{'server_group': {'name': 'wjsg',
'policies': ['affinity']}})
def test_create_server_group_with_multiple_policies(self):
self.assertRaises(SystemExit, self.run_command,
'server-group-create wjsg affinity anti-affinity')
def test_delete_multi_server_groups(self):
self.run_command('server-group-delete 12345 56789')
self.assert_called('DELETE', '/os-server-groups/56789')

View File

@ -4501,8 +4501,7 @@ def do_server_group_list(cs, args):
@utils.arg(
'policy',
metavar='<policy>',
nargs='+',
help=_('Policies for the server groups.'))
help=_('Policy for the server group.'))
def do_server_group_create(cs, args):
"""Create a new server group with the specified details."""
server_group = cs.server_groups.create(name=args.name,

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The ``nova server-group-create`` command now only supports specifying
a single policy name when creating the server group. This is to match
the server-side API validation.