mirror of https://github.com/xemu-project/xemu.git
qcow2: Prohibit backing file changes in 'qemu-img amend'
This was deprecated back in bc5ee6da7
(qcow2: Deprecate use of
qemu-img amend to change backing file), and no one in the meantime has
given any reasons why it should be supported. Time to make change
attempts a hard error (but for convenience, specifying the _same_
backing chain is not forbidden). Update a couple of iotests to match.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210503213600.569128-2-eblake@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
2842ff2d81
commit
5a385bf5c5
|
@ -5620,15 +5620,10 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts,
|
||||||
if (backing_file || backing_format) {
|
if (backing_file || backing_format) {
|
||||||
if (g_strcmp0(backing_file, s->image_backing_file) ||
|
if (g_strcmp0(backing_file, s->image_backing_file) ||
|
||||||
g_strcmp0(backing_format, s->image_backing_format)) {
|
g_strcmp0(backing_format, s->image_backing_format)) {
|
||||||
warn_report("Deprecated use of amend to alter the backing file; "
|
error_setg(errp, "Cannot amend the backing file");
|
||||||
"use qemu-img rebase instead");
|
error_append_hint(errp,
|
||||||
}
|
"You can use 'qemu-img rebase' instead.\n");
|
||||||
ret = qcow2_change_backing_file(bs,
|
return -EINVAL;
|
||||||
backing_file ?: s->image_backing_file,
|
|
||||||
backing_format ?: s->image_backing_format);
|
|
||||||
if (ret < 0) {
|
|
||||||
error_setg_errno(errp, -ret, "Failed to change the backing file");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -282,18 +282,6 @@ this CPU is also deprecated.
|
||||||
Related binaries
|
Related binaries
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
qemu-img amend to adjust backing file (since 5.1)
|
|
||||||
'''''''''''''''''''''''''''''''''''''''''''''''''
|
|
||||||
|
|
||||||
The use of ``qemu-img amend`` to modify the name or format of a qcow2
|
|
||||||
backing image is deprecated; this functionality was never fully
|
|
||||||
documented or tested, and interferes with other amend operations that
|
|
||||||
need access to the original backing image (such as deciding whether a
|
|
||||||
v3 zero cluster may be left unallocated when converting to a v2
|
|
||||||
image). Rather, any changes to the backing chain should be performed
|
|
||||||
with ``qemu-img rebase -u`` either before or after the remaining
|
|
||||||
changes being performed by amend, as appropriate.
|
|
||||||
|
|
||||||
qemu-img backing file without format (since 5.1)
|
qemu-img backing file without format (since 5.1)
|
||||||
''''''''''''''''''''''''''''''''''''''''''''''''
|
''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
|
||||||
|
|
|
@ -491,6 +491,18 @@ topologies described with -smp include all possible cpus, i.e.
|
||||||
The ``enforce-config-section`` property was replaced by the
|
The ``enforce-config-section`` property was replaced by the
|
||||||
``-global migration.send-configuration={on|off}`` option.
|
``-global migration.send-configuration={on|off}`` option.
|
||||||
|
|
||||||
|
qemu-img amend to adjust backing file (removed in 6.1)
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
|
||||||
|
The use of ``qemu-img amend`` to modify the name or format of a qcow2
|
||||||
|
backing image was never fully documented or tested, and interferes
|
||||||
|
with other amend operations that need access to the original backing
|
||||||
|
image (such as deciding whether a v3 zero cluster may be left
|
||||||
|
unallocated when converting to a v2 image). Any changes to the
|
||||||
|
backing chain should be performed with ``qemu-img rebase -u`` either
|
||||||
|
before or after the remaining changes being performed by amend, as
|
||||||
|
appropriate.
|
||||||
|
|
||||||
Block devices
|
Block devices
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,9 @@ _make_test_img -o "compat=1.1" 64M
|
||||||
TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
|
TEST_IMG="$TEST_IMG.base" _make_test_img -o "compat=1.1" 64M
|
||||||
$QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
|
$QEMU_IO -c "write -P 0x2a 0 128k" "$TEST_IMG.base" | _filter_qemu_io
|
||||||
$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
|
$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
|
||||||
|
$QEMU_IMG amend -o "backing_file=$TEST_IMG.base,backing_fmt=qcow2" \
|
||||||
|
"$TEST_IMG" && echo "unexpected pass"
|
||||||
|
$QEMU_IMG rebase -u -b "$TEST_IMG.base" -F qcow2 "$TEST_IMG"
|
||||||
$QEMU_IMG amend -o "backing_file=$TEST_IMG.base,backing_fmt=qcow2" "$TEST_IMG"
|
$QEMU_IMG amend -o "backing_file=$TEST_IMG.base,backing_fmt=qcow2" "$TEST_IMG"
|
||||||
$QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
|
$QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
|
||||||
_check_test_img
|
_check_test_img
|
||||||
|
|
|
@ -370,7 +370,8 @@ wrote 131072/131072 bytes at offset 0
|
||||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
read 131072/131072 bytes at offset 0
|
read 131072/131072 bytes at offset 0
|
||||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
qemu-img: warning: Deprecated use of amend to alter the backing file; use qemu-img rebase instead
|
qemu-img: Cannot amend the backing file
|
||||||
|
You can use 'qemu-img rebase' instead.
|
||||||
read 131072/131072 bytes at offset 0
|
read 131072/131072 bytes at offset 0
|
||||||
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
No errors were found on the image.
|
No errors were found on the image.
|
||||||
|
|
|
@ -808,12 +808,14 @@ Amend options for 'qcow2':
|
||||||
size=<size> - Virtual disk size
|
size=<size> - Virtual disk size
|
||||||
|
|
||||||
Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2
|
Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,help TEST_DIR/t.qcow2
|
||||||
qemu-img: warning: Deprecated use of amend to alter the backing file; use qemu-img rebase instead
|
qemu-img: Cannot amend the backing file
|
||||||
|
You can use 'qemu-img rebase' instead.
|
||||||
|
|
||||||
Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2
|
Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2
|
||||||
|
|
||||||
Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2
|
Testing: amend -f qcow2 -o backing_file=TEST_DIR/t.qcow2,,? TEST_DIR/t.qcow2
|
||||||
qemu-img: warning: Deprecated use of amend to alter the backing file; use qemu-img rebase instead
|
qemu-img: Cannot amend the backing file
|
||||||
|
You can use 'qemu-img rebase' instead.
|
||||||
|
|
||||||
Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2
|
Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue