Can not show a private flavor by using "flavor show" command

Bug #1575478 reported by aohuanxuan on 2016-04-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Medium
aohuanxuan

Bug Description

The "flavor show" command can not show a private flavor.
For example:
(openstack) flavor create test --private
+----------------------------+--------------------------------------+
| Field | Value |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 0 |
| id | bdbcc4fd-f0f5-4c7f-8191-db5a90bf234a |
| name | test |
| os-flavor-access:is_public | False |
| ram | 256 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+--------------------------------------+
(openstack) flavor show test
No flavor with a name or ID of 'test' exists.
(openstack)

aohuanxuan (huanxuan-ao) on 2016-04-27
Changed in python-openstackclient:
assignee: nobody → aohuanxuan (huanxuan-ao)

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

Changed in python-openstackclient:
status: New → In Progress
Changed in python-openstackclient:
importance: Undecided → Medium

Reviewed: https://review.openstack.org/311700
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=681d6dc2de83ef13b4fb2fb4abe70f3c1ccb0e10
Submitter: Jenkins
Branch: master

commit 681d6dc2de83ef13b4fb2fb4abe70f3c1ccb0e10
Author: Huanxuan Ao <email address hidden>
Date: Mon May 2 16:30:29 2016 +0800

    Make "flavor show" command to show a private flavor properly

    The "flavor show" command could not show a
    private flavor by flavor name becauce it could
    not find a private flavor by flavor name.
    In "until.find_resource(parsed_args.flavor)",
    If parsed_args.falvor is a name of a flavor,
    "flavors.find(name=parsed_args.flavor)"will be
    called to find a flavor.But the default value of
    "is_public" is "Ture" in "flavors.find()" so that
    we can only find public flavors.If we want to find
    all flaovrs by flavor name,we should add
    "is_public=None" in "flavors.find()".

    So I tried to change
    "until.find_resource(parsed_args.flavor)" to
    "until.find_resource(parsed_args.flavor, is_public=None)",
    but then I could not find any flavor by flavor id
    because "is_public" is an unexpected argument of
    "flavors.get()" in "until.find_resource()".

    In this case,I think "until.find_resource()"
    can not find a private flavor properly,and
    we should combine "manager.get(flavor.id)" and
    "manager.find(name=flavor.name, is_public=None)"
    by ourselve to find a flavor.

    Also,this bug affects other flavor commands like
    "flavor set/unset/delete",so I fix them in this patch too.

    Change-Id: I4a4ed7b0a2f522ee04d1c3270afcda7064285c39
    Closes-Bug: #1575478

Changed in python-openstackclient:
status: In Progress → Fix Released

This issue was fixed in the openstack/python-openstackclient 2.5.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers