Bug 1989841

Summary: RFE: qemu-img cannot convert images into vmdk and vpc formats
Product: Red Hat Enterprise Linux 9 Reporter: Ondřej Budai <obudai>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: Storage QA Contact: Tingting Mao <timao>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: urgent    
Priority: urgent CC: areis, coli, jferlan, jinzhao, juzhang, kkiwi, kwolf, rjones, tgunders, timao, virt-maint, walters, ymankad
Version: 9.0Keywords: FutureFeature, Triaged
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-6.0.0-12.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:20:54 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ondřej Budai 2021-08-04 07:39:18 UTC
Description of problem:
osbuild-composer is a tool for building RHEL images on-premise for various cloud platforms. Different platforms support different image formats therefore we use qemu-img to convert a raw image into different formats. Unfortunately, qemu-img in RHEL 9 doesn't support converting into vpc (we need that for Azure), nor vmdk (we need that for VMware). This is currently a blocker for us - we need to ship this functionality to customers in RHEL 9.

We convert images into vpc and vmdk formats without any issues on RHEL 8.


Version-Release number of selected component (if applicable):
qemu-img-6.0.0-10.el9.x86_64

How reproducible:
100%

Step to Reproduce:
qemu-img convert -O vpc Fedora-Cloud-Base-34-1.2.x86_64.raw test.vhd

Actual results:
qemu-img: Could not open 'test.vhd': Driver 'vpc' can only be used for read-only devices

Expected results:
test.vhd file is created and contains the same content as the input file but in a different disk image format

Additional info:
The same reproducer applies also for vmdk.

Comment 2 Colin Walters 2021-08-04 15:30:46 UTC
Right now Fedora CoreOS and RHEL CoreOS use a Fedora-derived userspace to build our images in https://github.com/coreos/coreos-assembler/ but we've definitely talked about using a CS/RHEL userspace in the past, and this would definitely break us too.  (Eventually perhaps we'll also unify some tooling between Image Builder and coreos-assembler).

Perhaps we can gate things behind e.g. `env QEMU_IMG_ENABLE_UNSUPPORTED_BACKENDS=1 qemu-img convert -f vmdk ...`?

Comment 20 Tingting Mao 2021-08-23 02:59:04 UTC
Verified this bug as below:


Tested with:
qemu-kvm-6.0.0-12.el9
kernel-5.14.0-0.rc4.35.el9.x86_64


Steps:
1. Create a source raw image file
# qemu-img create -f raw test.img 5G

2. Convert it to a vmdk image file
# qemu-img convert -f raw -O vmdk test.img tgt.vmdk -p
    (100.00/100%)
# qemu-img info tgt.vmdk 
image: tgt.vmdk
file format: vmdk
virtual size: 5 GiB (5368709120 bytes)
disk size: 704 KiB
cluster_size: 65536
Format specific information:
    cid: 1957518512
    parent cid: 4294967295
    create type: monolithicSparse
    extents:
        [0]:
            virtual size: 5368709120
            filename: tgt.vmdk
            cluster size: 65536
            format: 

3. Convert to a vpc image file
# qemu-img convert -f raw -O vpc test.img tgt.vpc -p
    (100.00/100%)
# qemu-img info tgt.vpc 
image: tgt.vpc
file format: vpc
virtual size: 5 GiB (5368946688 bytes)
disk size: 16 KiB
cluster_size: 2097152


Results:
As above, converting all successed.

Comment 22 Yanan Fu 2021-08-23 06:45:57 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.