Instance sanitization in InstanceMetadata causes metadata_for_config_drive to fail

Bug #1702150 reported by Claudiu Belu on 2017-07-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
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.



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

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

Dan Smith posted a similar patch on 6/30:

And Claudiu posted this:

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

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers