diff --git a/docs/formatstorage.rst b/docs/formatstorage.rst index d7ca58788a..ef15c0ac5c 100644 --- a/docs/formatstorage.rst +++ b/docs/formatstorage.rst @@ -652,6 +652,7 @@ host filesystem. It can contain the following child elements: 64 + @@ -714,6 +715,9 @@ host filesystem. It can contain the following child elements: - ```` - allow delayed reference counter updates. :since:`Since 1.1.0` + - ```` - enables subcluster allocation for qcow2 images. QCOW2 + clusters are split into 32 subclusters decreasing the size of L2 cache + needed. It's recommended to increase ``clusterSize``. Backing store elements ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index 591a158209..10f1bc6a15 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -134,6 +134,11 @@ + + + + + diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index c0acee189a..d42f715f26 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -66,6 +66,7 @@ VIR_ENUM_IMPL(virStorageFileFormat, VIR_ENUM_IMPL(virStorageFileFeature, VIR_STORAGE_FILE_FEATURE_LAST, "lazy_refcounts", + "extended_l2", ); diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 40db29c418..c4a026881c 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -86,6 +86,7 @@ VIR_ENUM_DECL(virStorageFileFormat); typedef enum { VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS = 0, + VIR_STORAGE_FILE_FEATURE_EXTENDED_L2, VIR_STORAGE_FILE_FEATURE_LAST } virStorageFileFeature; diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index bfc3edb1fd..03874d6ca3 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -796,6 +796,17 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo, } virBufferAddLit(&buf, "lazy_refcounts,"); } + + if (virBitmapIsBitSet(info->features, + VIR_STORAGE_FILE_FEATURE_EXTENDED_L2)) { + if (STREQ_NULLABLE(info->compat, "0.10")) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'extended_l2' not supported with compat level %s"), + info->compat); + return -1; + } + virBufferAddLit(&buf, "extended_l2=on,"); + } } virBufferTrim(&buf, ","); diff --git a/tests/storagevolxml2argvdata/qcow2-clusterSize.argv b/tests/storagevolxml2argvdata/qcow2-clusterSize.argv index 8878a26818..c84fc8c47a 100644 --- a/tests/storagevolxml2argvdata/qcow2-clusterSize.argv +++ b/tests/storagevolxml2argvdata/qcow2-clusterSize.argv @@ -1,6 +1,6 @@ qemu-img \ create \ -f qcow2 \ --o compat=0.10,cluster_size=131072 \ +-o compat=1.1,cluster_size=131072,extended_l2=on \ /var/lib/libvirt/images/OtherDemo.img \ 5242880K diff --git a/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml b/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml index 22534982a1..2152a1f280 100644 --- a/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml +++ b/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml @@ -13,5 +13,8 @@ 128 + + + diff --git a/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml b/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml index 393a492536..40acb21ff8 100644 --- a/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml +++ b/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml @@ -12,6 +12,10 @@ 0 + 1.1 131072 + + +