deleted flavors no longer have extra_specs

Bug #1485767 reported by Sean Wilcox
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Low
Unassigned

Bug Description

When a flavor with extra_specs is deleted the extra_specs are marked as deleted as well. Instance built with the deleted flavor of course still point to the deleted flavor row. When looking up the extra_specs for the flavor associated with the instance none are returned as the lookup does not take into account deleted rows.

For example (running on devstack):

$ nova flavor-create --is-public true bar 23 8192 23 6
$ nova flavor-key 23 set foobar=baz

$ nova flavor-show 23
+----------------------------+---------------------------------+
| Property | Value |
+----------------------------+---------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 23 |
| extra_specs | {"zonecfg:brand": "solaris-kz"} |
| id | 23 |
| name | bar |
| os-flavor-access:is_public | True |
| ram | 8192 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 6 |
+----------------------------+---------------------------------+

$ nova flavor-delete 23 (yes there is a bug against this and probably shouldn't work... but good to show the problem)

$ nova flavor-show 23
+----------------------------+-------+
| Property | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 23 |
| extra_specs | N/A | <--- extra_specs are not set.
| id | 23 |
| name | bar |
| os-flavor-access:is_public | True |
| ram | 8192 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 6 |
+----------------------------+-------+

If you remove the deletion markings in the instance_type_extra_specs table for the row, then the extra_specs will show up. While it's not so much the nova flavor-show output above that creates a problem, its when code attempts to use an instance objects instance_type_id and nova.objects.flavor.Flavor.get_by_id() that the extra_specs are not loaded and therefor it appears there are no extra_specs for the flavor that the instance was created with.

Tags: db flavors
tags: added: flavors
tags: added: db
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

Confirmed.

The bug which is meant with

    "nova flavor-delete 23 (yes there is a bug against this [...]"

should be bug 1456196.

@Sean Wilcox: Excellent bug report!

Changed in nova:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
jichenjc (jichenjc) wrote :

I am curious why we should show a 'deleted' flavor ....
any info for that?

jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
jichenjc (jichenjc) wrote :

I think it's because we will remove this 'delete !=0 ' record ... I don't know how to change it due to not much knowledge in this area
will keep an eye on it

1035 instance_type = orm.relationship(InstanceTypes, backref="extra_specs",
1036 foreign_keys=instance_type_id,
1037 primaryjoin='and_('
1038 'InstanceTypeExtraSpecs.instance_type_id == InstanceTypes.id,'
1039 'InstanceTypeExtraSpecs.deleted == 0)')

Changed in nova:
assignee: jichenjc (jichenjc) → nobody
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/215133

Changed in nova:
assignee: nobody → jichenjc (jichenjc)
status: Confirmed → In Progress
Revision history for this message
jichenjc (jichenjc) wrote :

I will submit another patch for this to prevent read deleted flavor... which might also fix this problem

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by jichenjc (<email address hidden>) on branch: master
Review: https://review.openstack.org/215133
Reason: bp rejected....

Changed in nova:
assignee: jichenjc (jichenjc) → nobody
status: In Progress → Confirmed
Brandon Iz (iz-brandon)
Changed in nova:
assignee: nobody → Brandon Iz (iz-brandon)
Brandon Iz (iz-brandon)
Changed in nova:
assignee: Brandon Iz (iz-brandon) → nobody
Changed in nova:
assignee: nobody → Maciej Szankin (mszankin)
status: Confirmed → In Progress
Changed in nova:
status: In Progress → Confirmed
assignee: Maciej Szankin (mszankin) → nobody
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.