Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1101293

Summary: If anyone create private flavor then, it do not appear in "nova flavor-list" command but, it appears if we pass "--all" flag with the command. Also, we cant use flavor name while creating instance but, it accepts the flavor ID.
Product: Red Hat OpenStack Reporter: Pratik Pravin Bandarkar <pbandark>
Component: python-novaclientAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: nlevinki <nlevinki>
Severity: low Docs Contact:
Priority: high    
Version: 4.0CC: calba, jruzicka, lyarwood, ndipanov, sclewis, sgordon, slong, yeylon
Target Milestone: z3Keywords: TestOnly, ZStream
Target Release: 6.0 (Juno)   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-novaclient-2.20.0-1.el7ost Doc Type: Bug Fix
Doc Text:
Previously, only public flavours were considered when looking up a flavour based on name. It was therefore not possible to boot an image using a private flavour's name, even if it was accessible to the tenant user. The user had to boot the image using the flavour ID instead of its name. With this update, the flavour name lookup has been changed to consider all accessible flavours, not just public ones. The name of any flavour to which the tenant user has permission to access can now be used when booting an instance.
Story Points: ---
Clone Of:
: 1212608 1212609 (view as bug list) Environment:
Last Closed: 2015-05-05 13:29:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1212608, 1212609    
Attachments:
Description Flags
nova with debug output none

Description Pratik Pravin Bandarkar 2014-05-26 16:20:15 UTC
Description of problem:
If anyone create private flavor then, it do not appear in "nova flavor-list" command but, it appears if we pass "--all" flag with the command. Also, we cant use flavor name while creating instance but, it accepts the flavor ID.

---->o--->o----
[root@controller ~(keystone_admin)]# nova flavor-create --is-public False test1234 21 2048 20 1
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name     | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| 21 | test1234 | 2048      | 20   | 0         |      | 1     | 1.0         | False     |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+

[root@controller ~(keystone_admin)]# nova flavor-list
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                   | Name          | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| 1                                    | m1.tiny       | 512       | 1    | 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      |
| 39914232-72dc-4904-a4bc-8b58a7f8bf68 | pbandark_test | 1024      | 50   | 2         | 500  | 1     | 1.0         | False     |
| 4                                    | m1.large      | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5                                    | m1.xlarge     | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+


But, "test1234" flavor appears if we pass "--all" flag with "nova flavor-list" command.

[root@controller ~(keystone_admin)]# nova flavor-list --all
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                   | Name          | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+
| 1                                    | m1.tiny       | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2                                    | m1.small      | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 21                                   | test1234      | 2048      | 20   | 0         |      | 1     | 1.0         | False     |  <======
| 3                                    | m1.medium     | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 39914232-72dc-4904-a4bc-8b58a7f8bf68 | pbandark_test | 1024      | 50   | 2         | 500  | 1     | 1.0         | False     |
| 4                                    | m1.large      | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5                                    | m1.xlarge     | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+--------------------------------------+---------------+-----------+------+-----------+------+-------+-------------+-----------+
====

If we try to create any instance using flavor Name:

[root@controller ~(keystone_admin)]# nova boot --flavor test1234 --image cb272dd7-a9a8-41ab-bf25-5f791acc60e7 test_vm
ERROR: No flavor with a name or ID of 'test1234' exists.

Operation is successful if we create instance using flavor ID:

[root@controller ~(keystone_admin)]# nova boot --flavor 21 --image cb272dd7-a9a8-41ab-bf25-5f791acc60e7 --nic  net-id=2190cc4c-e837-4a50-b207-81d68b7d15b8 test_vm 
+--------------------------------------+--------------------------------------+
| Property                             | Value                                |
+--------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state                | scheduling                           |
| image                                | RHEL                                 |
| OS-EXT-STS:vm_state                  | building                             |
[...]


----o<----o<----


Version-Release number of selected component (if applicable):
[root@controller ~(keystone_admin)]# rpm -qa|grep -i nova
openstack-nova-cert-2013.2.2-2.el6ost.noarch
python-nova-2013.2.2-2.el6ost.noarch
openstack-nova-scheduler-2013.2.2-2.el6ost.noarch
openstack-nova-console-2013.2.2-2.el6ost.noarch
python-novaclient-2.15.0-3.el6ost.noarch
openstack-nova-common-2013.2.2-2.el6ost.noarch
openstack-nova-novncproxy-2013.2.2-2.el6ost.noarch
openstack-nova-api-2013.2.2-2.el6ost.noarch
openstack-nova-conductor-2013.2.2-2.el6ost.noarch



How reproducible:
100%


Actual results:
- Private flavor do not appear in "nova flavor-list" command.
- We cant use flavor name while creating instance.

Expected results:
private flavors should listed with "nova flavor-list" command. Also, we should be able to use flavor name while creating instances.

Additional info:

Comment 3 Pratik Pravin Bandarkar 2014-05-26 16:25:08 UTC
Created attachment 899330 [details]
nova with debug output

Comment 4 Daniel Berrangé 2014-06-05 16:52:02 UTC
The following change to nova client would fix both these problems, however, it is a change in semantics of the default client behaviour. Given the semantic change, I need to take this upstream first to get agreement before we can change it in RHOS

$ git diff
diff --git a/novaclient/v1_1/flavors.py b/novaclient/v1_1/flavors.py
index c47c476..b1e7d59 100644
--- a/novaclient/v1_1/flavors.py
+++ b/novaclient/v1_1/flavors.py
@@ -101,7 +101,7 @@ class FlavorManager(base.ManagerWithFind):
     resource_class = Flavor
     is_alphanum_id_allowed = True
 
