Replace passing system_metadata to notification functions with instance.system_metadata usage

Bug #1764390 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Matt Riedemann

Bug Description

Both notify_usage_exists() [1] and info_from_instance() [2] functions used in the notification code path get the system_metadata passed in. Instead we should use the instance.system_metadata directly whenever it is possible.

[1] https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/compute/utils.py#L278
[2]https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/notifications/base.py#L382

Changed in nova:
importance: Undecided → Low
tags: added: notifications
Matt Riedemann (mriedem)
Changed in nova:
status: New → Triaged
Revision history for this message
Matt Riedemann (mriedem) wrote :

Looking at https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/compute/utils.py#L278 it looks like it is used in the case of rebuild:

https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/compute/manager.py#L3034

Which comes from conductor:

https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/conductor/manager.py#L982

Which comes from the API:

https://github.com/openstack/nova/blob/57d3b7093259b625672a98b0ff41643175f6cb82/nova/compute/api.py#L3080

In case the system_metadata changes because of a new image and it's properties...so I guess we should just remove the comment about being used in the docstring for notify_usage_exists().

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

Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/561724
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1c36654ad8eadfa4e0fca785b1a8a717de118b50
Submitter: Zuul
Branch: master

commit 1c36654ad8eadfa4e0fca785b1a8a717de118b50
Author: Matt Riedemann <email address hidden>
Date: Mon Apr 16 16:58:07 2018 -0400

    Remove vestigial system_metadata param from info_from_instance()

    The system_metadata argument to info_from_instance() was not used
    so it's removed in this change, along with all callers of that
    method, which goes quite a ways.

    Also, the docstring for the system_metadata argument to
    notify_usage_exists() is updated since it is passed in one
    specific place: rebuild with a new image. In that case, nova-api
    saves off the original instance system_metadata before resetting
    the system_metadata based on the new image to rebuild, which is
    then passed down through nova-conductor and nova-compute where
    it eventually gets used to override "image_meta" in the payload
    created in info_from_instance(). It's weird, yes, and essentially
    means that for legacy versioned notifications, the instance payload
    will always contain the image_meta for the instance before it's
    rebuilt with the new image, which is something we don't do for
    versioned notifications.

    Test test_local_delete_without_info_cache is removed since it's
    (1) weird in that it is doing mox-like stuff in a mock-based
    test and (2) the code it was meant to test from change
    Ie0bba032615d3da06cdd95b221beb37a9b8a377d no longer exists.

    Change-Id: Ia1820334dcaceca9d7fa874dd7c553fa1c5befec
    Closes-Bug: #1764390

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.0.0.0b2

This issue was fixed in the openstack/nova 18.0.0.0b2 development milestone.

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.