Bug 1324238

Summary: When a flavor ID has capital letters, booting a VM will fail with CLI but succeeds with dashboard
Product: Red Hat OpenStack Reporter: David Hill <dhill>
Component: python-novaclientAssignee: Diana Clarke <dclarke>
Status: CLOSED ERRATA QA Contact: Prasanth Anbalagan <panbalag>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0 (Kilo)CC: awaugama, berrange, dasmith, dclarke, dhill, eglynn, jruzicka, jschluet, kchamart, sbauza, sferdjao, sgordon, srevivo, vromanso, wlehman
Target Milestone: asyncKeywords: Reopened, ZStream
Target Release: 7.0 (Kilo)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-novaclient-2.23.0-4.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-13 14:48:58 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:

Description David Hill 2016-04-05 22:52:37 UTC
Description of problem:
When a flavor ID has capital letters, booting a VM will fail with CLI but succeeds with dashboard

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create a flavor with capital letters
2. Spawn a VM from dashboard
3. Spawn a VM from CLI

Actual results:
Fails

Expected results:
Succeeds

Additional info:
Test from Bomgar Session that shows problems when a capital letter is put in flavor id:

[stack@char ~]$ nova flavor-create test_heat_tool_kit auto 6144 50 4
+--------------------------------------+--------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID                                   | Name               | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+--------------------+-----------+------+-----------+------+-------+-------------+-----------+
| c503d38a-d187-4d5d-aa20-c7a0543bf67a | test_heat_tool_kit | 6144      | 50   | 0         |      | 4     | 1.0         | True      |
+--------------------------------------+--------------------+-----------+------+-----------+------+-------+-------------+-----------+
[stack@char ~]$
[stack@char ~]$ nova boot --flavor test_heat_tool_kit --image HeatToolKitVM --availability-zone nova --security-groups default --nic net-id=da8df118-6f11-417d-b27d-9abf0042fab6 --poll cli_test
+--------------------------------------+-----------------------------------------------------------+
| Property                             | Value                                                     |
+--------------------------------------+-----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                    |
| OS-EXT-AZ:availability_zone          | nova                                                      |
| OS-EXT-SRV-ATTR:host                 | -                                                         |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                         |
| OS-EXT-SRV-ATTR:instance_name        | instance-0000000b                                         |
| OS-EXT-STS:power_state               | 0                                                         |
| OS-EXT-STS:task_state                | -                                                         |
| OS-EXT-STS:vm_state                  | building                                                  |
| OS-SRV-USG:launched_at               | -                                                         |
| OS-SRV-USG:terminated_at             | -                                                         |
| accessIPv4                           |                                                           |
| accessIPv6                           |                                                           |
| adminPass                            | 8d4G9eCPKezQ                                              |
| config_drive                         |                                                           |
| created                              | 2016-04-05T22:32:20Z                                      |
| flavor                               | test_heat_tool_kit (c503d38a-d187-4d5d-aa20-c7a0543bf67a) |
| hostId                               |                                                           |
| id                                   | 73be6894-0f4f-4343-b6de-3cb142ee425b                      |
| image                                | HeatToolKitVM (a1526f08-063b-4716-9f3f-c965bf2721d1)      |
| key_name                             | -                                                         |
| metadata                             | {}                                                        |
| name                                 | cli_test                                                  |
| os-extended-volumes:volumes_attached | []                                                        |
| progress                             | 0                                                         |
| security_groups                      | default                                                   |
| status                               | BUILD                                                     |
| tenant_id                            | af554cb9ec3c40acb952bba22ab90220                          |
| updated                              | 2016-04-05T22:32:20Z                                      |
| user_id                              | 4e922b212993453bb3e64ed69b7432a4                          |
+--------------------------------------+-----------------------------------------------------------+

Server building... 100% complete
Finished



[stack@char ~]$ nova flavor-create testflavor testflavor 6144 50 4
+------------+------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID         | Name       | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+------------+------------+-----------+------+-----------+------+-------+-------------+-----------+
| testflavor | testflavor | 6144      | 50   | 0         |      | 4     | 1.0         | True      |
+------------+------------+-----------+------+-----------+------+-------+-------------+-----------+
[stack@char ~]$ nova boot --flavor testflavor --image HeatToolKitVM --availability-zone nova --security-groups default --nic net-id=da8df118-6f11-417d-b27d-9abf0042fab6 --poll cli_test2
+--------------------------------------+------------------------------------------------------+
| Property                             | Value                                                |
+--------------------------------------+------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                               |
| OS-EXT-AZ:availability_zone          | nova                                                 |
| OS-EXT-SRV-ATTR:host                 | -                                                    |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                    |
| OS-EXT-SRV-ATTR:instance_name        | instance-0000000c                                    |
| 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                            | cwMHo3y58vHt                                         |
| config_drive                         |                                                      |
| created                              | 2016-04-05T22:34:26Z                                 |
| flavor                               | testflavor (testflavor)                              |
| hostId                               |                                                      |
| id                                   | a97e6237-078d-4143-bd5b-d047dfac847d                 |
| image                                | HeatToolKitVM (a1526f08-063b-4716-9f3f-c965bf2721d1) |
| key_name                             | -                                                    |
| metadata                             | {}                                                   |
| name                                 | cli_test2                                            |
| os-extended-volumes:volumes_attached | []                                                   |
| progress                             | 0                                                    |
| security_groups                      | default                                              |
| status                               | BUILD                                                |
| tenant_id                            | af554cb9ec3c40acb952bba22ab90220                     |
| updated                              | 2016-04-05T22:34:26Z                                 |
| user_id                              | 4e922b212993453bb3e64ed69b7432a4                     |
+--------------------------------------+------------------------------------------------------+

