[PATCH 0/2] storage: Upgrade default qcow2 verion to 1.1

Right now the default qcow2 version if not specified explicitly, defaults to 0.10. Certain features like live snapshots, cluster size specification require 1.1 to work. This patch series aims at upgrading the qcow2 default image version, and use compatibility version 1.1 unless specified. This also requires correcting multiple testcases related to this compat version. If any other locations require changing, they will be added as a part of this series. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/602 Abhiram Tilak (2): storage: change assigning qcow2 compat to 1.1 from 0.10 automatically storage: fix testcases on changing the default qcow2 compat to 1.1 src/storage/storage_util.c | 2 +- .../storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv | 2 +- tests/storagevolxml2argvdata/qcow2-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv | 2 +- .../qcow2-luks-convert-encrypt2fileqcow2.argv | 2 +- tests/storagevolxml2argvdata/qcow2-luks.argv | 2 +- .../qcow2-nobacking-convert-prealloc-compat.argv | 2 +- .../storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv | 2 +- .../qcow2-nocapacity-convert-prealloc.argv | 2 +- tests/storagevolxml2argvdata/qcow2-nocapacity.argv | 2 +- tests/storagevolxml2argvdata/qcow2-nocow-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-zerocapacity.argv | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) -- 2.42.1

In the file `storage/storage_util.c` currently `compat` varible is begin assigned to 0.10 by default. This patch changes this default value to 1.1. This is done in efforts to upgrade the default qcow2 image version to 1.1. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/602 Signed-off-by: Abhiram Tilak <atp.exp@gmail.com> --- src/storage/storage_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 7bf815d978..28d5fce4f0 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -765,7 +765,7 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo, if (info->compat) virBufferAsprintf(&buf, "compat=%s,", info->compat); else if (info->format == VIR_STORAGE_FILE_QCOW2) - virBufferAddLit(&buf, "compat=0.10,"); + virBufferAddLit(&buf, "compat=1.1,"); if (info->clusterSize > 0) virBufferAsprintf(&buf, "cluster_size=%llu,", info->clusterSize); -- 2.42.1

Just a note, please don't CC random people from the mailing list in the libvirt project. On Tue, Mar 05, 2024 at 01:50:32 +0530, Abhiram Tilak wrote:
In the file `storage/storage_util.c` currently `compat` varible is begin assigned to 0.10 by default. This patch changes this default value to 1.1.
This is done in efforts to upgrade the default qcow2 image version to 1.1.
We prefer if the commit message justifies the change rather than just summarizes it. The justification can be something along: storage: Use modern qcow2 by default Change the default to modern qcow2 as it's supported by all qemu versions supported by libvirt and in fact 'qemu-img' already defaults to the new format for a long time.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/602 Signed-off-by: Abhiram Tilak <atp.exp@gmail.com> --- src/storage/storage_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 7bf815d978..28d5fce4f0 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -765,7 +765,7 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo, if (info->compat) virBufferAsprintf(&buf, "compat=%s,", info->compat); else if (info->format == VIR_STORAGE_FILE_QCOW2) - virBufferAddLit(&buf, "compat=0.10,"); + virBufferAddLit(&buf, "compat=1.1,");
if (info->clusterSize > 0) virBufferAsprintf(&buf, "cluster_size=%llu,", info->clusterSize);
Without all the changes in patch 2/2 this breaks the bulild. Our guides for sending patches state: "If you're going to submit multiple patches, the automated tests must pass after each patch, not just after the last one." https://libvirt.org/hacking.html#preparing-patches You can add: Reviewed-by: Peter Krempa <pkrempa@redhat.com> for v2 with the new commit message and the test changes squashed into patch 1 so that tests pass.

