Incorrect dropping of image meta properties not wanted for snapshotting

Bug #1459760 reported by Daniel Berrange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Daniel Berrange

Bug Description

Back in July 20, there was a 'non_inheritable_image_properties' flag added which filtered out a couple of image metadata properties when the XenAPI driver uploaded images to glance.

commit ae7adbb92babf2dfc928daa76474aaba8e325d9c
Author: Rick Harris <email address hidden>
Date: Fri Jul 20 22:35:10 2012 +0000

    Adds non_inheritable_image_properties flag.

    Some image-properties should not be inherited from the instance when
    taking a snapshot because we want that functionality to only available
    for the base-image, not subsequent snapshots.

    As an example, we would like 'cache_in_nova' fast-cloning to be
    available just for base-images and not customer snapshots created off a
    base-image.

    This patch adds a new configuration which allows operators to, at
    runtime, select which image-properties should not be inherited by newly
    created snapshots.

    Change-Id: I8d7781b05ffd71a59ba69fb7c3df4616cba94cce

Although these properties were only really relevant to XenAPI, the logic was then moved into the compute manager api code for creating snapshots

commit 1c68e733ca0e536ea95ac982d1b4b43ed143b3e2
Author: Kevin L. Mitchell <email address hidden>
Date: Thu Oct 4 16:23:14 2012 -0500

    Move snapshot image property inheritance

    The xenapi snapshotting code had support for inheriting properties
    from the base image of the snapshot (by way of the system metadata
    set on the snapshotted instance). The problem, however, came in the
    fact that some image properties were set in nova.compute.api, but
    those properties were not excluded from this inheritance logic
    except through a configuration option called
    "non_inheritable_image_properties". I had previously updated the
    default setting for this option to work around the bugs introduced
    by setting image properties in two different locations, but now it
    is time for the real fix.

    This change moves the inheritance logic into
    nova.compute.api:API._create_image. Note that two properties are
    still set through the xenapi snapshotting logic: the "os_type" and
    the "auto_disk_config" properties, which are presumed to be xenapi
    specific. The change also alters the inheritance logic to ensure
    that the work-around listing of image properties in
    non_inheritable_image_properties is no longer necessary; the
    default for this configuration option is updated accordingly.

    (Note: It will not harm anything to have these image properties
    still listed in non_inheritable_image_properties, so configurations
    that override this option do not need to be altered.)

    Change-Id: I3514da432cc10c75418e1de9752f60640d579136

Next up in

commit 8e575be75c80ea71a6ad8fb73e6ace1ed708938f
Author: Xavier Queralt <email address hidden>
Date: Mon Aug 26 22:53:03 2013 +0200

    Add methods to get image metadata from instance

    This patch adds a couple of utility functions that enclose all the logic
    for getting and parsing the image metadata stored in the instance's
    system metadata.

    First, this will try to fetch the metadata from the real image and will
    prevent it from failing if it is not available. It will be then merged
    with the image metadata stored during the instance creation.

    Related to bug #1039662

    Change-Id: I2130caf19858585571b1199e27f0a98ad5f08701

The nova.utils.get_image_from_system_metadata() method added in this commit includes the logic from the compute api create_image method to drop image metadata properties listed in CONF.non_inheritable_image_properties.

Finally many areas of the codebase are updated to use nova.utils.get_image_from_system_metadata (or nova.compute.utils.get_image_metadata) in this commit:

commit 4389f2292a0177c8eedc0a398ceb3c5535a9ef82
Author: Xavier Queralt <email address hidden>
Date: Mon Aug 26 22:55:46 2013 +0200

    Avoid errors on some actions when image not usable

    Using the metadata saved on instance creation, we can now get all the
    image related metadata we need from the instance itself.

    This patch replace the logic for getting the image metadata on some
    actions that shouldn't fail when the image is not accessible (create
    an snapshot, resize, migrate, rescue an instance or attach an
    interface).

    Fixes bug 1039662

    Change-Id: Id8c2f13ca96908317d271a84fd685104b64f87e9

This is a mistake, because the CONF.non_inheritable_image_properties config property was *only* intended to filter out image properties when uploading snapshot images. It is now filtering out properties in a great many non-snapshot related code paths. For example, when hot-plugging a network interface to a running guest, it filters out image properties that might be needed.

tags: added: compute xenserver
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/187250

Changed in nova:
assignee: nobody → Daniel Berrange (berrange)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 9fc47e63466f7e7e0e60edaca22e4118bf6a83af
Author: Daniel P. Berrange <email address hidden>
Date: Fri May 29 11:03:02 2015 +0100

    compute: only use non_inheritable_image_properties if snapshotting

    The CONF.non_inheritable_image_properties parameter lists a set of
    image metadata properties that should be discarded when uploading
    an image to glance during the snapshotting process.

    This property is currently applied in the nova.utils method
    get_image_from_system_metadata(), which causes the properties in
    question to be discarded in a wide variety of non-snapshotting
    related operations.

    This is a regression caused by two commits:

      commit 8e575be75c80ea71a6ad8fb73e6ace1ed708938f
      Author: Xavier Queralt <email address hidden>
      Date: Mon Aug 26 22:53:03 2013 +0200

        Add methods to get image metadata from instance

      commit 4389f2292a0177c8eedc0a398ceb3c5535a9ef82
      Author: Xavier Queralt <email address hidden>
      Date: Mon Aug 26 22:55:46 2013 +0200

        Avoid errors on some actions when image not usable

    Which moved handling of CONF.non_inheritable_image_properties out
    of the compute API _create_image() method, and into nova.utils.

    Fix this by moving the handing back into the compute API in its
    original location.

    Closes-bug: #1459760
    Change-Id: Id630fe68678c4aa469ddbfdb3c757b264519e918

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