format_inspector reports a safety violation on DIB_build kernels of IPA images

Bug #2086810 reported by Dmitry Tantsur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Triaged
Medium
Unassigned
oslo.utils
New
Undecided
Unassigned

Bug Description

Reproducer:

1) Download https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos9-master.kernel
2)

>>> from oslo_utils.imageutils import format_inspector as fi
>>> fi.detect_file_format('ipa-centos9-master.kernel').safety_check()
Safety check mbr on gpt failed because MBR PTE 0 has invalid boot flag
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dtantsur/Projects/ironic-python-agent/.tox/py3/lib/python3.12/site-packages/oslo_utils/imageutils/format_inspector.py", line 430, in safety_check
    raise SafetyCheckFailed(failures)
oslo_utils.imageutils.format_inspector.SafetyCheckFailed: Safety checks failed: mbr

I'm not sure why the kernel is treated as a GPT file (I confirmed the same with a tinyCoreLinux kernel, which, interestingly, pass the safety check). It's definitely a problem for Ironic that this image fails. I don't know if it needs to be fixed in Ironic (by bypassing the checks for kernels/ramdisks) or in Oslo, so reporting in both.

Revision history for this message
Dmitry Tantsur (divius) wrote :

As a workaround on the Ironic side, we can probably disable the safety checks for TFTPImageCache.

Revision history for this message
Jay Faulkner (jason-oldos) wrote :

Documenting some useful IRC conversation:

<dansmith> dtantsur: still on that call, but.. the reason it's being detected as GPT is because it *is* a GPT (mbr).. the x86 "bootable" self-uncompressing images have a boot record, partition table, and executable code at the front
<dtantsur> dansmith: yeah, TheJulia already brought me these shocking news :) Then I guess the validator should not fail on them?
<dansmith> dtantsur: so on the one hand, it would be best to be storing these in a "raw" and treating them as such, never running any qemu commands on them and thus not needing to do a safety check on them
<dansmith> on the other, the thing failing is because they don't have one of the partitions marked as bootable, which is just a sort of sanity check I added because it *should* be set right, but we could remove that check
<dansmith> but it'll mean you detect it as a gpt (which it is)
<dansmith> my goal with this stuff is to get people to stop treating things that aren't disk images as disk images, and vice versa
<dtantsur> it's a fair call, too
<dansmith> I want nova to basically only allow kernel/ramdisk to be in 'raw' and not allow disk images to be in 'raw'
<dansmith> so we'll use qemu tools on gpt,qcow2, etc, and allow those to be hooked up as disks,
<dansmith> but things that are not disk images are just payload data, stored in raw, and not allowed to be "booted"
<dansmith> also, the oslo one can expose *which* checks failed, so if you can't distinguish between real GPT disk images and kernels, you could potentially use that failure to indicate "okay, we'll ignore this check failure but we won't let you treat this like a bootable image as a result"

Based on this information; it sounds like this is probably INVALID for oslo.utils and is instead an Ironic 'bug' (in an implementation that hasn't been completed, so probably not a bug at all?).

Afonne-CID (cidelight)
Changed in ironic:
status: New → Triaged
Afonne-CID (cidelight)
Changed in ironic:
importance: Undecided → Medium
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.