glance properties lookup for kernel_id, ramdisk_id, stage2_id does not work

Bug #2099953 reported by Doug Goldstein
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Doug Goldstein

Bug Description

I am attempting to use the Anaconda deploy interface which documents the ability to create a Glance image with properties such as kernel_id, ramdisk_id, and stage2_id that point to other Glance images for those pieces of data. The driver is currently unable to boot using this interface with a Glance image because today the way the code behaves is that it gets a Glance Image object from the SDK. Then it creates a dictionary and copies a number of top-level attributes to the dictionary. It then creates a 'properties' key in the dictionary and copies the remaining under the 'properties' key.

The issue is that the Glance Image object has the 'kernel_id', 'ramdisk_id', and 'stage2_id' under its 'properties' attribute as a dictionary. Which is then copied to the 'properties' key and not merged with it. Resulting in the data being at:

image_info['properties']['properties']['kernel_id'] = 'some value'
image_info['properties']['properties']['ramdisk_id'] = 'some value'
image_info['properties']['properties']['stage2_id'] = 'some value'

The validation logic then checks either the deploy_info or the image_info['properties'] for a key called 'kernel' or 'kernel_id' then 'ramdisk' or 'ramdisk_id' then only 'stage2_id'. This fails because 'stage2_id' cannot be found but doesn't fail for the other fields because they see the IPA kernel and ramdisk values as being present.

Changed in ironic:
status: New → In Progress
Afonne-CID (cidelight)
Changed in ironic:
assignee: nobody → Doug Goldstein (cardoe)
Afonne-CID (cidelight)
Changed in ironic:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.opendev.org/c/openstack/ironic/+/942496
Committed: https://opendev.org/openstack/ironic/commit/05734cfc95ad36ecf7325195077fe505ed33ae30
Submitter: "Zuul (22348)"
Branch: master

commit 05734cfc95ad36ecf7325195077fe505ed33ae30
Author: Doug Goldstein <email address hidden>
Date: Sat Feb 22 18:34:59 2025 -0600

    fix glance metadata layout

    The code here builds a dictionary from a glance v2 image object that
    roughly resembles the glance v2 image object. The current behavior
    nests the 'properties' set on the image under it's own 'properties' key
    resulting in the image properties never being seen by the Ironic code.
    The breakage results from the change from glanceclient to the SDK which
    changed the shape of the returned object. The glanceclient object shape
    was that of FakeImage while the SDK returns a Resource based object
    which includes attributes for all possible fields which are defined at
    the top-level of the object. Since the tests run against a different
    value they did not cature the failure. Just changing to the SDK object
    results in us copying all these new values to the properties dict which
    is definitely not the intention. For maximum compatibility to backport
    this filters any value not set from being set into properties and sets
    the rest. The broken path is any user of get_image_properties()
    (both copies from common/images and deploy_utils) checking for user
    supplied properties.

    Closes-Bug: 2099953
    Change-Id: I1842e2651fd2bd8455646db9a3a80c3b9ece5c97
    Signed-off-by: Doug Goldstein <email address hidden>

Changed in ironic:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (stable/2024.2)

Fix proposed to branch: stable/2024.2
Review: https://review.opendev.org/c/openstack/ironic/+/944306

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (stable/2024.2)

Reviewed: https://review.opendev.org/c/openstack/ironic/+/944306
Committed: https://opendev.org/openstack/ironic/commit/651d775370c4560deeb635c9596f8860d56921fa
Submitter: "Zuul (22348)"
Branch: stable/2024.2

commit 651d775370c4560deeb635c9596f8860d56921fa
Author: Doug Goldstein <email address hidden>
Date: Sat Feb 22 18:34:59 2025 -0600

    fix glance metadata layout

    The code here builds a dictionary from a glance v2 image object that
    roughly resembles the glance v2 image object. The current behavior
    nests the 'properties' set on the image under it's own 'properties' key
    resulting in the image properties never being seen by the Ironic code.
    The breakage results from the change from glanceclient to the SDK which
    changed the shape of the returned object. The glanceclient object shape
    was that of FakeImage while the SDK returns a Resource based object
    which includes attributes for all possible fields which are defined at
    the top-level of the object. Since the tests run against a different
    value they did not cature the failure. Just changing to the SDK object
    results in us copying all these new values to the properties dict which
    is definitely not the intention. For maximum compatibility to backport
    this filters any value not set from being set into properties and sets
    the rest. The broken path is any user of get_image_properties()
    (both copies from common/images and deploy_utils) checking for user
    supplied properties.

    Closes-Bug: 2099953
    Change-Id: I1842e2651fd2bd8455646db9a3a80c3b9ece5c97
    Signed-off-by: Doug Goldstein <email address hidden>
    (cherry picked from commit 05734cfc95ad36ecf7325195077fe505ed33ae30)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic 29.0.0

This issue was fixed in the openstack/ironic 29.0.0 Epoxy release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic 26.1.2

This issue was fixed in the openstack/ironic 26.1.2 Dalmatian release.

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.