flavor-recreate-bug

Bug #1320754 reported by Yohei Matsuhashi
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Unassigned

Bug Description

I re-created a flavor that is the same 'flavorid' on before and after.

After re-creation, the flavor value of the instance, that created by the 'flavorid', was changed to the new flavor value.

Currently, the flavor value of the instance is refer to 'flavorid'. In this case, it should be refer to 'id', not 'flavorid'.

In database scheme, id is really unique but flavorid is perform the conflict.

Logs are here:

admin@host:~$ nova show vm1
+--------------------------------------+----------------------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------------------+
| NET1 network | 10.0.10.100 |
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | host1 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | host1 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000018 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2014-05-16T20:18:02.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2014-05-16T20:17:37Z |
| flavor | m1.test (10) | <- original
| hostId | 852bf49aacad06f83e406fe230f1e30e8f0ec73e1f142a5900a602be |
| id | bbd0b20d-2ab8-414a-8663-0288e2775013 |
| image | cirros (87a7ff8d-178c-4072-a57b-1d9817bbb70a) |
| key_name | - |
| metadata | {} |
| name | vm1 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default, default |
| status | ACTIVE |
| tenant_id | 177be698aaa4431aaf41c8012d597e7d |
| updated | 2014-05-16T20:18:02Z |
| user_id | bea0bdab5dfa4f99a1cbd0a8532df3c5 |
+--------------------------------------+----------------------------------------------------------------------+
gadmin@gtestcompute-172-16-227-7:~$ nova flavor-delete 10
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| 10 | m1.test | 1200 | 12 | 0 | | 8 | 1.0 | True |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
admin@host:~$ nova flavor-create m2.test 10 1200 12 8
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| 10 | m2.test | 1200 | 12 | 0 | | 8 | 1.0 | True |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
admin@host:~$ nova show vm1
+--------------------------------------+----------------------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------------------+
| NET1 network | 10.0.10.100 |
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | host1 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | host1 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000018 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2014-05-16T20:18:02.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2014-05-16T20:17:37Z |
| flavor | g2.test (10) | <- flavor is CHANGED to incorrect value!
| hostId | 852bf49aacad06f83e406fe230f1e30e8f0ec73e1f142a5900a602be |
| id | bbd0b20d-2ab8-414a-8663-0288e2775013 |
| image | cirros (87a7ff8d-178c-4072-a57b-1d9817bbb70a) |
| key_name | - |
| metadata | {} |
| name | vm1 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default, default |
| status | ACTIVE |
| tenant_id | 177be698aaa4431aaf41c8012d597e7d |
| updated | 2014-05-16T20:18:02Z |
| user_id | bea0bdab5dfa4f99a1cbd0a8532df3c5 |
+--------------------------------------+----------------------------------------------------------------------+

mysql> SELECT id,flavorid,name,deleted FROM instance_types WHERE name LIKE '%.test';
+----+----------+---------+---------+
| id | flavorid | name | deleted |
+----+----------+---------+---------+
| 6 | 10 | g1.test | 6 |
| 7 | 10 | g2.test | 0 |
+----+----------+---------+---------+

Tags: api
Tracy Jones (tjones-i)
tags: added: api
Thang Pham (thang-pham)
Changed in nova:
assignee: nobody → Thang Pham (thang-pham)
Revision history for this message
Thang Pham (thang-pham) wrote :

I have looked at this bug, and it seems that a possible solution might be to prevent a user from deleting a flavor that is in use. This is because it may cause problems as described above or resize problems. What is your opinion on it?

Changed in nova:
status: New → Confirmed
Revision history for this message
Yohei Matsuhashi (yohei-matsuhashi) wrote :

I would like to change parameters of the flavor, but nova flavor-update is not implemented yet. So I tried to re-create the flavor.

I have two suggestions:
1. prevent to delete a flavor while still in use. I agree with your solution.
2. implement flavor-update api

Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

I don't think you can have a flavor update api because it would make references from running servers to the flavor invalid. Looks like the fundamental problem is that there are some references to flavorid which should actually be to the unique id from InstanceType table instead

Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

So after having had a better look I think this is pretty hard to fix and will probably require an API change (probably backwards incompatible) to do so.

Internally we're good about always referencing the unique instance type id. So deletions and creations of flavors are fine. Servers always refer to the flavor that they were created with.

However we have this fake "flavor id" which is not unique in the instancetypes and we translate that back and forth when talking about flavor types with the client of the API. And the only way we communicate with client about flavors is this key which is not unique over time.

The long term solution is to change the interface so we only use a unique id through the API (probably a UUID). But thats a long term API change for the flavors API

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/107505

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Alex Xu (xuhj) wrote :

This is potential improve for api when we have micro-version.

Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Thang Pham (<email address hidden>) on branch: master
Review: https://review.openstack.org/107505
Reason: Abandoning patch, since there is no clean way to keep a unique flavor around via flavorid until we make an API change to support it.

Thang Pham (thang-pham)
Changed in nova:
assignee: Thang Pham (thang-pham) → nobody
status: In Progress → Confirmed
importance: Medium → Wishlist
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

This wishlist bug has been open a year without any activity. I'm going to move it to "Opinion / Wishlist", which is an easily-obtainable queue of older requests that have come on.

In case you want to work on that, consider writing a blueprints [1] and spec [2]. I'll recommend to read [3] if not yet done. The effort to implement the requested feature is then driven only by the blueprint (and spec).

References:
[1] https://blueprints.launchpad.net/nova/
[2] https://github.com/openstack/nova-specs
[3] https://wiki.openstack.org/wiki/Blueprints

Changed in nova:
status: Confirmed → Opinion
Revision history for this message
Shilpa Devharakar (shilpasd) wrote :
Download full text (19.9 KiB)

Verified on existing master branch and observed that defect is not getting reproduced.

Steps carried:

1. nova flavor-create b1.test 12 512 1 1
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+
| 12 | b1.test | 512 | 1 | 0 | | 1 | 1.0 | True |
+----+---------+-----------+------+-----------+------+-------+-------------+-----------+

2. nova boot --flavor 12 --image 74065058-ba54-4456-b937-eed84dc589ca test
+--------------------------------------+-----------------------------------------------------------------+
| Property | Value |
+--------------------------------------+-----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hostname | test |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | |
| OS-EXT-SRV-ATTR:kernel_id | |
| OS-EXT-SRV-ATTR:launch_index | 0 |
| OS-EXT-SRV-ATTR:ramdisk_id | |
| OS-EXT-SRV-ATTR:reservation_id | r-4ry42m2q |
| OS-EXT-SRV-ATTR:root_device_name | - |
| OS-EXT-SRV-ATTR:user_data | - |
| 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 | r7hZZCwaRgrN |
| config_drive | ...

Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :
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.