[libvirt-users] bug in Libvirt(-python)?

Ján Tomko jtomko at redhat.com
Wed Feb 17 11:49:40 UTC 2016

On Tue, Feb 16, 2016 at 06:55:44PM +0100, Dennis Jacobfeuerborn wrote:
> Hi,
> I've noticed that the capacity of the disk in one of my VMs is
> completely wrongly reported by the python api. The image was transfered
> using scp but the transfer was aborted and now the api show a strange value:
> [root at virt83 ~]# du -h /var/lib/libvirt/images/test-disk1
> 706M	/var/lib/libvirt/images/test-disk1
> [root at virt83 ~]# ls -lh /var/lib/libvirt/images/test-disk1
> -rw-r--r--. 1 root root 706M  3. Nov 20:03
> /var/lib/libvirt/images/test-disk1
> [root at virt83 ~]# qemu-img info /var/lib/libvirt/images/test-disk1
> image: /var/lib/libvirt/images/test-disk1
> file format: raw
> virtual size: 705M (739573760 bytes)
> disk size: 705M
> Notice how that raw image is seen with a size of 705M by ls, du and
> qemu-img however when I get a blockinfo using libvirt-python using the
> blockInfo() call I get this:
> {'source': '/var/lib/libvirt/images/test-disk1', 'target': 'vda'}
> [2423276348619671841L, 739577856L, 739577856L]
> Obviously the first value (capacity) is way too large to be correct.
> Any ideas if this is a bug or if there is something else going on?

If it also happens with 'virsh domblkinfo', then the bug is not in the
python bindings.

Running libvirtd with debug logs might give you a hint where the value
came from:

Also, the code paths are different for running and inactive domains -
for inactive domains libvirtd figures out the data by looking at/into
the file, for active domains it asks QEMU via the query-block{,stats}


More information about the libvirt-users mailing list