[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
In python-novaclient, the "nova secgroup-create" command has been removed since https://review.openstack.org/#/c/437145/. So it is no longer necessary to fix it in python-novaclient. ** Changed in: python-novaclient Status: In Progress => Won't Fix -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (nova): Won't Fix Status in python-novaclient: Won't Fix Status in python-openstackclient: Fix Released Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
AFAICT - the API says a request with no description in the body should be allowed: http://developer.openstack.org/api-ref-compute-v2-ext.html In the controller, the description value is not checked but goes to validate_property... https://github.com/openstack/nova/blob/3e5062a8ddf94351389f7e201959591b26f338a4/nova/api/openstack/compute/contrib/security_groups.py#L190-L207 At validate_property though, it errors out when any value is not a string https://github.com/openstack/nova/blob/d33184b6f890256b332e75bd46a58823cac663ff/nova/compute/api.py#L3855-L3880 To me, this seems like an issue with nova's implementation not matching it's API. In this case the API seems correct as description should always be optional. We can and should proceed with the OSC fix as a band-aid solution, but should mark a TODO to change it when the nova side is resolved. ** Also affects: nova Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): New Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
description is optional, optional does not mean it can be null, it means it shouldn't be in the payload at all. ** Changed in: nova Status: New => Invalid -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): Invalid Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
@sdague, I made a change to novaclient to ensure the body does not include the description value. You can see in the log below that the body is just: {"security_group": {"name": "tempo"}} But, the result remains the same (400 with description is not a string or unicode): 2015-03-25 00:22:48.445 DEBUG nova.api.openstack.wsgi [req-0c501906-c662-4afd-a3fc-3b6e5e22caf9 admin admin] Action: 'create', calling method: >, body: {"security_group": {"name": "tempo"}} from (pid=14913) _process_stack /opt/stack/nova/nova/api/openstack/wsgi.py:780 2015-03-25 00:22:48.447 INFO nova.api.openstack.wsgi [req-0c501906-c662-4afd-a3fc-3b6e5e22caf9 admin admin] HTTP exception thrown: Security group description is not a string or unicode 2015-03-25 00:22:48.447 DEBUG nova.api.openstack.wsgi [req-0c501906-c662-4afd-a3fc-3b6e5e22caf9 admin admin] Returning 400 to user: Security group description is not a string or unicode from (pid=14913) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1166 2015-03-25 00:22:48.450 INFO nova.osapi_compute.wsgi.server [req-0c501906-c662-4afd-a3fc-3b6e5e22caf9 admin admin] 10.0.2.15 "POST /v2/36c7f6452c394b44ad4ae1f2bfe07800/os-security-groups HTTP/1.1" status: 400 len: 317 time: 0.1127591 This is the change that I made to novaclient steve:python-novaclient$ git diff diff --git a/novaclient/v2/security_groups.py b/novaclient/v2/security_groups.py index 40d1e7f..0cd4960 100644 --- a/novaclient/v2/security_groups.py +++ b/novaclient/v2/security_groups.py @@ -45,7 +45,9 @@ class SecurityGroupManager(base.ManagerWithFind): :param description: description of the security group :rtype: the security group object """ -body = {"security_group": {"name": name, 'description': description}} +body = {"security_group": {"name": name}} +if description: +body['security_group']['description'] = description return self._create('/os-security-groups', body, 'security_group') Double checked that it still works for the case with a description, and it does. 2015-03-25 00:25:28.870 DEBUG nova.api.openstack.wsgi [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] Action: 'create', calling method: >, body: {"security_group": {"name": "tempo", "description": "tempo_desc"}} from (pid=14913) _process_stack /opt/stack/nova/nova/api/openstack/wsgi.py:780 2015-03-25 00:25:28.871 DEBUG oslo_db.api [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] Loading backend 'sqlalchemy' from 'nova.db.sqlalchemy.api' from (pid=14913) _load_backend /usr/local/lib/python2.7/dist-packages/oslo_db/api.py:214 2015-03-25 00:25:28.872 WARNING oslo_config.cfg [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] Option "sql_connection" from group "DEFAULT" is deprecated. Use option "connection" from group "database". 2015-03-25 00:25:28.892 DEBUG oslo_db.sqlalchemy.session [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION from (pid=14913) _check_effective_sql_mode /usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/session.py:513 2015-03-25 00:25:29.089 DEBUG nova.quota [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] Created reservations ['abcd8046-85b8-4a9f-a7ac-258e0050d10c'] from (pid=14913) reserve /opt/stack/nova/nova/quota.py:1319 2015-03-25 00:25:29.090 INFO nova.compute.api [req-e2be9899-c50a-40fc-9eaa-258db57b5cf3 admin admin] Create Security Group tempo To me it still looks like this call will always fail: self.security_group_api.validate_property(group_description, 'description', None) Since it always attempts to strip the value and match it with something ** Changed in: nova Status: Invalid => New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): New Status in Python client library for Nova: In Progress Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : h
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
Switched it back to new, let me know if you disagree. ** Also affects: python-novaclient Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): New Status in Python client library for Nova: In Progress Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
Right, optional means you are allowed to not provide the parameter. Not that you can provide it as null. There is a python-novaclient bug here. ** Changed in: nova Status: Incomplete => Won't Fix -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): Won't Fix Status in Python client library for Nova: In Progress Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
There is also a bug in nova. Both the documentation and the data model show "description" as an optional field, but the implementation erroneously requires it as it calls a validate_property function on "description" whether it was provided or not: http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/compute/contrib/security_groups.py#n201 http://git.openstack.org/cgit/openstack/nova/tree/nova/compute/api.py#n3838 ** Changed in: nova Importance: Undecided => Low ** Changed in: nova Status: Won't Fix => Confirmed -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): Confirmed Status in Python client library for Nova: In Progress Status in OpenStack Command Line Client: In Progress Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
** Changed in: python-openstackclient Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (Nova): Confirmed Status in Python client library for Nova: Confirmed Status in OpenStack Command Line Client: Fix Released Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1434172] Re: security group create errors without description
We've updated the Nova docs that this is no longer optional. ** Changed in: nova Status: In Progress => Won't Fix -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1434172 Title: security group create errors without description Status in OpenStack Compute (nova): Won't Fix Status in python-novaclient: In Progress Status in python-openstackclient: Fix Released Bug description: security group create returns an error without --description supplied. This appears to be the server rejecting the request so we should set a default value rather than sending None. $ openstack security group create qaz ERROR: openstack Security group description is not a string or unicode (HTTP 400) (Request-ID: req-dee03de3-893a-4d58-bc3d-de87d09c3fb8) Sent body: {"security_group": {"name": "qaz2", "description": null}} To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1434172/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp