'nova list --flavor <id>' outputs the same empty list, even if there is not any instance or flavor.

Bug #1076863 reported by Ken'ichi Ohmichi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Ken'ichi Ohmichi

Bug Description

'nova list --flavor <id>' command outputs empty list, if there is not
any instance or flavor. A user cannot know the reason of empty list easily.

The attached patch changes a response to error if the specified flavor-id does not
exist instead of empty list.

 Example:
     $ 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 | {} |
     +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

 Before applying this patch:
     $ nova list --flavor 10

     $

 After applying this patch:
     $ nova list --flavor 10
     ERROR: Flavor could not be found (HTTP 400) (Request-ID: req-2d03cd43-880b-465b-9be1-892cc37e536d)
     $

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :
Yaguang Tang (heut2008)
Changed in nova:
status: New → Confirmed
Revision history for this message
Yaguang Tang (heut2008) wrote :

you can submit a patch for this . follow http://wiki.openstack.org/HowToContribute to be an openstack contributer.

tags: added: low-hanging-fruit
Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

Hi Yaguang,

Thank you for the addvice.
I submitted the following:
https://review.openstack.org/#/c/15871/

Changed in nova:
assignee: nobody → Ken'ichi Ohmichi (oomichi)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/15871
Committed: http://github.com/openstack/nova/commit/a19d64808f3c4ab1cc3306ac3678701d0fff3e87
Submitter: Jenkins
Branch: master

commit a19d64808f3c4ab1cc3306ac3678701d0fff3e87
Author: Ken'ichi Ohmichi <email address hidden>
Date: Tue Nov 20 01:24:48 2012 +0000

    Return an error response if the specified flavor does not exists. (v4)

    'nova list --flavor <id>' command outputs empty list, if there is not
    any instance or flavor. A user cannot know the reason of empty list easily.
    This patch changes a response to error if the specified flavor-id does not
    exist instead of empty list.

    Example:
     $ 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 | {} |
     +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

    Before applying this patch:
     $ nova list --flavor 10

     $

    After applying this patch:
     $ nova list --flavor 10
     ERROR: Flavor could not be found (HTTP 422) (Request-ID: req-003d4bbc-f338-4361-9eeb-1cf18073a5a8)
     $

    Changelog of v4:
     * Change a response code of NotFoundFlavor from 404 to 422.

    Changelog of v3:
     * Merge patchset2(change a response of test_get_all_by_flavor) into one patch.
     * Change a response code of NotFoundFlavor from 400 to 404.

    Fixes bug 1076863
    Change-Id: I45f35ae6a4bf1de734c258ef819fb9b4d7f9681e

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.

Other bug subscribers

Remote bug watches

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