Instance sanitization in InstanceMetadata causes metadata_for_config_drive to fail

Bug #1702150 reported by Claudiu Belu on 2017-07-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
High
Matt Riedemann

Bug Description

A recent patch [1] has merged in nova, which sanitizes the nova instance object, making it picklable. The sanitized instance object no longer has a _context attribute, which means that lazy-loading attributes are no longer loadable [2].

This can be an issue whenever a config drive has to be built for an instance, as InstanceMetadata.metadata_for_config_drive needs some unloaded attributes (device_metadata).

This issue has been seen to affect mostly rebuild, unshelve, rescue operations.

[1] https://review.openstack.org/#/c/478991/
[2] http://paste.openstack.org/show/614328/

Logs: http://64.119.130.115/nova/479245/1/Hyper-V_logs/c2-r21-u36-n02-compute02/nova-compute.log.gz

Matt Riedemann (mriedem) on 2017-07-06
tags: added: api metadata
Changed in nova:
status: New → Triaged
importance: Undecided → High
Matt Riedemann (mriedem) on 2017-07-06
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)

Fix proposed to branch: master
Review: https://review.openstack.org/481235

Changed in nova:
status: Triaged → In Progress
Matt Riedemann (mriedem) wrote :

Dan Smith posted a similar patch on 6/30: https://review.openstack.org/#/c/479325/

And Claudiu posted this: https://review.openstack.org/#/c/479335/

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

commit 004d5ed1f3e35d43dc5726aa80d31429b931bd45
Author: Matt Riedemann <email address hidden>
Date: Thu Jul 6 16:56:02 2017 -0400

    Pre-load instance.device_metadata in InstanceMetadata

    Change Ie7d97ce5c62c8fb9da5822590a64210521f8ae7a orphans
    the Instance object so that we can pickle it. However,
    this means we can't lazy-load any attributes that we need
    when building up metadata, like when building the config
    drive during server create. We need to pre-load the
    device_metadata field so it's available when building
    the config drive.

    This isn't a problem for the libvirt driver since it
    loads device_metadata before building the config drive,
    but the hyperv driver doesn't do that, so the change
    above breaks hyperv when there are device tags without
    this fix.

    Change-Id: I08b905d2734ff9d484b373369f36d48c4d056fd8
    Closes-Bug: #1702150

Changed in nova:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers