yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51643
[Bug 1582911] Re: Relaxed validation for v2 doesn't accept null for user_data like legacy v2 does (liberty)
Reviewed: https://review.openstack.org/318447
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=22c87390a33300b93f0913d4e787662b119a00b9
Submitter: Jenkins
Branch: master
commit 22c87390a33300b93f0913d4e787662b119a00b9
Author: He Jie Xu <hejie.xu@xxxxxxxxx>
Date: Thu May 19 11:04:10 2016 +0800
Enable 'null' value for user_data in V2.1 API
The legacy v2 API allow the 'null' value for user_data. Unfortunately
the v2.1 API didn't match that in the input validation. This patch
enables 'null' value, at sametime, it enables for v2.1 compat mode
also.
Change-Id: Iae614035efd4b37c214754ad12b17ca224b8fd92
Closes-Bug: #1582911
** 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/1582911
Title:
Relaxed validation for v2 doesn't accept null for user_data like
legacy v2 does (liberty)
Status in OpenStack Compute (nova):
Fix Released
Status in OpenStack Compute (nova) liberty series:
Confirmed
Status in OpenStack Compute (nova) mitaka series:
Confirmed
Bug description:
Description
===========
When moving to the relaxed validation [1] implementation of the v2 API under the v2.1 code base, a 'nova boot' request with "user_data": null fails with the error:
Returning 400 to user: Invalid input for field/attribute user_data.
Value: None. None is not of type 'string'
Under the legacy v2 code base, such a request is allowed.
Steps to reproduce
==================
Using the legacy v2 code base under Liberty, make a nova boot call using the following json payload:
{
"server": {
"name": "mgdlibertyBBC",
"flavorRef": "1",
"imageRef": "626ce751-744f-4830-9d38-5e9e4f70fe3f",
"user_data": null,
"metadata": {
"created_by": "mdorman"
},
"security_groups": [
{
"name": "default"
}
],
"availability_zone": "glbt1-dev-lab-zone-1,glbt1-dev-lab-zone-2,",
"key_name": "lm126135-mdorm"
}
}
The request succeeds and the instance is created.
However, using the v2 implementation from the v2.1 code base with the
same json payload fails:
2016-05-17 12:47:02.336 18296 DEBUG nova.api.openstack.wsgi [req-
6d5d4100-7c0c-4ffa-a40c-4a086a473293 mdorman
40e94f951b704545885bdaa987a25154 - - -] Returning 400 to user: Invalid
input for field/attribute user_data. Value: None. None is not of type
'string' __call__ /usr/lib/python2.7/site-
packages/nova/api/openstack/wsgi.py:1175
Expected result
===============
The behavior of the v2 API in the v2.1 code base should be exactly the same as the legacy v2 code base.
Actual result
=============
Request fails under v2.1 code base, but succeeds under legacy v2 code base.
Environment
===========
Liberty, 12.0.3 tag (stable/liberty branch on 4/13/2016. Latest commit 6fdf1c87b1149e8b395eaa9f4cbf27263cf96ac6)
Logs & Configs
==============
Paste config used for legacy v2 code base (request succeeds):
[composite:osapi_compute]
use = call:nova.api.openstack.urlmap:urlmap_factory
/v1.1: openstack_compute_api_legacy_v2
/v2: openstack_compute_api_legacy_v2
/v2.1: openstack_compute_api_v21
Paste config used for v2.1 code base (request fails):
[composite:osapi_compute]
use = call:nova.api.openstack.urlmap:urlmap_factory
/: oscomputeversions
/v1.1: openstack_compute_api_v21_legacy_v2_compatible
/v2: openstack_compute_api_v21_legacy_v2_compatible
/v2.1: openstack_compute_api_v21
[1] http://specs.openstack.org/openstack/nova-specs/specs/liberty/implemented/api-relax-validation.html
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1582911/+subscriptions
References