Gionatan Danti
2019-Apr-23 22:13 UTC
[libvirt-users] Autodetecting backing file properties when using vol-create-as
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@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@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@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@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@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@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@assyoma.it - info@assyoma.it GPG public key ID: FF5F32A8
Gionatan Danti
2019-May-06 21:28 UTC
Re: [libvirt-users] Autodetecting backing file properties when using vol-create-as
Il 24-04-2019 00:13 Gionatan Danti ha scritto:> 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@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@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@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@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@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@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: 16Dear all, any thoughts on the matter? Thanks. -- Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: g.danti@assyoma.it - info@assyoma.it GPG public key ID: FF5F32A8