← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1408949] [NEW] nova flavor-create return empty string when swap == 0

 

Public bug reported:

The type of 'swap' is string or int according to 'swap' value in DB.
swap == 0, return empty string.
swap > 0, return int.
The client code is complex when return value of API is not fixed type.
On the other hand, the type of 'swap' in the request and response of flavor-create should be same type.

DEBUG (session:169) REQ: curl -g -i -X POST http://10.250.10.29:8774/v2/e159961712f64b388b57062483d98a91/flavors -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}6ba0b4e647a5ca47937c48941ad361d02d4ff604" -d '{"flavor": {"vcpus": 1, "disk": 1, "name": "chenrui_f", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "ram": 1, "id": "11", "swap": 0}}'
INFO (connectionpool:188) Starting new HTTP connection (1): 10.250.10.29
DEBUG (connectionpool:364) "POST /v2/e159961712f64b388b57062483d98a91/flavors HTTP/1.1" 200 425
DEBUG (session:197) RESP: [200] date: Fri, 09 Jan 2015 09:36:44 GMT connection: keep-alive content-type: application/json content-length: 425 x-compute-request-id: req-df79ffc1-08ff-4569-945f-4fa2fdf49436
RESP BODY: {"flavor": {"name": "chenrui_f", "links": [{"href": "http://10.250.10.29:8774/v2/e159961712f64b388b57062483d98a91/flavors/11";, "rel": "self"}, {"href": "http://10.250.10.29:8774/e159961712f64b388b57062483d98a91/flavors/11";, "rel": "bookmark"}], "ram": 1, "OS-FLV-DISABLED:disabled": false, "vcpus": 1, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 1, "id": "11"}}

mysql> select * from instance_types where flavorid=11;
+---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
| created_at          | updated_at | deleted_at | name      | id | memory_mb | vcpus | swap | vcpu_weight | flavorid | rxtx_factor | root_gb | ephemeral_gb | disabled | is_public | deleted |
+---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
| 2015-01-09 09:36:44 | NULL       | NULL       | chenrui_f |  9 |         1 |     1 |    0 |        NULL | 11       |           1 |       1 |            0 |        0 |         1 |       0 |
+---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
1 row in set (0.00 sec)

** Affects: nova
     Importance: Undecided
         Status: New

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

Title:
  nova flavor-create return empty string when swap == 0

Status in OpenStack Compute (Nova):
  New

Bug description:
  The type of 'swap' is string or int according to 'swap' value in DB.
  swap == 0, return empty string.
  swap > 0, return int.
  The client code is complex when return value of API is not fixed type.
  On the other hand, the type of 'swap' in the request and response of flavor-create should be same type.

  DEBUG (session:169) REQ: curl -g -i -X POST http://10.250.10.29:8774/v2/e159961712f64b388b57062483d98a91/flavors -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}6ba0b4e647a5ca47937c48941ad361d02d4ff604" -d '{"flavor": {"vcpus": 1, "disk": 1, "name": "chenrui_f", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "ram": 1, "id": "11", "swap": 0}}'
  INFO (connectionpool:188) Starting new HTTP connection (1): 10.250.10.29
  DEBUG (connectionpool:364) "POST /v2/e159961712f64b388b57062483d98a91/flavors HTTP/1.1" 200 425
  DEBUG (session:197) RESP: [200] date: Fri, 09 Jan 2015 09:36:44 GMT connection: keep-alive content-type: application/json content-length: 425 x-compute-request-id: req-df79ffc1-08ff-4569-945f-4fa2fdf49436
  RESP BODY: {"flavor": {"name": "chenrui_f", "links": [{"href": "http://10.250.10.29:8774/v2/e159961712f64b388b57062483d98a91/flavors/11";, "rel": "self"}, {"href": "http://10.250.10.29:8774/e159961712f64b388b57062483d98a91/flavors/11";, "rel": "bookmark"}], "ram": 1, "OS-FLV-DISABLED:disabled": false, "vcpus": 1, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 1, "id": "11"}}

  mysql> select * from instance_types where flavorid=11;
  +---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
  | created_at          | updated_at | deleted_at | name      | id | memory_mb | vcpus | swap | vcpu_weight | flavorid | rxtx_factor | root_gb | ephemeral_gb | disabled | is_public | deleted |
  +---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
  | 2015-01-09 09:36:44 | NULL       | NULL       | chenrui_f |  9 |         1 |     1 |    0 |        NULL | 11       |           1 |       1 |            0 |        0 |         1 |       0 |
  +---------------------+------------+------------+-----------+----+-----------+-------+------+-------------+----------+-------------+---------+--------------+----------+-----------+---------+
  1 row in set (0.00 sec)

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


Follow ups

References