[libvirt PATCH 0/2] storage_driver: add support for cluster_size QCOW2 option

Han Han hhan at redhat.com
Mon May 17 04:17:10 UTC 2021


On Thu, May 13, 2021 at 7:23 PM Pavel Hrdina <phrdina at redhat.com> wrote:

> Pavel Hrdina (2):
>   storage: add support for QCOW2 cluster_size option
>   storage_file: add support to probe cluster_size from QCOW2 images
>
>  docs/formatstorage.html.in                    |  6 ++
>  docs/schemas/storagecommon.rng                |  7 +++
>  docs/schemas/storagevol.rng                   |  3 +
>  src/conf/storage_conf.c                       | 12 ++++
>  src/storage/storage_util.c                    |  8 +++
>  src/storage_file/storage_file_probe.c         | 55 +++++++++++++------
>  .../qcow2-clusterSize.argv                    |  6 ++
>  tests/storagevolxml2argvtest.c                |  4 ++
>  .../vol-qcow2-clusterSize.xml                 | 17 ++++++
>  .../vol-qcow2-clusterSize.xml                 | 17 ++++++
>  tests/storagevolxml2xmltest.c                 |  1 +
>  11 files changed, 120 insertions(+), 16 deletions(-)
>  create mode 100644 tests/storagevolxml2argvdata/qcow2-clusterSize.argv
>  create mode 100644 tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml
>  create mode 100644 tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml
>
>  Works for me when patched with libvirt v7.3.0-184-gdf28ba289c
➜  ~ cat /tmp/cluster.xml
<volume type='file'>
  <name>cluster.qcow2</name>
  <key>/var/lib/libvirt/images/cluster.qcow2</key>
  <capacity unit='bytes'>5368709</capacity>
  <physical unit='bytes'>1271660544</physical>
  <target>
    <path>/var/lib/libvirt/images/hhan-pc.qcow2</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1621221448.682657229</atime>
      <mtime>1618908525.055934734</mtime>
      <ctime>1618908525.253934734</ctime>
      <btime>0</btime>
    </timestamps>
    <compat>1.1</compat>
  <clusterSize>1024</clusterSize>
    <features>
      <lazy_refcounts/>
    </features>
  </target>
</volume>

➜  ~ virt-xml-validate /tmp/cluster.xml
/tmp/cluster.xml validates

➜  ~ virsh vol-create images /tmp/cluster.xml
Vol cluster.qcow2 created from /tmp/cluster.xml

➜  ~ qemu-img info /var/lib/libvirt/images/cluster.qcow2
image: /var/lib/libvirt/images/cluster.qcow2
file format: qcow2
virtual size: 5.12 MiB (5368832 bytes)
disk size: 4 KiB
cluster_size: 1024
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: true
    refcount bits: 16
    corrupt: false
    extended l2: false
➜  ~ virsh vol-dumpxml --pool images cluster.qcow2
<volume type='file'>
  <name>cluster.qcow2</name>
  <key>/var/lib/libvirt/images/cluster.qcow2</key>
  <capacity unit='bytes'>5368832</capacity>
  <allocation unit='bytes'>4096</allocation>
  <physical unit='bytes'>3400</physical>
  <target>
    <path>/var/lib/libvirt/images/cluster.qcow2</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1621224886.854657229</atime>
      <mtime>1621224875.045657229</mtime>
      <ctime>1621224875.049657229</ctime>
      <btime>0</btime>
    </timestamps>
    <compat>1.1</compat>
    <clusterSize unit='B'>1024</clusterSize>
    <features>
      <lazy_refcounts/>
    </features>
  </target>
</volume>

> --
> 2.31.1
>
>

-- 
Reviewed-by: Han Han <hhan at redhat.com>
Tested-by: Han Han <hhan at redhat.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210517/47a621e5/attachment-0001.htm>


More information about the libvir-list mailing list