Description of problem: vol-dumpxml get wrong format type when check volume info which created by qemu-img Version-Release number of selected component (if applicable): # rpm -qf /sbin/libvirtd && rpm -q qemu-kvm qemu-img libvirt-daemon-1.2.5-1.fc20.x86_64 qemu-kvm-1.6.2-5.fc20.x86_64 qemu-img-1.6.2-5.fc20.x86_64 How reproducible: 100% Steps to Reproduce: 1.prepare an dir type pool # virsh pool-list dir Name State Autostart ------------------------------------------- default active no 2.create qcow2 format volume by qemu-img # qemu-img create -f qcow2 /var/lib/libvirt/images/qcow2.img 1G Formatting '/var/lib/libvirt/images/qcow2.img', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off 3.check format by vol-dumpxml # virsh pool-refresh default Pool default refreshed # virsh vol-dumpxml /var/lib/libvirt/images/qcow2.img <volume type='file'> <name>qcow2.img</name> <key>/var/lib/libvirt/images/qcow2.img</key> <source> </source> <capacity unit='bytes'>1073741824</capacity> <allocation unit='bytes'>200704</allocation> <target> <path>/var/lib/libvirt/images/qcow2.img</path> <format type='raw'/> <permissions> .. 4. create qcow2 format volume with backing file # qemu-img create -f qcow2 /var/lib/libvirt/images/qcow2.s1 -b /var/lib/libvirt/images/qcow2.img 1G Formatting '/var/lib/libvirt/images/qcow2.s1', fmt=qcow2 size=1073741824 backing_file='/var/lib/libvirt/images/qcow2.img' encryption=off cluster_size=65536 lazy_refcounts=off 5. check format by vol-dumpxml # virsh pool-refresh default Pool default refreshed # virsh vol-dumpxml /var/lib/libvirt/images/qcow2.s1 <volume type='file'> <name>qcow2.s2</name> <key>/var/lib/libvirt/images/qcow2.s1</key> <source> </source> <capacity unit='bytes'>1073741824</capacity> <allocation unit='bytes'>200704</allocation> <target> <path>/var/lib/libvirt/images/qcow2.s1</path> <format type='raw'/> <permissions> <mode>0644</mode> <owner>0</owner> <group>0</group> <label>unconfined_u:object_r:virt_image_t:s0</label> </permissions> <timestamps> <atime>1401935440.477721377</atime> <mtime>1401935437.888694457</mtime> <ctime>1401935437.888694457</ctime> </timestamps> </target> <backingStore> <path>/var/lib/libvirt/images/qcow2.img</path> <format type='qcow2'/> <permissions> .. Actual results: The "format type" in step3 and step5 is wrong Expected results: Additional info: can't meet this error when create volume by vol-create/vol-create-as
Upstream patch: https://www.redhat.com/archives/libvir-list/2014-June/msg00299.html
Fixed upstream: commit c110cdb2bcc9d29dafbc89d3edda16a824e9443d Author: Ján Tomko <jtomko> CommitDate: 2014-06-05 18:58:58 +0200 Fix storage format probing Commit fff74b2 moved the probing into virStorageFileGetMetadataFromBuf but didn't update the format in volume definition. https://bugzilla.redhat.com/show_bug.cgi?id=1104908 git describe: v1.2.5-56-gc110cdb Backported to v1.2.5-maint as v1.2.5-1-gd76ada4
Verify with below step: # git describe v1.2.5-56-gc110cdb #make rpm && rpm -ivh ~/rpmbuild/RPMS/x86_64/* # systemctl start libvirtd.service # qemu-img create -f qcow2 /var/lib/libvirt/images/qcow2.img 1G Formatting '/var/lib/libvirt/images/qcow2.img', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off # virsh pool-refresh default Pool default refreshed # virsh vol-dumpxml /var/lib/libvirt/images/qcow2.img <volume type='file'> <name>qcow2.img</name> <key>/var/lib/libvirt/images/qcow2.img</key> <source> </source> <capacity unit='bytes'>1073741824</capacity> <allocation unit='bytes'>200704</allocation> <target> <path>/var/lib/libvirt/images/qcow2.img</path> <format type='qcow2'/> ... </volume>
I don't think this issue affects the fedora 20 libvirt version, and f21/rawhide already have the fix, so closing. If anyone can reproduce the issue with F20 packages, please reopen