when ephemeral_gb and swap is default value 0, the response is wrong in v3 flavor api

Bug #1216929 reported by Ivan-Zhu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Christopher Yeoh

Bug Description

when I port flaovr tempest test in nova v3. I find when create flavor with default value of ephemeral_gb and swap (both of them are 0). the response is "". I think it's bug. I look into the code find that the issue is
swap": flavor.get("swap") or "",
"ephemeral": flavor.get("ephemeral_gb") or "",

it's a logic bug in nova/api/openstack/compute/views/flavors.py, I think.

the tempest log is the following:

2013-08-26 21:45:10.222 31704 INFO tempest.common.rest_client [-] Request: POST http://192.168.1.101:8774/v3/flavors
2013-08-26 21:45:10.222 31704 DEBUG tempest.common.rest_client [-] Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<Token omitted>'} _log_request /opt/stack/tempest/tempest/common/rest_client.py:295
2013-08-26 21:45:10.222 31704 DEBUG tempest.common.rest_client [-] Request Body: {"flavor": {"disk": 10, "vcpus": 1, "ram": 512, "name": "test_flavor_832042179", "id": 1663317675}} _log_request /opt/stack/tempest/tempest/common/rest_client.py:299
2013-08-26 21:45:10.628 31704 INFO tempest.common.rest_client [-] Response Status: 200
2013-08-26 21:45:10.628 31704 DEBUG tempest.common.rest_client [-] Response Headers: {'date': 'Mon, 26 Aug 2013 13:45:10 GMT', 'content-length': '369', 'content-type': 'application/json', 'x-compute-request-id': 'req-7ba21477-fda1-41f0-a782-3d58b05f293a'} _log_response /opt/stack/tempest/tempest/common/rest_client.py:310
2013-08-26 21:45:10.628 31704 DEBUG tempest.common.rest_client [-] Response Body: {"flavor": {"name": "test_flavor_832042179", "links": [{"href": "http://192.168.1.101:8774/v3/flavors/1663317675", "rel": "self"}, {"href": "http://192.168.1.101:8774/flavors/1663317675", "rel": "bookmark"}], "ram": 512, "ephemeral": "", "disabled": false, "vcpus": 1, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "disk": 10, "id": "1663317675"}} _log_response /opt/stack/tempest/tempest/common/rest_client.py:314

Ivan-Zhu (ivan-zhu)
description: updated
Changed in nova:
assignee: nobody → Christopher Yeoh (cyeoh-0)
Changed in nova:
importance: Undecided → High
status: New → Confirmed
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/43825

Changed in nova:
status: Confirmed → In Progress
Changed in nova:
importance: High → Medium
milestone: none → havana-rc1
tags: added: havana-rc-potential
Changed in nova:
milestone: havana-rc1 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/43825
Committed: http://github.com/openstack/nova/commit/840599bc2d496874e5e15639afa643fed1bbe3bb
Submitter: Jenkins
Branch: master

commit 840599bc2d496874e5e15639afa643fed1bbe3bb
Author: Chris Yeoh <email address hidden>
Date: Tue Aug 27 12:32:59 2013 +0930

    Fix V3 API flavor returning empty string for attributes

    Fixes cases where in the V3 API the ephemeral, swap and vcpus
    attributes for flavors were returned as the empty string
    when they had a value of 0. Also removes default setting for
    the disabled attribute as it is always set in the db.

    Fixes up some associated testcase data as it was using data which
    could not exist in the db.

    Change-Id: I90f48956411f792037b1cd744c4fa8d287f9e752
    Closes-Bug: #1216929

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
tags: added: havana-backport-potential
removed: havana-rc-potential
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
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.