[libvirt] [RFC] add option to configure qcow2 cache sizes in domain xml

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Wed Apr 11 11:12:39 UTC 2018


Hi, all.

I want to add option to configure qcow2 cache size in domain xml.  Looks like
this should be a driver option. As driver already has a lot of attributes and
even qcow2 has more then one cache I suggest something like this:

<driver type="qemu" type="qcow2">
    <cache name="l2"       size="1024" unit="KiB"/>
    <cache name="refcount" size="256"  unit="KiB"/>
</driver>

This looks compact but qcow2 has entry size option for cache which don't fit
nicely in this approach (you have to use same units for both values).
So may be this is better:

<driver type="qemu" type="qcow2">
    <cache name="l2">
        <size unit="KiB">1024</size>
        <entrysize unit="KiB">4</entrysize>
    </cache>
    <cache name="refcount">
        <size unit="KiB">256</size>
    </cache>
</driver>

Or may be start specifying size and units in one attribute:

<driver type="qemu" type="qcow2">
    <cache name="l2"       size="1MiB" entrysize="4KiB"/>
    <cache name="refcount" size="256KiB"/>
</driver>


Also qemu has a feature to specify only one value for caches so that qemu sets
l2 and refcount caches in hardcoded 4:1 ratio which is good for images with
default refcount_bits=16. On one hand this is nice to have in libvirt xml too 
so that user can specify only one memory size. On another hand "there's no
strict need for both caches to cover the same amount of disk space" [1] and
assuming user tuning cache sizes know what he is doing we can live without
this option in libvirt xml. I tend to not to add this option to libvirt xml.


[1] qemu/docs/qcow2-cache.txt

Nikolay




More information about the libvir-list mailing list