Can't unset a flavor-key

Bug #1340885 reported by Matthew Gilliard
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Thang Pham

Bug Description

I am able to set a flavor-key but not unset it. devstack sha1=fdf1cffbd5d2a7b47d5bdadbc0755fcb2ff6d52f

ubuntu@d8:~/devstack$ nova help flavor-key
usage: nova flavor-key <flavor> <action> <key=value> [<key=value> ...]

Set or unset extra_spec for a flavor.

Positional arguments:
  <flavor> Name or ID of flavor
  <action> Actions: 'set' or 'unset'
  <key=value> Extra_specs to set/unset (only key is necessary on unset)
ubuntu@d8:~/devstack$ nova flavor-key m1.tiny set foo=bar
ubuntu@d8:~/devstack$ nova flavor-show m1.tiny
+----------------------------+----------------+
| Property | Value |
+----------------------------+----------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 1 |
| extra_specs | {"foo": "bar"} |
| id | 1 |
| name | m1.tiny |
| os-flavor-access:is_public | True |
| ram | 512 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+----------------+
ubuntu@d8:~/devstack$ nova flavor-key m1.tiny unset foo
ubuntu@d8:~/devstack$ nova flavor-show m1.tiny
+----------------------------+----------------+
| Property | Value |
+----------------------------+----------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 1 |
| extra_specs | {"foo": "bar"} |
| id | 1 |
| name | m1.tiny |
| os-flavor-access:is_public | True |
| ram | 512 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+----------------+

Tags: api
Revision history for this message
Matthew Gilliard (matthew-gilliard-u) wrote :

nova sha1=031add7

Revision history for this message
Thang Pham (thang-pham) wrote :

I am seeing the same problem.

Changed in nova:
status: New → Confirmed
assignee: nobody → Thang Pham (thang-pham)
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/106603

Changed in nova:
status: Confirmed → In Progress
Thang Pham (thang-pham)
tags: added: api
Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → Medium
Thang Pham (thang-pham)
Changed in nova:
importance: Medium → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/106603
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ae744b4b60169f653d6bafba237593388266cb90
Submitter: Jenkins
Branch: master

commit ae744b4b60169f653d6bafba237593388266cb90
Author: Thang Pham <email address hidden>
Date: Sat Jul 12 20:52:43 2014 -0400

    Fix unset extra_spec for a flavor

    A flavor extra_specs key cannot be deleted using 'nova flavor-key'.
    Updates to a flavor's extra_specs are not being registered by
    NovaObject, such that when NovaObject.obj_what_changed is called,
    no changes in the extra_specs field are picked up. In order for
    changes in extra_specs to be picked up, the updated extra_specs
    has to be compared against the _orig_extra_specs. The same approach
    also applies to the flavor's projects, where the updated projects
    has to be compared against the _orig_projects.

    Also, if you delete the last remaining extra_specs key, nova would
    throw an sqlalchemy warning, i.e. 'SAWarning: The IN-predicate on
    "instance_type_extra_specs.key" was invoked with an empty sequence'.
    This was caused by calling db.flavor_extra_specs_update_or_create
    with an empty dict of keys to add or update. This patch fixes it
    calling db.flavor_extra_specs_update_or_create only on a non-empty
    dict of keys.

    Change-Id: Icea492134239296f1570b2a4208eb0868315aa5f
    Closes-Bug: #1340885

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.