On Tue, 5 Mar 2024 at 14:00, Peter Krempa <pkrempa@redhat.com> wrote:
Just a note, please don't CC random people from the mailing list in the libvirt project.
In projects with faster patch frequencies, I typically CC maintainers for efficient communication. However, considering there's no separate MAINTAINERS file assigning each module to a maintainer in this context. Thanks for the clarification.
On Tue, Mar 05, 2024 at 01:50:32 +0530, Abhiram Tilak wrote:
In the file `storage/storage_util.c` currently `compat` varible is begin assigned to 0.10 by default. This patch changes this default value to 1.1.
This is done in efforts to upgrade the default qcow2 image version to 1.1.
We prefer if the commit message justifies the change rather than just summarizes it.
The justification can be something along:
storage: Use modern qcow2 by default
Change the default to modern qcow2 as it's supported by all qemu versions supported by libvirt and in fact 'qemu-img' already defaults to the new format for a long time.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/602 Signed-off-by: Abhiram Tilak <atp.exp@gmail.com> --- src/storage/storage_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 7bf815d978..28d5fce4f0 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -765,7 +765,7 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo, if (info->compat) virBufferAsprintf(&buf, "compat=%s,", info->compat); else if (info->format == VIR_STORAGE_FILE_QCOW2) - virBufferAddLit(&buf, "compat=0.10,"); + virBufferAddLit(&buf, "compat=1.1,");
if (info->clusterSize > 0) virBufferAsprintf(&buf, "cluster_size=%llu,", info->clusterSize);
Without all the changes in patch 2/2 this breaks the bulild. Our guides for sending patches state:
"If you're going to submit multiple patches, the automated tests must pass after each patch, not just after the last one."
https://libvirt.org/hacking.html#preparing-patches You can add:
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
for v2 with the new commit message and the test changes squashed into patch 1 so that tests pass.

