Folsom - Unable to create flavor without optional parameters

Bug #1056910 reported by Rajalakshmi Ganesan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Sathish Nagappan

Bug Description

Description:
--------------

We are unable to create Flavor when Optional parameters "swap", "os-flavor-access:is_public", "rxtx_factor", "OS-FLV-EXT-DATA:ephemeral" are not mentioned in the request body.

Though the above mentioned paramters are optional, we get Bad Request on not giving these parameters in request body.

Environment:
--------------
Folsom

Python Nova client output for help:
---------------------------------------

rajalakshmi_ganesan@ubuntu:~$ nova help flavor-create
usage: nova flavor-create [--ephemeral <ephemeral>] [--swap <swap>]
                          [--rxtx-factor <factor>] [--is-public <is-public>]
                          <name> <id> <ram> <disk> <vcpus>

Create a new flavor

Positional arguments:
  <name> Name of the new flavor
  <id> Unique integer ID for the new flavor
  <ram> Memory size in MB
  <disk> Disk size in GB
  <vcpus> Number of vcpus

Optional arguments:
  --ephemeral <ephemeral>
                        Ephemeral space size in GB (default 0)
  --swap <swap> Swap space size in MB (default 0)
  --rxtx-factor <factor>
                        RX/TX factor (default 1)
  --is-public <is-public>
                        Make flavor accessible to the public (default true)
rajalakshmi_ganesan@ubuntu:~$

CURL COMMAND OUTPUTS:
--------------------------------

1. REQUEST WITHOUT OPTIONAL PARAMETERS

rajalakshmi_ganesan@ubuntu:~$ curl -i http://15.184.64.226:8774/v2/25ecbf309f7748c6a173fabf2a673a65/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "X-Auth-Token: 0b78256729a848559f7a9a45e24ef554" -d '{"flavor": {"disk": 10, "vcpus": 2, "ram": 1024, "name": "flavor-122", "id": 122}}'
HTTP/1.1 400 Bad Request
Content-Length: 141
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-2d7629b4-4ad5-4d50-9fb8-8bb032e4147f
Date: Wed, 26 Sep 2012 14:23:19 GMT

{"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}rajalakshmi_ganesan@ubuntu:~$
rajalakshmi_ganesan@ubuntu:~$

2. REQUEST WITH OPTIONAL PARAMETERS

rajalakshmi_ganesan@ubuntu:~$ curl -i http://15.184.64.226:8774/v2/25ecbf309f7748c6a173fabf2a673a65/flavors -X POST -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "X-Auth-Token: 0b78256729a848559f7a9a45e24ef554" -d '{"flavor": {"disk": 10, "vcpus": 2, "ram": 1024, "name": "PS_flavor", "id": 333, "swap": 22, "os-flavor-access:is_public": true, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2}}'
HTTP/1.1 200 OK
X-Compute-Request-Id: req-36287256-1c99-4939-a72b-be741b8fcf63
Content-Type: application/json
Content-Length: 432
Date: Wed, 26 Sep 2012 14:28:12 GMT

{"flavor": {"name": "PS_flavor", "links": [{"href": "http://15.184.64.226:8774/v2/25ecbf309f7748c6a173fabf2a673a65/flavors/333", "rel": "self"}, {"href": "http://15.184.64.226:8774/25ecbf309f7748c6a173fabf2a673a65/flavors/333", "rel": "bookmark"}], "ram": 1024, "OS-FLV-DISABLED:disabled": false, "vcpus": 2, "swap": 22, "os-flavor-access:is_public": true, "rxtx_factor": 2, "OS-FLV-EXT-DATA:ephemeral": 2, "disk": 10, "id": "333"}}rajalakshmi_ganesan@ubuntu:~$ nova flavor-list
+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True | {} |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | {} |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | {} |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | {} |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | {} |
| 12 | flavor-12 | 1024 | 10 | 2 | 512 | 2 | 1.0 | True | {} |
| 333 | PS_flavor | 1024 | 10 | 2 | 22 | 2 | 2.0 | True | {} |
+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

description: updated
Changed in nova:
assignee: nobody → Sathish Nagappan (sathish-nagappan)
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/14547

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/14548
Committed: http://github.com/openstack/nova/commit/62a4aa3e8f6ed7336dd94a82ead81490e42a9622
Submitter: Jenkins
Branch: master

commit 62a4aa3e8f6ed7336dd94a82ead81490e42a9622
Author: Sathish Nagappan <email address hidden>
Date: Thu Oct 18 05:00:47 2012 -0700

    Create Flavors without Optional Arguments

    fixes Bug #1056910

    Allows the user to create a flavor without optional arguments.
    The variable, ephemeral, is not currently set to a default value.
    This none type value causes exceptions in subsequent code, which
    occurs when specifying only mandatory parameters.

    Change-Id: Ic440136b000dc296bef3bb6f8b0856ff5e7e4e79

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-1 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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