Server building... 100% complete
Finished


[stack@char ~]$ nova flavor-create TestflavoRR TestflavoRR 6144 50 4
+-------------+-------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID          | Name        | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-------------+-------------+-----------+------+-----------+------+-------+-------------+-----------+
| TestflavoRR | TestflavoRR | 6144      | 50   | 0         |      | 4     | 1.0         | True      |
+-------------+-------------+-----------+------+-----------+------+-------+-------------+-----------+
[stack@char ~]$
[stack@char ~]$
[stack@char ~]$ nova boot --flavor TestflavoRR --image HeatToolKitVM --availability-zone nova --security-groups default --nic net-id=da8df118-6f11-417d-b27d-9abf0042fab6 --poll cli_test3
ERROR (BadRequest): The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400) (Request-ID: req-3c83cdcd-1446-45a4-8317-5eafba0471f2)
[stack@char ~]$

Comment 1 David Hill 2016-04-06 15:36:19 UTC
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi Traceback (most recent call last):
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 710, in post_process_extensions
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi     **action_args)
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/contrib/flavor_access.py", line 86, in show
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi     self._extend_flavor(resp_obj.obj['flavor'], db_flavor)
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/contrib/flavor_access.py", line 78, in _extend_flavor
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi     flavor_rval[key] = flavor_ref['is_public']
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi TypeError: 'NoneType' object has no attribute '__getitem__'
2016-04-05 22:35:53.312 10380 TRACE nova.api.openstack.wsgi

Comment 2 Diana Clarke 2016-04-07 16:53:37 UTC
I believe this bug was introduced in OSP7/Kilo and fixed in OSP8/Liberty based on my notes from a similar bug report a few months back.

  - The following upstream change introduced the bug in Kilo:

    https://bugs.launchpad.net/python-novaclient/+bug/1423885
    https://review.openstack.org/#/c/158270/10/novaclient/v2/shell.py

  - And the following upstream change fixed the bug in Liberty:

    https://bugs.launchpad.net/python-novaclient/+bug/1446850
    https://review.openstack.org/#/c/176106/1/novaclient/v2/shell.py

The workaround is to use lower case or numeric flavor IDs only until they upgrade to Liberty.

Comment 6 Diana Clarke 2016-04-07 20:12:16 UTC
I submitted an upstream patch for a backport to stable/kilo, but I suspect it won't merge because it's old_old_stable now that Mitaka is released.

  https://review.openstack.org/#/c/303051/

Comment 10 Prasanth Anbalagan 2016-07-05 20:51:53 UTC
Verified as follows,

*********
VERSION
*********

[root@serverA ~(keystone_admin)]# yum list installed | grep openstack-nova
openstack-nova-api.noarch                  2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-cert.noarch                 2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-common.noarch               2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-compute.noarch              2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-conductor.noarch            2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-console.noarch              2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-novncproxy.noarch           2015.1.4-8.el7ost       @RH7-RHOS-7.0
openstack-nova-scheduler.noarch            2015.1.4-8.el7ost       @RH7-RHOS-7.0
[root@serverA ~(keystone_admin)]# 


*******
LOGS
*******

[root@serverA ~(keystone_admin)]# nova flavor-create MyFlavoR 100 512 1 1 
+-----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID  | Name     | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-----+----------+-----------+------+-----------+------+-------+-------------+-----------+
| 100 | MyFlavoR | 512       | 1    | 0         |      | 1     | 1.0         | True      |
+-----+----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@serverA ~(keystone_admin)]# nova boot --flavor MyFlavoR --image cirros --nic net-id=c4c50776-1a75-4b1e-8ab7-0b3c3531f338  vm1
+--------------------------------------+-----------------------------------------------+
| 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                            | F3iWLM2yCHPn                                  |
| config_drive                         |                                               |
| created                              | 2016-07-05T20:46:27Z                          |
| flavor                               | MyFlavoR (100)                                |
| hostId                               |                                               |
| id                                   | f412e4b4-b69a-4ffb-8825-58387edc153e          |
| image                                | cirros (cd7f7c6d-64e0-4e67-a4b3-36de7ab7e761) |
| key_name                             | -                                             |
| metadata                             | {}                                            |
| name                                 | vm1                                           |
| os-extended-volumes:volumes_attached | []                                            |
| progress                             | 0                                             |
| security_groups                      | default                                       |
| status                               | BUILD                                         |
| tenant_id                            | ca832f0c3de342f89ea00a472ad3d6b5              |
| updated                              | 2016-07-05T20:46:27Z                          |
| user_id                              | 2c2ca6d2a11f454c81dec38ed4ed5c47              |
+--------------------------------------+-----------------------------------------------+
[root@serverA ~(keystone_admin)]# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------+
| ID                                   | Name | Status | Task State | Power State | Networks            |
+--------------------------------------+------+--------+------------+-------------+---------------------+
| f412e4b4-b69a-4ffb-8825-58387edc153e | vm1  | BUILD  | spawning   | NOSTATE     | public=172.24.4.227 |
+--------------------------------------+------+--------+------------+-------------+---------------------+
[root@serverA ~(keystone_admin)]# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------+
| ID                                   | Name | Status | Task State | Power State | Networks            |
+--------------------------------------+------+--------+------------+-------------+---------------------+
| f412e4b4-b69a-4ffb-8825-58387edc153e | vm1  | ACTIVE | -          | Running     | public=172.24.4.227 |
+--------------------------------------+------+--------+------------+-------------+---------------------+

Comment 12 errata-xmlrpc 2016-07-13 14:48:58 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://access.redhat.com/errata/RHBA-2016:1417