Bug 2026199

Summary: virt-v2v: error: <disk><driver type="format"> attribute is missing from the libvirt XML
Product: Red Hat Enterprise Linux 8 Reporter: Xiaodai Wang <xiaodwan>
Component: libvirtAssignee: Jaroslav Suchanek <jsuchane>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.6CC: dyuan, hongzliu, jen, jsuchane, juzhou, kkiwi, lersek, mxie, pkrempa, rjones, tyan, tzheng, virt-maint, vwu, yafu
Target Milestone: rcKeywords: Automation, TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-24 11:26:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xiaodai Wang 2021-11-24 03:33:12 UTC
Description of problem:
virt-v2v: error: <disk><driver type="format"> attribute is missing from the libvirt XML

Version-Release number of selected component (if applicable):
virt-v2v-1.42.0-17.module+el8.6.0+13435+b5ec01cb.x86_64
qemu-kvm-6.1.0-4.module+el8.6.0+13039+4b81a1dc.x86_64
libvirt-7.9.0-1.module+el8.6.0+13150+28339563.x86_64

How reproducible:
100%

Steps to Reproduce:
Convert a VM from VMware by v2v.

# virt-v2v -i libvirt -ic vpx://root.x.x/data/x.x.x.x/?no_verify=1 esx7.0-rhel8.3-x86_64-gating-2 -it vddk  -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=xx -o null -ip /root/v2v_vpx_passwd -v -x
virt-v2v: virt-v2v 1.42.0rhel=8,release=17.module+el8.6.0+13435+b5ec01cb (x86_64)
libvirt version: 7.9.0
[   0.0] Opening the source -i libvirt -ic vpx://root.x.x/data/x.x.x.x/?no_verify=1 esx7.0-rhel8.3-x86_64-gating-2 -it vddk  -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=xx
libvirt xml is:
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>esx7.0-rhel8.3-x86_64-gating-2</name>
  <uuid>42397974-17ae-a92e-9491-3f94704dd6e2</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='[datastore2] esx7.0-rhel8.3-x86_64-gating-2/esx7.0-rhel8.3-x86_64-gating-2.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='scsi' index='0' model='vmpvscsi'/>
    <controller type='ide' index='0'/>
    <interface type='bridge'>
      <mac address='00:50:56:b9:1b:52' type='generated'/>
      <source bridge='VM Network'/>
      <model type='vmxnet3'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192' primary='yes'/>
    </video>
  </devices>
  <vmware:datacenterpath>data</vmware:datacenterpath>
  <vmware:moref>vm-1012</vmware:moref>
</domain>

virt-v2v: error: <disk><driver type="format"> attribute is missing from the
libvirt XML
rm -rf '/var/tmp/null.qLpkfa'

Actual results:
virt-v2v: error: <disk><driver type="format"> attribute is missing from the
libvirt XML

Expected results:
Libvirt should add the <driver type="format"> into the xml.

Additional info:
This blocks virt-v2v. If it's a v2v issue, please help to reassign it
to v2v, thanks.

Comment 4 Peter Krempa 2021-11-24 09:42:24 UTC
One thing to note is that none of our vmware test data captured from real vmware instances seem to contain the <driver type=''> attribute for disks at all:

E.g. in tests/vmx2xmldata/esx-in-the-wild-8.xml

    <disk type='file' device='disk'>
      <source file='[datastore] directory/RHEL7_6.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <source file='[datastore] directory/RHEL7_6_1.vmdk'/>
      <target dev='sdb' bus='scsi'/>
      <transient/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <source file='[5669422e-699d77db-c144-00e0815e303e] block4/block4.vmdk'/>
      <target dev='sdc' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='[692eb778-2d4937fe] CentOS-4.7.ServerCD-x86_64.iso'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

There is one instance in 'tests/vmx2xmldata/esx-in-the-wild-2.xml' having <driver cache='writethrough'/> but that's it.

Comment 5 Richard W.M. Jones 2021-11-24 10:02:54 UTC
I don't think this is actually a bug in libvirt, or at least it's a sort of
bug but not a test blocker.  Below is my analysis from email.

---

I don't think this is a libvirt bug actually.  In the code we don't
expect libvirt to return a type here, and so we substitute "raw"
format always:

https://github.com/libguestfs/virt-v2v/blob/a3d09f8a7435270e376a53d241ee54c2ebab2b0d/v2v/input_libvirt_vcenter_https.ml#L95

However before we reach this code, we go through parse_libvirt_domain
here which gives the error about the missing type/format:

https://github.com/libguestfs/virt-v2v/blob/a3d09f8a7435270e376a53d241ee54c2ebab2b0d/v2v/parse_libvirt_xml.ml#L270

So this needs another fix in virt-v2v 1.44.  I think we can keep the
same bug (bug 2025769) for the extra fix.

Comment 6 Xiaodai Wang 2021-11-24 10:16:12 UTC
Since QEMU requires the attribute, if libvirt can provide it, then
other applications using libvirt will not have to handle it by themselves.
I'm not sure about it.

Comment 7 Richard W.M. Jones 2021-11-24 10:26:02 UTC
That's an argument in favour of providing it.  The next issue is whether
libvirt can determine the format.  In Peter's example (comment 4) there are
VMDK files (type="vmdk"), and an ISO (probably type="raw").  However the
underlying VMX file doesn't expose the format.  It may be possible to guess
based on file extension or the .deviceType field.

Note that virt-v2v will always want to replace this with "raw" because
we actually use either the -flat.vmdk file (really a raw file) or VDDK
(exposes raw blocks), so having libvirt provide the true type doesn't really
help us.

Comment 8 Xiaodai Wang 2021-11-24 10:50:29 UTC
ok, I see, thanks.
so I think this bug could be closed as WONT_FIX and use bug 2025769
to track the issue.

Comment 9 Jaroslav Suchanek 2021-11-24 11:26:11 UTC
Closing based on previous comments, please reopen if there is anything libvirt should fixed. Thanks.