None value allowed for port parameter in legacy v2 API, but not allowed in v2.1 API

Bug #1555656 reported by Alex Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Alex Xu

Bug Description

In the legacy v2 API, we create server with network like this:
"networks": [{"uuid": "f4001fde-7bb8-4a73-b1a9-03b444d1f6f8", "port": null}]'
The port can be null.

With v2.1 API, you will get 400:

curl -g -i -X POST http://192.168.2.176:8774/v2.1/b90b53ed87d74e19806da34dbaa056c9/servers -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: e740965218754560a98d9ac188271253" -d '{"server": {"name": "vm4", "imageRef": "33a713dc-7efe-488c-bf12-d902ff5e6118", "flavorRef": "1", "max_count": 1, "min_count": 1, "networks": [{"uuid": "f4001fde-7bb8-4a73-b1a9-03b444d1f6f8", "port": null}]}}'
HTTP/1.1 400 Bad Request
X-Openstack-Nova-Api-Version: 2.1
Vary: X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 117
X-Compute-Request-Id: req-c5ab91ca-dc24-42ea-8272-7f35571b15da
Date: Mon, 07 Mar 2016 13:01:58 GMT

{"badRequest": {"message": "Invalid input for field/attribute port. Value: None. None is not a 'uuid'", "code": 400}}

This is due to we write json-schema like this:
'port': {
       'type': ['string', 'null'],
       format': 'uuid'
 },

We assume 'type' will enable 'null' value and 'format' only against on string type. Actually 'null' will be passed to format check also, then the format check return fault.

Revision history for this message
Alex Xu (xuhj) wrote :
Changed in nova:
assignee: nobody → Alex Xu (xuhj)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
jichenjc (jichenjc) wrote :

https://review.openstack.org/#/c/288268 mark this bug as fixed due to this patch merged

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

As we use the "direct-release" model in Nova we don't use the
"fix comitted" status for merged bug fixes anymore. I'm setting
this manually to "fix-released" to be consistent.

[1] "[openstack-dev] [release][all] bugs will now close automatically
    when patches merge"; Doug Hellmann; 2015-12-07;
    http://lists.openstack.org/pipermail/openstack-dev/2015-December/081612.html

Changed in nova:
status: Fix Committed → Fix Released
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.