yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #46135
[Bug 1535759] Re: Booting server with --hint group=group-name throws http 500
Reviewed: https://review.openstack.org/272737
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5cc5a841109b082395d9664edcfc11e31fb678fa
Submitter: Jenkins
Branch: master
commit 5cc5a841109b082395d9664edcfc11e31fb678fa
Author: Balazs Gibizer <balazs.gibizer@xxxxxxxxxxxx>
Date: Tue Jan 26 22:10:12 2016 +0100
Return HTTP 400 for invalid server-group uuid
Nova API checks that the value of the group scheduler hint
shall be a valid server-group uuid, however it was done by custom
code not jsonschema. Moreover the exception was not handled by the API
so both v2.0 and v.2.1 returned HTTP 500 if the group hint wasn't a valid
uuid of an existing server group.
The custom code to check for the validity of the group uuid is kept in
nova.compute.api as it is still needed in v2.0.
In v2.0 InstanceGroupNotFound exception are now translated to HTTPBadRequest.
In v2.1 the scheduler_hint jsonschema is now extended to check the format
of the group hint and the api is now translates the InstanceGroupNotFound
to HTTPBadRequest.
Closes-bug: #1535759
Change-Id: I38d98c74f6cceed5b4becf9ed67f7189cba479fa
** Changed in: nova
Status: In Progress => 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/1535759
Title:
Booting server with --hint group=group-name throws http 500
Status in OpenStack Compute (nova):
Fix Released
Bug description:
It seems that nova expects and validates that the os:scheduler_hints
group key contains an UUID. However if it is not a UUID HTTP 500 is
returned instead of HTTP 400.
This was visible in devstack with nova from master branch
(b558d616c3b123dbe2a0914162b45765192f3a12)
To reproduce:
$ nova server-group-create affin-group-1 affinity
+--------------------------------------+---------------+---------------+---------+----------+
| Id | Name | Policies | Members | Metadata |
+--------------------------------------+---------------+---------------+---------+----------+
| b087079c-cfc8-4a7d-a578-ccfbb7a85cf5 | affin-group-1 | [u'affinity'] | [] | {} |
+--------------------------------------+---------------+---------------+---------+----------+
nova --debug boot --flavor 42 --image cirros-0.3.4-x86_64-uec --hint group=affin-group-1 inst-1
<snip>
DEBUG (session:225) REQ: curl -g -i -X POST http://192.168.200.200:8774/v2.1/91b11b772c4d400f9a44ab1bbfd4ddd8/servers -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.12" -H "X-Auth-Token: {SHA1}71a9fd700ffb3e625648e4423b3bd3c409d23246" -d '{"os:scheduler_hints": {"group": "affin-group-1"}, "server": {"min_count": 1, "flavorRef": "42", "name": "inst-1", "imageRef": "75a189fa-389b-4386-a731-a3bfccdfe352", "max_count": 1}}'
DEBUG (connectionpool:387) "POST /v2.1/91b11b772c4d400f9a44ab1bbfd4ddd8/servers HTTP/1.1" 500 201
DEBUG (session:254) RESP: [500] Content-Length: 201 X-Compute-Request-Id: req-5a167ca6-6828-4724-ba7f-246202b0a9ec Vary: X-OpenStack-Nova-API-Version Connection: keep-alive X-Openstack-Nova-Api-Version: 2.12 Date: Tue, 05 Jan 2016 22:48:57 GMT Content-Type: application/json; charset=UTF-8
RESP BODY: {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<class 'nova.exception.InvalidInput'>", "code": 500}}
DEBUG (shell:896) Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'nova.exception.InvalidInput'> (HTTP 500) (Request-ID: req-5a167ca6-6828-4724-ba7f-246202b0a9ec)
Traceback (most recent call last):
File "/opt/stack/python-novaclient/novaclient/shell.py", line 894, in main
OpenStackComputeShell().main(argv)
File "/opt/stack/python-novaclient/novaclient/shell.py", line 821, in main
args.func(self.cs, args)
File "/opt/stack/python-novaclient/novaclient/v2/shell.py", line 542, in do_boot
server = cs.servers.create(*boot_args, **boot_kwargs)
File "/opt/stack/python-novaclient/novaclient/v2/servers.py", line 1024, in create
**boot_kwargs)
File "/opt/stack/python-novaclient/novaclient/v2/servers.py", line 555, in _boot
return_raw=return_raw, **kwargs)
File "/opt/stack/python-novaclient/novaclient/base.py", line 175, in _create
_resp, body = self.api.client.post(url, body=body)
File "/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py", line 179, in post
return self.request(url, 'POST', **kwargs)
File "/opt/stack/python-novaclient/novaclient/client.py", line 92, in request
raise exceptions.from_response(resp, body, url, method)
ClientException: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'nova.exception.InvalidInput'> (HTTP 500) (Request-ID: req-5a167ca6-6828-4724-ba7f-246202b0a9ec)
From the nova-api log:
2016-01-05 22:48:57.786 ERROR nova.api.openstack.extensions [req-5a167ca6-6828-4724-ba7f-246202b0a9ec admin admin] Unexpected exception in API method
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions Traceback (most recent call last):
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/extensions.py", line 478, in wrapped
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions return f(*args, **kwargs)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 604, in create
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions **create_kwargs)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/hooks.py", line 149, in inner
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions rv = f(*args, **kwargs)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1504, in create
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions check_server_group_quota=check_server_group_quota)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1122, in _create_instance
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions scheduler_hints, check_server_group_quota)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1041, in _get_requested_instance_group
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions raise exception.InvalidInput(reason=msg)
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions InvalidInput: Invalid input received: Server group scheduler hint must be a UUID.
2016-01-05 22:48:57.786 TRACE nova.api.openstack.extensions
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1535759/+subscriptions
References