[libvirt-users] Autodetecting backing file properties when using vol-create-as

Gionatan Danti g.danti at assyoma.it
Tue Apr 23 22:13:15 UTC 2019


Hi all,
experimenting with vol-create-as, I think it should autodetect some data 
- filesize and backing file format, specifically. However, the current 
implementation require us to specify both filesize and backing file 
format.

Considering that qemu-img already autodetects these data, there are any 
reason for the lack of autodetect by libvirt? Should I open a bugzilla 
issue?

Below you can find a practical example of what I mean. System is CentOS 
Linux release 7.6.1810 (Core) with libvirt-4.5.0-10.el7_6.4.x86_64

Please let me know if I am missing something.
Thanks.

# create base file
[root at singularity images]# qemu-img create base.qcow2 8G -f qcow2
Formatting 'base.qcow2', fmt=qcow2 size=8589934592 cluster_size=65536 
lazy_refcounts=off refcount_bits=16
[root at singularity images]# qemu-img info base.qcow2
image: base.qcow2
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 17K
cluster_size: 65536
Format specific information:
     compat: 1.1
     lazy refcounts: false
     refcount bits: 16
     corrupt: false

# create overlay1.qcow2 via qemu-img; note how backing file format is 
autodetected ("-f qcow2" regards the overlay file itself)
[root at singularity images]# qemu-img create -b 
/var/lib/libvirt/images/base.qcow2 overlay1.qcow2 -f qcow2
Formatting 'overlay1.qcow2', fmt=qcow2 size=8589934592 
backing_file=/var/lib/libvirt/images/base.qcow2 cluster_size=65536 
lazy_refcounts=off refcount_bits=16
[root at singularity images]# qemu-img info overlay1.qcow2
image: overlay1.qcow2
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 17K
cluster_size: 65536
backing file: /var/lib/libvirt/images/base.qcow2
Format specific information:
     compat: 1.1
     lazy refcounts: false
     refcount bits: 16
     corrupt: false

# try the same with virsh vol-create-as; note how you must specify 
filesize and the backing file format is *wrong* (leading to an unusable 
overlay disk)
[root at singularity images]# virsh vol-create-as default overlay2.qcow2 8G 
--format qcow2 --backing-vol /var/lib/libvirt/images/base.qcow2
Vol overlay2.qcow2 created
[root at singularity images]# qemu-img info overlay2.qcow2
image: overlay2.qcow2
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 17K
cluster_size: 65536
backing file: /var/lib/libvirt/images/base.qcow2
backing file format: raw
Format specific information:
     compat: 0.10
     refcount bits: 16


-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti at assyoma.it - info at assyoma.it
GPG public key ID: FF5F32A8




More information about the libvirt-users mailing list