After changing the default qcow2 image to 1.1 from 0.10. Some of the testcases in `storagevolxml2` here need fixing. This patch changes the expected compat version in each of these files that call qemu-img. As per qemu's Qcow docs the qemu-img command gives a 1.1 compatible version image. These testcases are written for 0.10, and should be upgraded. Also there is a testcase `qcow2-1.1.argv`. Which is aimed at testing 1.1 version specifically, I think a new testcase should be made to replace it called `qcow2-0.10.argv`. This requires renaming test files and changes at many places, not sure so didn't include in the patch. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/602 Signed-off-by: Abhiram Tilak <atp.exp@gmail.com> --- .../storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv | 2 +- tests/storagevolxml2argvdata/qcow2-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv | 2 +- .../qcow2-luks-convert-encrypt2fileqcow2.argv | 2 +- tests/storagevolxml2argvdata/qcow2-luks.argv | 2 +- .../qcow2-nobacking-convert-prealloc-compat.argv | 2 +- .../storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv | 2 +- .../qcow2-nocapacity-convert-prealloc.argv | 2 +- tests/storagevolxml2argvdata/qcow2-nocapacity.argv | 2 +- tests/storagevolxml2argvdata/qcow2-nocow-compat.argv | 2 +- tests/storagevolxml2argvdata/qcow2-zerocapacity.argv | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv b/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv index 4b9ccfe8dc..705604b162 100644 --- a/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv +++ b/tests/storagevolxml2argvdata/luks-convert-encrypt2fileqcow2.argv @@ -1,7 +1,7 @@ qemu-img \ create \ -f qcow2 \ --o compat=0.10 \ +-o compat=1.1 \ /var/lib/libvirt/images/sparse-qcow2.img \ 1073741824K qemu-img \ diff --git a/tests/storagevolxml2argvdata/qcow2-compat.argv b/tests/storagevolxml2argvdata/qcow2-compat.argv index bf3a50a7f3..40fbe065e0 100644 --- a/tests/storagevolxml2argvdata/qcow2-compat.argv +++ b/tests/storagevolxml2argvdata/qcow2-compat.argv @@ -2,6 +2,6 @@ qemu-img \ create \ -f qcow2 \ -b /dev/null \ --o backing_fmt=raw,compat=0.10 \ +-o backing_fmt=raw,compat=1.1 \ /var/lib/libvirt/images/OtherDemo.img \ 5242880K diff --git a/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv b/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv index dbc7deb16a..b68da425d9 100644 --- a/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv +++ b/tests/storagevolxml2argvdata/qcow2-from-logical-compat.argv @@ -2,6 +2,6 @@ qemu-img \ convert \ -f raw \ -O qcow2 \ --o compat=0.10 \ +-o compat=1.1 \ /dev/HostVG/Swap \ /var/lib/libvirt/images/OtherDemo.img diff --git a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv index d89622d4a6..3068b4b38d 100644 --- a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv +++ b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt.argv @@ -2,7 +2,7 @@ qemu-img \ create \ -f qcow2 \ --object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \ --o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \ +-o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=1.1 \ /var/lib/libvirt/images/OtherDemoLuks.img \ 5242880K qemu-img \ diff --git a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv index 4d910552d0..948e9ac66d 100644 --- a/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv +++ b/tests/storagevolxml2argvdata/qcow2-luks-convert-encrypt2fileqcow2.argv @@ -1,7 +1,7 @@ qemu-img \ create \ -f qcow2 \ --o compat=0.10 \ +-o compat=1.1 \ /var/lib/libvirt/images/sparse-qcow2.img \ 1073741824K qemu-img \ diff --git a/tests/storagevolxml2argvdata/qcow2-luks.argv b/tests/storagevolxml2argvdata/qcow2-luks.argv index 308316c90c..a3be41a406 100644 --- a/tests/storagevolxml2argvdata/qcow2-luks.argv +++ b/tests/storagevolxml2argvdata/qcow2-luks.argv @@ -3,6 +3,6 @@ create \ -f qcow2 \ -b /dev/null \ --object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \ --o backing_fmt=raw,encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \ +-o backing_fmt=raw,encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=1.1 \ /var/lib/libvirt/images/OtherDemoLuks.img \ 5242880K diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv index 463ae26779..a130ed8894 100644 --- a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv +++ b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc-compat.argv @@ -2,6 +2,6 @@ qemu-img \ convert \ -f raw \ -O qcow2 \ --o preallocation=metadata,compat=0.10 \ +-o preallocation=metadata,compat=1.1 \ /var/lib/libvirt/images/sparse.img \ /var/lib/libvirt/images/OtherDemo.img diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv index 510e0c13f6..440ad8f122 100644 --- a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv +++ b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc-compat.argv @@ -1,6 +1,6 @@ qemu-img \ create \ -f qcow2 \ --o preallocation=metadata,compat=0.10 \ +-o preallocation=metadata,compat=1.1 \ /var/lib/libvirt/images/OtherDemo.img \ 5242880K diff --git a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv index 0152b1efb6..3bf8613d72 100644 --- a/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv +++ b/tests/storagevolxml2argvdata/qcow2-nocapacity-convert-prealloc.argv @@ -2,6 +2,6 @@ qemu-img \ convert \ -f raw \ -O qcow2 \ --o preallocation=falloc,compat=0.10 \ +-o preallocation=falloc,compat=1.1 \ /var/lib/libvirt/images/sparse.img \ /var/lib/libvirt/images/OtherDemo.img diff --git a/tests/storagevolxml2argvdata/qcow2-nocapacity.argv b/tests/storagevolxml2argvdata/qcow2-nocapacity.argv index 047932a559..924c5c6084 100644 --- a/tests/storagevolxml2argvdata/qcow2-nocapacity.argv +++ b/tests/storagevolxml2argvdata/qcow2-nocapacity.argv @@ -2,5 +2,5 @@ qemu-img \ create \ -f qcow2 \ -b /dev/null \ --o backing_fmt=raw,compat=0.10 \ +-o backing_fmt=raw,compat=1.1 \ /var/lib/libvirt/images/OtherDemo.img diff --git a/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv b/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv index 4cc7904cfc..ae94e4e588 100644 --- a/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv +++ b/tests/storagevolxml2argvdata/qcow2-nocow-compat.argv @@ -2,6 +2,6 @@ qemu-img \ create \ -f qcow2 \ -b /dev/null \ --o backing_fmt=raw,nocow=on,compat=0.10 \ +-o backing_fmt=raw,nocow=on,compat=1.1 \ /var/lib/libvirt/images/OtherDemo.img \ 5242880K diff --git a/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv b/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv index 607c642e6f..05e31509cb 100644 --- a/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv +++ b/tests/storagevolxml2argvdata/qcow2-zerocapacity.argv @@ -1,6 +1,6 @@ qemu-img \ create \ -f qcow2 \ --o compat=0.10 \ +-o compat=1.1 \ /var/lib/libvirt/images/OtherDemo.img \ 0K -- 2.42.1
participants (3)
-
Abhiram Tilak
-
atp exp
-
Peter Krempa