[libvirt-users] Create qcow2 v3 volumes via libvirt

Daniel P. Berrangé berrange at redhat.com
Tue May 1 08:45:09 UTC 2018


On Tue, Jan 30, 2018 at 01:17:21PM +0100, Gionatan Danti wrote:
> Hi all,
> on a fully patched CentOS 7.4 x86-64, I see the following behavior:
> 
> - when creating a new volumes using vol-create-as, the resulting file is a
> qcow2 version 2 (compat=0.10) file. Example:
> 
> [root at gdanti-lenovo vmimages]# virsh vol-create-as default zzz.qcow2
> 8589934592 --format=qcow2 --backing-vol /mnt/vmimages/centos6.img
> Vol zzz.qcow2 created

Yes, for sake of backcompat we default to v2 unless something
requires v3. You can't use vol-create-as to create a v3 image,
you need to use the XML input.

Either force the use of v3:

  <volume>
    <name>demo.qcow2</name>
    <capacity>1073741824</capacity>
    <target>
      <format type='qcow2'/>
      <compat>1.1</compat>
    </target>
  </volume>

Or request some feature that implies v3:


  <volume>
    <name>demo.qcow2</name>
    <capacity>1073741824</capacity>
    <target>
      <format type='qcow2'/>
      <features>
        <lazy_refcounts/>
      </features>
    </target>
  </volume>

and pass this XML to virsh vol-create


> It is possible to create a new volume using qcow2 version 3 (compat=1.1)
> format *using libvirt/virsh* (I know I can do that via qemu-img)? Any
> drawback on using version 3 format?

The only drawback is OS compatibility. 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list