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:
parent
ddb94ea2a4
commit
d0917cd14b
openstackclient
@ -55,11 +55,12 @@ class CreateServerGroup(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--policy',
|
'--policy',
|
||||||
metavar='<policy>',
|
metavar='<policy>',
|
||||||
choices=['affinity', 'anti-affinity'],
|
|
||||||
default='affinity',
|
default='affinity',
|
||||||
help=_("Add a policy to <name> "
|
help=_("Add a policy to <name> "
|
||||||
"('affinity' or 'anti-affinity', "
|
"('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
|
return parser
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ class TestServerGroupCreate(TestServerGroup):
|
|||||||
|
|
||||||
def test_server_group_create(self):
|
def test_server_group_create(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--policy', 'anti-affinity',
|
'--policy', 'soft-anti-affinity',
|
||||||
'affinity_group',
|
'affinity_group',
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('policy', 'anti-affinity'),
|
('policy', 'soft-anti-affinity'),
|
||||||
('name', 'affinity_group'),
|
('name', 'affinity_group'),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user