Remove hard-coded policy choices for creating a server group

The hard-coded choices for the server group policy make it impossible
to create a server group with the soft-affinity or
soft-anti-affinity policy rules which were added in compute API
microversion 2.15. This removes the hard-coded choices so that the
policy is restricted on the server side rather than the client side.

Change-Id: Ib3dc39422ac1015872d56ae2fdeddf0f29613494
Closes-Bug: #1732938
This commit is contained in:
Matt Riedemann 2017-11-19 18:34:24 -05:00
parent ddb94ea2a4
commit d0917cd14b
2 changed files with 5 additions and 4 deletions

View File

@ -55,11 +55,12 @@ class CreateServerGroup(command.ShowOne):
parser.add_argument(
'--policy',
metavar='<policy>',
choices=['affinity', 'anti-affinity'],
default='affinity',
help=_("Add a policy to <name> "
"('affinity' or 'anti-affinity', "
"default to 'affinity')")
"defaults to 'affinity'). Specify --os-compute-api-version "
"2.15 or higher for the 'soft-affinity' or "
"'soft-anti-affinity' policy.")
)
return parser

View File

@ -63,11 +63,11 @@ class TestServerGroupCreate(TestServerGroup):
def test_server_group_create(self):
arglist = [
'--policy', 'anti-affinity',
'--policy', 'soft-anti-affinity',
'affinity_group',
]
verifylist = [
('policy', 'anti-affinity'),
('policy', 'soft-anti-affinity'),
('name', 'affinity_group'),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)