payload is empty when remove metadata with event updatemetadata.end

Bug #1269684 reported by Guangya Liu (Jay Lau)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Guangya Liu (Jay Lau)

Bug Description

liugya@liugya-ubuntu:~/src/nova-ce$ nova aggregate-set-metadata 1 a=a1
Aggregate 1 has been successfully updated.
+----+------+-------------------+-------+----------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+------+-------------------+-------+----------+
| 1 | agg1 | None | | 'a=a1' |
+----+------+-------------------+-------+----------+
liugya@liugya-ubuntu:~/src/nova-ce$ nova aggregate-set-metadata 1 a

(Pdb) n
> /opt/stack/nova/nova/objects/aggregate.py(100)update_metadata()
-> compute_utils.notify_about_aggregate_update(context,
(Pdb) n
> /opt/stack/nova/nova/objects/aggregate.py(101)update_metadata()
-> "updatemetadata.start",
(Pdb) n
> /opt/stack/nova/nova/objects/aggregate.py(102)update_metadata()
-> payload)
(Pdb) payload
{'meta_data': {u'a': None}, 'aggregate_id': 1}
(Pdb) n

> /opt/stack/nova/nova/objects/aggregate.py(118)update_metadata()
-> payload['meta_data'] = to_add
(Pdb)
> /opt/stack/nova/nova/objects/aggregate.py(119)update_metadata()
-> compute_utils.notify_about_aggregate_update(context,
(Pdb)
> /opt/stack/nova/nova/objects/aggregate.py(120)update_metadata()
-> "updatemetadata.end",
(Pdb)
> /opt/stack/nova/nova/objects/aggregate.py(121)update_metadata()
-> payload)
(Pdb) payload
{'meta_data': {}, 'aggregate_id': 1} <<< meta_data is empty, this caused 3rd party do not know which meta_data was now removed after get notification of updatemetadata.end

Changed in nova:
assignee: nobody → Jay Lau (jay-lau-513)
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/67018

Changed in nova:
status: New → In Progress
Revision history for this message
Matt Riedemann (mriedem) wrote :

This would also be a problem in Havana: https://review.openstack.org/#/c/43158/

tags: added: havana-backport-potential
Changed in nova:
importance: Undecided → Medium
milestone: none → juno-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit fd901be0c6718c26c078bb5ae85ba804b153833c
Author: Jay Lau <email address hidden>
Date: Fri Apr 25 16:03:40 2014 +0800

    Payload meta_data is empty when remove metadata

    When update metadata for a host aggregation, all of the values will
    be in the variable of "updates", if remove metadata, the format would
    be {"foo": None, "bar": None}; If adding metadata, the format would
    be {"foo": "foo1", "bar": "bar1"}.

    The current logic of update_metadata() is as following:
    1) Get all metadata from variable "updates".
    2) Traverse updates to see which values are new added and which needs
    to be removed. For the new added values, put the metadata to
    variable "to_add"; for the values which need to be removed, just
    remove them from metadata.
    3) Set the values of variable "to_add" as payload metadata.

    The above logic will make the values which was removed from metadata
    cannot be in payload, this caused the third party receiver cannot know
    which metadata was removed.

    The fix was always using the values from variable "updates" as the
    metadata for payload as it include values removed and new added.

    Change-Id: I7b78795e325f52cfb9c24eabd9ef42990666c02d
    Closes-Bug: #1269684

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-1 → 2014.2
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.