← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1555656] [NEW] None value allowed for port parameter in legacy v2 API, but not allowed in v2.1 API

 

Public bug reported:

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.

** Affects: nova
     Importance: Medium
     Assignee: Alex Xu (xuhj)
         Status: In Progress

** Changed in: nova
     Assignee: (unassigned) => Alex Xu (xuhj)

** Changed in: nova
       Status: New => In Progress

** Changed in: nova
   Importance: Undecided => Medium

-- 
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/1555656

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

Status in OpenStack Compute (nova):
  In Progress

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1555656/+subscriptions


Follow ups