image_utils: misleading log message

Bug #2008043 reported by Brian Rosmaita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Low
Winicius Allan

Bug Description

The image_utils.get_qemu_data() function makes a call out to qemu-img in a try block, and if a ProcessExecutionError is raised, a message is logged saying that qemu-img is not installed:
https://opendev.org/openstack/cinder/src/commit/a92aa06e463f6322e8abdc2f570a801ea82dd1cb/cinder/image/image_utils.py#L655

During testing for Bug #1996188, Luigi noticed that if you are using a VMDK with a named extent where the named file isn't available, the call to qemu-img will return an error code that gets propagated up to image_utils as a ProcessExecutionError. You can make this happen by generating a VMDK like this:

$ qemu-img create -f vmdk mono.vmdk 1M -o subformat=monolithicFlat

This will create 2 files: mono.vmdk and mono-flat.vmdk. (mono.vmdk is the VMDK image; mono-flat.vmdk is the named extent holding the data.)

If you put mono.vmdk in glance, and then create a volume that contains the image, the volume will go to 'error' status, and you'll see something like this in the log:

2023-02-15 15:42:32.242 66 ERROR oslo_messaging.rpc.server ImageUnacceptable: Image 9f9449d8-c56a-4110-b0c0-30dc1f37fb67 is unacceptable: qemu-img is not installed and image is of type False. Only RAW images can be used if qemu-img is not installed.

We actually don't know that qemu-img is not installed. This is what happens when you ask qemu-img to give you info about the image (when mono-flat.vmdk is not present, which it isn't in glance):

$ qemu-img info --output=json mono.vmdk
qemu-img: Could not open 'mono.vmdk': Could not open 'mono-flat.vmdk': No such file or directory

$ echo $?
1

Since the call returns an error code, processutils will raise a ProcessExecutionError, even though qemu-img is in fact present.

Changed in cinder:
importance: Low → Medium
importance: Medium → Low
Revision history for this message
Charity Kithaka (charkith) wrote :

Hey @lsofia-enriquez can I work on this?

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

@charkith: Go ahead and assign this bug to yourself while you are looking into it. (You can always un-assign yourself later if you change your mind.) The key thing is that we don't want to duplicate efforts by having multiple people working on it simultaneously (unless they are collaborating).

Revision history for this message
Charity Kithaka (charkith) wrote :

Hey @brian-rosmaita that's okay.
I am an outreachy participant. Will work on it.

Changed in cinder:
assignee: nobody → Winicius Allan (winiciusallan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/905608

Changed in cinder:
status: Triaged → In Progress
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.