Skip to content

Commit d0917cd

Browse files
committed
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
1 parent ddb94ea commit d0917cd

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

openstackclient/compute/v2/server_group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ def get_parser(self, prog_name):
5555
parser.add_argument(
5656
'--policy',
5757
metavar='<policy>',
58-
choices=['affinity', 'anti-affinity'],
5958
default='affinity',
6059
help=_("Add a policy to <name> "
6160
"('affinity' or 'anti-affinity', "
62-
"default to 'affinity')")
61+
"defaults to 'affinity'). Specify --os-compute-api-version "
62+
"2.15 or higher for the 'soft-affinity' or "
63+
"'soft-anti-affinity' policy.")
6364
)
6465
return parser
6566

openstackclient/tests/unit/compute/v2/test_server_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def setUp(self):
6363

6464
def test_server_group_create(self):
6565
arglist = [
66-
'--policy', 'anti-affinity',
66+
'--policy', 'soft-anti-affinity',
6767
'affinity_group',
6868
]
6969
verifylist = [
70-
('policy', 'anti-affinity'),
70+
('policy', 'soft-anti-affinity'),
7171
('name', 'affinity_group'),
7272
]
7373
parsed_args = self.check_parser(self.cmd, arglist, verifylist)

0 commit comments

Comments
 (0)