-    def list(self, detailed=True, is_public=True):
+    def list(self, detailed=True, is_public=None):
         """
         Get a list of all flavors.

Comment 5 Daniel Berrangé 2014-06-30 15:09:54 UTC
Upstream fix is

commit d17253b29a5b7b422538c6496239cf713be627a3
Author: Daniel P. Berrange <berrange>
Date:   Fri Jun 6 14:23:17 2014 +0100

    Look for all accessible flavors by default, not just public ones
    
    The Nova server will restrict unprivileged user accounts to just
    public images, while allowing administrator accounts access to
    all. The Nova client shouldn't force the flavor name lookup to
    be restricted to just public images, since that breaks the ability
    to the flavor name when booting an instance
    
    Fixes bug #1327212
    
    Change-Id: I949aec52660242249b8cba51d77bfdc1acaf31d2


NB, this only fixes the 2nd part of the reporters problem.

ie it makes it possible to use the name of a private image with nova boot & similar commands. eg

# nova boot --flavor test1234 --image cb272dd7-a9a8-41ab-bf25-5f791acc60e7 test_vm

should now work.

Nova flavor-list will *still* require the --all flag to be passed to see private flags. The need for this --all flag was an explicit decision upstream, not a bug.

Comment 6 Jakub Ruzicka 2014-08-13 13:09:34 UTC
This fix is included upstream novaclient 2.18.0 and it's going to be included in next Juno novalcient update.

Comment 11 nlevinki 2015-04-26 13:22:15 UTC
Nova flavor-list will *still* require the --all flag to be passed to see private flags. The need for this --all flag was an explicit decision upstream, not a bug.
nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 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      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@dhcp-2-211 ~(keystone_admin)]# nova flavor-create --is-public False test1234 21 2048 20 1
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name     | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| 21 | test1234 | 2048      | 20   | 0         |      | 1     | 1.0         | False     |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@dhcp-2-211 ~(keystone_admin)]# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 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      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@dhcp-2-211 ~(keystone_admin)]# nova flavor-list --all
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 21 | test1234  | 2048      | 20   | 0         |      | 1     | 1.0         | False     |
| 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      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@dhcp-2-211 ~(keystone_admin)]# glance image-list
+--------------------------------------+--------+-------------+------------------+----------+--------+
| ID                                   | Name   | Disk Format | Container Format | Size     | Status |
+--------------------------------------+--------+-------------+------------------+----------+--------+
| fc4450fa-82bd-4d56-8087-340103dfe5af | cirros | qcow2       | bare             | 13200896 | active |
+--------------------------------------+--------+-------------+------------------+----------+--------+
[root@dhcp-2-211 ~(keystone_admin)]# nova boot --flavor test1234 --image fc4450fa-82bd-4d56-8087-340103dfe5af nati1
+--------------------------------------+-----------------------------------------------+
| Property                             | Value                                         |
+--------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                        |
| OS-EXT-AZ:availability_zone          |                                               |
| OS-EXT-SRV-ATTR:host                 | -                                             |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                             |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000001                             |
| OS-EXT-STS:power_state               | 0                                             |
| OS-EXT-STS:task_state                | scheduling                                    |
| OS-EXT-STS:vm_state                  | building                                      |
| OS-SRV-USG:launched_at               | -                                             |
| OS-SRV-USG:terminated_at             | -                                             |
| accessIPv4                           |                                               |
| accessIPv6                           |                                               |
| adminPass                            | dpT4agiP5b4u                                  |
| config_drive                         |                                               |
| created                              | 2015-04-26T13:20:30Z                          |
| flavor                               | test1234 (21)                                 |
| hostId                               |                                               |
| id                                   | f6f2ed4d-82cc-4934-8d2f-6a1ee63e6fa9          |
| image                                | cirros (fc4450fa-82bd-4d56-8087-340103dfe5af) |
| key_name                             | -                                             |
| metadata                             | {}                                            |
| name                                 | nati1                                         |
| os-extended-volumes:volumes_attached | []                                            |
| progress                             | 0                                             |
| security_groups                      | default                                       |
| status                               | BUILD                                         |
| tenant_id                            | 8d08c9e81401414291a04d978fa355c8              |
| updated                              | 2015-04-26T13:20:30Z                          |
| user_id                              | 04fe018bd8bb428c8edb732ae3fdd704              |
+--------------------------------------+-----------------------------------------------+
[root@dhcp-2-211 ~(keystone_admin)]# nova list
+--------------------------------------+-------+--------+------------+-------------+---------------------+
| ID                                   | Name  | Status | Task State | Power State | Networks            |
+--------------------------------------+-------+--------+------------+-------------+---------------------+
| f6f2ed4d-82cc-4934-8d2f-6a1ee63e6fa9 | nati1 | BUILD  | spawning   | NOSTATE     | public=172.24.4.227 |
+--------------------------------------+-------+--------+------------+-------------+---------------------+
[root@dhcp-2-211 ~(keystone_admin)]# nova list
+--------------------------------------+-------+--------+------------+-------------+---------------------+
| ID                                   | Name  | Status | Task State | Power State | Networks            |
+--------------------------------------+-------+--------+------------+-------------+---------------------+
| f6f2ed4d-82cc-4934-8d2f-6a1ee63e6fa9 | nati1 | ACTIVE | -          | Running     | public=172.24.4.227 |
+--------------------------------------+-------+--------+------------+-------------+---------------------+
[root@dhcp-2-211 ~(keystone_admin)]#

Comment 13 errata-xmlrpc 2015-05-05 13:29:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0931.html