nova boot apis raises 500 error if scheduler_hints additionalProperties value passed as "null" or "dict"

Bug #1682811 reported by Dinesh Bhor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Undecided
Unassigned

Bug Description

Additional scheduler_hints can be passed while creating a VM but if those additional scheduler_hints value is 'null' or 'dict' the create server call fails with 500 InternalServerError.

Steps to reproduce:

Command:
$ curl -g -i -X POST http://10.232.48.201:8774/v2.1/servers -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "OpenStack-API-Version: compute 2.41" -H "X-OpenStack-Nova-API-Version: 2.41" -H "X-Auth-Token: gAAAAABY7Jf4Qiwm2GKc-dsLiRVxK6-9CPHvk1Vu kRL6kVKItGetXrPUdLIhHtKebr4rSCAnK7VQTMI6v0LySvu3Cpu7e8y_7WSpELWp-Bfx5PEosbDh2UDsiJW7ib8jPEW5rcyQuDun5gDR9NbaugQ6UBcmKW1TMm9QZdTSI2npqyYJTVFuis" -H "Content-Type: application/json" -d '{"os:scheduler_hints": {"key": null}, "server": {"name": "instances1", "imageRef": "107f0481-754d-46a2-98a7-a26228c4280e", "flavorRef": "1", "max_count": 1, "min_count": 1, "networks": "auto"}}'

Please note the scheduler_hints: {"os:scheduler_hints": {"key": null}

Output:
HTTP/1.1 500 Internal Server Error
Openstack-Api-Version: compute 2.41
X-Openstack-Nova-Api-Version: 2.41
Vary: OpenStack-API-Version
Vary: X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 194
X-Compute-Request-Id: req-3c29eadc-20d0-4aef-b3c0-def9a51b0e64
Date: Tue, 11 Apr 2017 08:47:26 GMT

{"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.ValueError'>", "code": 500}}

nova-api:

2017-04-11 14:17:26.843 ERROR nova.api.openstack.extensions [req-3c29eadc-20d0-4aef
-b3c0-def9a51b0e64 admin admin] Unexpected exception in API method
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions Traceback (most recent
call last):
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova
/nova/api/openstack/extensions.py", line 336, in wrapped
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return f(*args, **k
wargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova
/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args,
**kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova
/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args,
**kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/validation/__init__.py", line 108, in wrapper
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return func(*args, **kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 553, in create
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions **create_kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/hooks.py", line 154, in inner
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions rv = f(*args, **kwargs)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1671, in create
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions check_server_group_quota=check_server_group_quota)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1240, in _create_instance
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions key_pair)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1102, in _provision_instances
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions quotas.rollback()
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions self.force_reraise()
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions six.reraise(self.type_, self.value, self.tb)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/compute/api.py", line 1015, in _provision_instances
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions security_groups=security_groups)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/objects/request_spec.py", line 415, in from_components
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions spec_obj._from_hints(filter_properties.get('scheduler_hints', {}))
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/opt/stack/nova/nova/objects/request_spec.py", line 224, in _from_hints
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions for hint, value in hints_dict.items()}
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/base.py", line 72, in setter
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions field_value = field.coerce(self, name, value)
python2.7/dist-packages/oslo_versionedobjects/fields.py", line 640, in coerce
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions coerced_list.extend(value)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/fields.py", line 1242, in extend
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions for index, item in enumerate(t)]
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/fields.py", line 1222, in _coerce_item
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return self._element_type.coerce(self._obj, att_name, item)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/fields.py", line 193, in coerce
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions return self._null(obj, attr)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_versionedobjects/fields.py", line 171, in _null
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions raise ValueError(_("Field `%s' cannot be None") % attr)
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions ValueError: Field `scheduler_hints[[]][0]' cannot be None
2017-04-11 14:17:26.843 TRACE nova.api.openstack.extensions
2017-04-11 14:17:26.984 INFO nova.api.openstack.wsgi [req-3c29eadc-20d0-4aef-b3c0-def9a51b0e64 admin admin] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.ValueError'>
2017-04-11 14:17:26.985 DEBUG nova.api.openstack.wsgi [req-3c29eadc-20d0-4aef-b3c0-def9a51b0e64 admin admin] Returning 500 to user: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.ValueError'> from (pid=2056) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1041
2017-04-11 14:17:26.986 INFO nova.osapi_compute.wsgi.server [req-3c29eadc-20d0-4aef-b3c0-def9a51b0e64 admin admin] 10.232.48.201 "POST /v2.1/servers HTTP/1.1" status: 500 len: 539 time: 1.1872978

Latest commit:
commit ae637e70a72166067e09f3bbc3acb54e5d92771e
Merge: 9e071f4 370820b
Author: Jenkins <email address hidden>
Date: Fri Apr 14 01:38:43 2017 +0000

    Merge "Fix hypervisors api missing HostMappingNotFound handlers"

Changed in nova:
assignee: nobody → Dinesh Bhor (dinesh-bhor)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/457890

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Dinesh Bhor (<email address hidden>) on branch: master
Review: https://review.openstack.org/457890
Reason: Scheduler hints are deprecated

Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing the status back to the previous state and unassigning. If there are active reviews related to this bug, please include links in comments.

Changed in nova:
status: In Progress → New
assignee: Dinesh Bhor (dinesh-bhor) → nobody
Sean Dague (sdague)
Changed in nova:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.