Fail to do blockcopy to network dest xml with --reuse-external

Han Han hhan at redhat.com
Mon Jun 28 04:00:02 UTC 2021


Hello, libvirt developers,
Recently I find an issue of libvirt blockcopy:
Versions:
libvirt-7.4.0
qemu-kvm-6.0.0

Steps:
1. Create a nbd server
# qemu-img create -f qcow2 /var/lib/libvirt/images/fedora-1.qcow2 10G -o
preallocation=full

# qemu-nbd -e 10 /var/lib/libvirt/images/fedora-1.qcow2 -p 10001

2. Prepare a running VM
# virsh list
 Id   Name     State
------------------------
 3    fedora   running

# virsh dumpxml 3|xmllint --xpath //disk -
<disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/fedora.qcow2" index="1"/>
      <backingStore/>
      <target dev="hda" bus="ide"/>
      <alias name="ide0-0-0"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>

3. Blockcopy to a nbd dest xml with --reuse-external
# cat /tmp/copy.xml
    <disk type='network' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source protocol="nbd">
        <host name="localhost" port="10001" />
      </source>
      <backingStore/>
      <target dev='hda' bus='ide'/>
    </disk>

# virsh blockcopy fedora hda --xml /tmp/copy.xml --transient-job --wait
--verbose --finish  --reuse-external
error: unsupported configuration: reused mirror destination format must be
specified

But it works without --reuse-external
# virsh blockcopy fedora hda --xml /tmp/copy.xml --transient-job --wait
--verbose --finish
Block Copy: [100 %]
Successfully copied


Since it is clear that the format of dest image is qcow2, the error message
"reused mirror destination format must be specified" is wrong. The
blockcopy with network disk + --reuse-external should either be supported
or post a better error message.

I am not sure if --reuse-external flag is only for file type disk. It seems
the description of VIR_DOMAIN_BLOCK_COPY_REUSE_EXT(
https://github.com/libvirt/libvirt/blob/7c08141f906e20e730c4b6407bc638e743deea48/src/libvirt-domain.c#L10479)
indicates this flag is for file only:
 * VIR_DOMAIN_BLOCK_COPY_REUSE_EXT flag is present stating that the file
 * was pre-created with the correct format and metadata and sufficient
 * size to hold the copy. In case the VIR_DOMAIN_BLOCK_COPY_SHALLOW flag
 * is used the pre-created file has to exhibit the same guest visible
contents
 * as the backing file of the original image. This allows a management app
to
 * pre-create files with relative backing file names, rather than the
default
 * of absolute backing file names.

Please help to confirm if it is a bug here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20210628/90d538f5/attachment.htm>


More information about the libvirt-users mailing list