<div dir="ltr"><div>Hello, libvirt developers,</div><div>Recently I find an issue of libvirt blockcopy:</div><div>Versions:</div><div>libvirt-7.4.0</div><div>qemu-kvm-6.0.0</div><div><br></div><div>Steps:</div><div>1. Create a nbd server</div><div># qemu-img create -f qcow2 /var/lib/libvirt/images/fedora-1.qcow2 10G -o preallocation=full</div><div><br></div><div># qemu-nbd -e 10 /var/lib/libvirt/images/fedora-1.qcow2 -p 10001</div><div><br></div><div>2. Prepare a running VM</div><div># virsh list <br> Id   Name     State<br>------------------------<br> 3    fedora   running</div><div><br></div><div># virsh dumpxml 3|xmllint --xpath //disk -<br><disk type="file" device="disk"><br>      <driver name="qemu" type="qcow2"/><br>      <source file="/var/lib/libvirt/images/fedora.qcow2" index="1"/><br>      <backingStore/><br>      <target dev="hda" bus="ide"/><br>      <alias name="ide0-0-0"/><br>      <address type="drive" controller="0" bus="0" target="0" unit="0"/><br>    </disk></div><div><br></div><div>3. Blockcopy to a nbd dest xml with --reuse-external</div><div># cat /tmp/copy.xml<br>    <disk type='network' device='disk'><br>      <driver name='qemu' type='qcow2'/><br>      <source protocol="nbd"><br>        <host name="localhost" port="10001" /><br>      </source><br>      <backingStore/><br>      <target dev='hda' bus='ide'/><br>    </disk></div><div><br></div><div># virsh blockcopy fedora hda --xml /tmp/copy.xml --transient-job --wait --verbose --finish  --reuse-external <br>error: unsupported configuration: reused mirror destination format must be specified</div><div><br></div><div>But it works without --reuse-external</div><div># virsh blockcopy fedora hda --xml /tmp/copy.xml --transient-job --wait --verbose --finish <br>Block Copy: [100 %]<br>Successfully copied</div><div><br></div><div><br></div><div><span class="gmail-pl-c">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.</span></div><div><br></div><div>I am not sure if --reuse-external flag is only for file type disk. It seems the description of <span class="gmail-pl-c">VIR_DOMAIN_BLOCK_COPY_REUSE_EXT(<a href="https://github.com/libvirt/libvirt/blob/7c08141f906e20e730c4b6407bc638e743deea48/src/libvirt-domain.c#L10479">https://github.com/libvirt/libvirt/blob/7c08141f906e20e730c4b6407bc638e743deea48/src/libvirt-domain.c#L10479</a>) indicates this flag is for file only:</span></div><div><span class="gmail-pl-c"> * VIR_DOMAIN_BLOCK_COPY_REUSE_EXT flag is present stating that the file<br> * was pre-created with the correct format and metadata and sufficient<br> * size to hold the copy. In case the VIR_DOMAIN_BLOCK_COPY_SHALLOW flag<br> * is used the pre-created file has to exhibit the same guest visible contents<br> * as the backing file of the original image. This allows a management app to<br> * pre-create files with relative backing file names, rather than the default<br> * of absolute backing file names.</span></div><div><span class="gmail-pl-c"><br></span></div><div><span class="gmail-pl-c">Please help to confirm if it is a bug here.<br></span></div><div><span class="gmail-pl-c"><br></span></div></div>