|
|
a83cc2 |
From 9d2700ed836cdfabbd031da74cd5a3d01c9127dd Mon Sep 17 00:00:00 2001
|
|
|
a83cc2 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Date: Fri, 20 Aug 2021 18:25:12 +0200
|
|
|
a83cc2 |
Subject: [PATCH 1/4] qcow2: Deprecation warning when opening v2 images rw
|
|
|
a83cc2 |
MIME-Version: 1.0
|
|
|
a83cc2 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a83cc2 |
Content-Transfer-Encoding: 8bit
|
|
|
a83cc2 |
|
|
|
a83cc2 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
RH-MergeRequest: 37: qcow2: Deprecation warning when opening v2 images rw
|
|
|
a83cc2 |
RH-Commit: [1/1] f450d0ae32d35063b28c72c4f2d2ebb9e6d8db3e (kmwolf/centos-qemu-kvm)
|
|
|
a83cc2 |
RH-Bugzilla: 1951814
|
|
|
a83cc2 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
qcow2 v3 has been around for a long time (since QEMU 1.1/RHEL 7), so
|
|
|
a83cc2 |
there is no real reason any more to use it. People still using it might
|
|
|
a83cc2 |
do so unintentionally. Warn about it and suggest upgrading during the
|
|
|
a83cc2 |
RHEL 9 timeframe so that the code can possibly be disabled in RHEL 10.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
The warning is restricted to read-write mode and the system emulator.
|
|
|
a83cc2 |
The primary motivation for not having it in qemu-img is that 'qemu-img
|
|
|
a83cc2 |
amend' for upgrades would warn otherwise. It also avoids having to make
|
|
|
a83cc2 |
too many changes to the test suite.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
bdrv_uses_whitelist() is used as a proxy for deciding whether we are
|
|
|
a83cc2 |
running in a tool or the system emulator. This is not entirely clean,
|
|
|
a83cc2 |
but it's what is available and the same function qcow2_do_open() already
|
|
|
a83cc2 |
uses it this way for another warning.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
---
|
|
|
a83cc2 |
block/qcow2.c | 6 ++++++
|
|
|
a83cc2 |
tests/qemu-iotests/common.filter | 1 +
|
|
|
a83cc2 |
2 files changed, 7 insertions(+)
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/block/qcow2.c b/block/qcow2.c
|
|
|
a83cc2 |
index 9727ae8fe3..7c061bf315 100644
|
|
|
a83cc2 |
--- a/block/qcow2.c
|
|
|
a83cc2 |
+++ b/block/qcow2.c
|
|
|
a83cc2 |
@@ -1336,6 +1336,12 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
|
|
|
a83cc2 |
ret = -ENOTSUP;
|
|
|
a83cc2 |
goto fail;
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
+ if (header.version < 3 && !bs->read_only && bdrv_uses_whitelist()) {
|
|
|
a83cc2 |
+ warn_report_once("qcow2 v2 images are deprecated and may not be "
|
|
|
a83cc2 |
+ "supported in future versions. Please consider "
|
|
|
a83cc2 |
+ "upgrading the image with 'qemu-img amend "
|
|
|
a83cc2 |
+ "-o compat=v3'.");
|
|
|
a83cc2 |
+ }
|
|
|
a83cc2 |
|
|
|
a83cc2 |
s->qcow_version = header.version;
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
|
|
|
a83cc2 |
index 268b749e2f..1f243a8bc1 100644
|
|
|
a83cc2 |
--- a/tests/qemu-iotests/common.filter
|
|
|
a83cc2 |
+++ b/tests/qemu-iotests/common.filter
|
|
|
a83cc2 |
@@ -82,6 +82,7 @@ _filter_qemu()
|
|
|
a83cc2 |
{
|
|
|
a83cc2 |
$SED -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
|
|
|
a83cc2 |
-e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
|
|
|
a83cc2 |
+ -e "/qcow2 v2 images are deprecated/d" \
|
|
|
a83cc2 |
-e $'s#\r##' # QEMU monitor uses \r\n line endings
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
--
|
|
|
a83cc2 |
2.27.0
|
|
|
a83cc2 |
|