Issue
Description of problem:
Can't get correct cluster size when vol-create-from with an cluster size in target volume
Version-Release number of selected component (if applicable):
libvirt-7.4.0-1.module+el8.5.0+11218+83343022.x86_64
qemu-kvm-6.0.0-18.module+el8.5.0+11243+5269aaa1.x86_64
How reproducible:
100%
Steps to Reproduce:
1. Prepare a dir pool and a volume xml.
virsh pool-list --all
Name
State
Autostart
-------------------------------
default
active
yes
cat volume.xml
<volume>
<name>cluster.img</name>
<key>/var/lib/libvirt/images/cluster.img</key>
<capacity unit="G">2</capacity>
<allocation>294912</allocation>
<target>
<path>/var/lib/libvirt/images/cluster.img</path>
<format type='qcow2'/>
</target>
</volume>
2. Create a volume with vol-create.
virsh vol-create --pool default volume.xml
Vol cluster created from volume.xml
virsh vol-list default
Name
Path
--------------------------------------------------------
cluster.img
/var/lib/libvirt/images/cluster.img
3. Vol-create-from target volume with cluster size.
cat dest-volume.xml
<volume>
<name>cluster1.img</name>
<key>/var/lib/libvirt/images/cluster1.img</key>
<capacity unit="G">2</capacity>
<allocation>294912</allocation>
<target>
<path>/var/lib/libvirt/images/cluster1.img</path>
<format type='qcow2'/>
</target>
<clusterSize unit='KiB'>512</clusterSize>
</volume>
virsh vol-create-from default dest-volume.xml cluster.img --inputpool default
Vol cluster1.img created from input vol cluster.img
4. Check the cluster size in the new volume.
virsh vol-dumpxml --pool default cluster1.img | grep clusterSize
------Can't get the cluster size
systemctl restart libvirtd
virsh vol-dumpxml --pool default cluster1.img | grep clusterSize
<clusterSize unit='B'>65536</clusterSize>
------Get the incorrect cluster size even though restart the libvirtd
Actual results:
As above step 4.
Expected results:
Can get the correct cluster size.
Additional info: