Bug 1598484

Summary: Soft Affinity and Soft Anti-Affinity don't work with Openstack Commands
Product: Red Hat OpenStack Reporter: awaugama
Component: python-openstackclientAssignee: Julie Pichon <jpichon>
Status: CLOSED NOTABUG QA Contact: Shai Revivo <srevivo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 13.0 (Queens)CC: apevec, awaugama, lhh, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-06 13:54:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description awaugama 2018-07-05 15:36:11 UTC
Description of problem:

Currently when 

Version-Release number of selected component (if applicable):

(overcloud) [stack@undercloud-0 ~]$ yum list installed | grep openstackclient
python-openstackclient-lang.noarch
python2-openstackclient.noarch    3.14.1-1.el7ost       @rhelosp-13.0-puddle    

How reproducible:

100%

Steps to Reproduce:

Try to create a server group specifying soft affinity

"openstack server group create --policy soft-affinity test"

Actual results:

An error is thrown that soft-affinity isn't an allowed policy

"Invalid input for field/attribute 0. Value: soft-affinity. u'soft-affinity' is not one of ['anti-affinity', 'affinity'] (HTTP 400) (Request-ID: req-64cb0644-1be8-404f-8e5e-ea1a16074d34)"

Expected results:

A server group should be created with a soft-affinity policy (as it does with the nova cli)

"nova server-group-create test soft-affinity
+--------------------------------------+------+----------------------------------+----------------------------------+--------------------+---------+----------+
| Id                                   | Name | Project Id                       | User Id                          | Policies           | Members | Metadata |
+--------------------------------------+------+----------------------------------+----------------------------------+--------------------+---------+----------+
| 2eda6fba-ca74-4ff4-a6fd-2e03235e3269 | test | 8fe48d39b6064c07bca9cc8d5aef1bbf | b23ae64def6a4f528c8463d84cd2e040 | [u'soft-affinity'] | []      | {}       |
+--------------------------------------+------+----------------------------------+----------------------------------+--------------------+---------+----------+"

Additional info:

Comment 1 awaugama 2018-07-05 15:38:30 UTC
Updating Description, sorry about that:

Currently when using the nova CLI we can create server groups using the following policies: Affinity, Anti-Affinity, Soft-Affinity, and Soft-Anti-Affinity.  When trying to use the OpenStack CLI, we can only create server groups using Affinity or Anti-Affinity

Comment 2 Julie Pichon 2018-07-06 08:08:25 UTC
Looking at https://bugs.launchpad.net/python-openstackclient/+bug/1732938 and also bug 1447798 this should be fixed since 3.12.1. Could you try again with the --os-compute-api-version 2.15 flag? Something like:

$ openstack server group create test \
    --policy soft-anti-affinity \
    --os-compute-api-version 2.15

Comment 3 awaugama 2018-07-06 13:54:49 UTC
Thanks Julie.  That did the trick, I'll go ahead and close the bug

(overcloud) [stack@undercloud-0 ~]$ openstack --os-compute-api-version 2.15 server group create test --policy soft-affinity
+------------+--------------------------------------+
| Field      | Value                                |
+------------+--------------------------------------+
| id         | 402d9359-7df7-4a9b-95da-4efb29bb0710 |
| members    |                                      |
| name       | test                                 |
| policies   | soft-affinity                        |
| project_id | 3d9c35e4ff674ded8fa6a125523af9f1     |
| user_id    | 405f5080f9874df09f4264f15dcc3590     |
+------------+--------------------------------------+