Skip to contentSkip to conversation

Block layer patches for 4.2.0-rc2

GIT PULL Applied Kevin Wolf 2 participants 6 messages Nov 18, 2019

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

The following changes since commit bbe165740a96f67f48ecd3029dc26bdd7fd5192c:

Merge remote-tracking branch 'remotes/vivier2/tags/ppc-for-4.2-pull-request' into staging (2019-11-18 11:09:06 +0000)

are available in the Git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to b1f6a8e180367c945b67c6c9bbcec5c856be3779:

iotests: Test multiple blockdev-snapshot calls (2019-11-18 17:50:08 +0100)

----------------------------------------------------------------
Block layer patches:

- Fix HMP savevm with -blockdev
- Minor iotests improvements

----------------------------------------------------------------
Kevin Wolf (3):
iotests: Fix "no qualified output" error path
block: Remove 'backing': null from bs->{explicit_,}options
iotests: Test multiple blockdev-snapshot calls

Vladimir Sementsov-Ogievskiy (1):
qemu-iotests/iotests.py: improve assert_qmp message

 block.c                       |   2 +
 tests/qemu-iotests/273        |  76 ++++++++++
 tests/qemu-iotests/273.out    | 337 ++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/check      |   2 +-
 tests/qemu-iotests/group      |   1 +
 tests/qemu-iotests/iotests.py |   4 +-
 6 files changed, 419 insertions(+), 3 deletions(-)
 create mode 100755 tests/qemu-iotests/273
 create mode 100644 tests/qemu-iotests/273.out
author
#1 lore raw

[PULL 3/4] block: Remove 'backing': null from bs->{explicit_, }options

bs->options and bs->explicit_options shouldn't contain any options for child nodes. bdrv_open_inherited() takes care to remove any options that match a child name after opening the image and the same is done when reopening.

However, we miss the case of 'backing': null, which is a child option, but results in no child being created. This means that a 'backing': null remains in bs->options and bs->explicit_options.

A typical use for 'backing': null is in live snapshots: blockdev-add for the qcow2 overlay makes sure not to open the backing file (because it is already opened and blockdev-snapshot will attach it). After doing a blockdev-snapshot, bs->options and bs->explicit_options become inconsistent with the actual state (bs has a backing file now, but the options still say null). On the next occasion that the image is reopened, e.g. switching it from read-write to read-only when another snapshot is taken, the option will take effect again and the node incorrectly loses its backing file.

Fix bdrv_open_inherited() to remove the 'backing' option from bs->options and bs->explicit_options even for the case where it specifies that no backing file is wanted.

---
 block.c | 2 ++
 1 file changed, 2 insertions(+)
block.c +2 -0
index 4cffc2bc35..473eb6eeaa 100644
@@ -3019,6 +3019,8 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
                         "use \"backing\": null instead");
         }
         flags |= BDRV_O_NO_BACKING;
+        qdict_del(bs->explicit_options, "backing");
+        qdict_del(bs->options, "backing");
         qdict_del(options, "backing");
     }
 
Signature · 1 line
2.20.1
author
#2 lore raw

[PULL 2/4] iotests: Fix "no qualified output" error path

In reply to Kevin Wolf

The variable for error messages to be displayed is $results, not $reason. Fix 'check' to print the "no qualified output" error message again instead of having a failure without any message telling the user why it failed.

---
 tests/qemu-iotests/check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/check +1 -1
index 71fe38834e..90970b0549 100755
@@ -887,7 +887,7 @@ do
             if [ ! -f "$reference" ]
             then
                 status="fail"
-                reason="no qualified output"
+                results="no qualified output"
                 err=true
             else
                 if diff -w "$reference" $tmp.out >/dev/null 2>&1
Signature · 1 line
2.20.1
author
#3 lore raw

[PULL 4/4] iotests: Test multiple blockdev-snapshot calls

In reply to Kevin Wolf

Test that doing a second blockdev-snapshot doesn't make the first overlay's backing file go away.

---
 tests/qemu-iotests/273     |  76 +++++++++
 tests/qemu-iotests/273.out | 337 +++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/group   |   1 +
 3 files changed, 414 insertions(+)
 create mode 100755 tests/qemu-iotests/273
 create mode 100644 tests/qemu-iotests/273.out
tests/qemu-iotests/273 new file +76 -0
new file mode 100755
index 0000000000..98a672516d
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+#
+# Test multiple blockdev-snapshot calls with 'backing': null
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+seq=$(basename "$0")
+echo "QA output created by $seq"
+
+status=1	# failure is the default!
+
+_cleanup()
+{
+    _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# This is a qcow2 regression test
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+
+do_run_qemu()
+{
+    echo Testing: "$@"
+    $QEMU -nographic -qmp-pretty stdio -nodefaults "$@"
+    echo
+}
+
+run_qemu()
+{
+    do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp |
+        _filter_generated_node_ids | _filter_imgfmt | _filter_actual_image_size
+}
+
+TEST_IMG="$TEST_IMG.base" _make_test_img 64M
+TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
+_make_test_img -b "$TEST_IMG.mid"
+
+run_qemu \
+    -blockdev file,node-name=base,filename="$TEST_IMG.base" \
+     -blockdev file,node-name=midf,filename="$TEST_IMG.mid" \
+     -blockdev '{"driver":"qcow2","node-name":"mid","file":"midf","backing":null}' \
+     -blockdev file,node-name=topf,filename="$TEST_IMG" \
+     -blockdev '{"driver":"qcow2","file":"topf","node-name":"top","backing":null}' \
+<<EOF
+{"execute":"qmp_capabilities"}
+{"execute":"blockdev-snapshot","arguments":{"node":"base","overlay":"mid"}}
+{"execute":"blockdev-snapshot","arguments":{"node":"mid","overlay":"top"}}
+{"execute":"query-named-block-nodes"}
+{"execute":"x-debug-query-block-graph"}
+{"execute":"quit"}
+EOF
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
tests/qemu-iotests/273.out new file +337 -0

337 lines not on this page · raw message

tests/qemu-iotests/group +1 -0
index 065040398d..c56bb69031 100644
@@ -284,3 +284,4 @@
 268 rw auto quick
 270 rw backing quick
 272 rw
+273 backing quick
Signature · 1 line
2.20.1
author
#4 lore raw

[PULL 1/4] qemu-iotests/iotests.py: improve assert_qmp message

In reply to Kevin Wolf

From: Vladimir Sementsov-Ogievskiy <[email protected]>

From the two values compared, make it obvious which is found at path, and which is expected.

---
 tests/qemu-iotests/iotests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/iotests.py +2 -2
index 075f4739da..6a248472b9 100644
@@ -731,8 +731,8 @@ class QMPTestCase(unittest.TestCase):
             self.fail('no match for "%s" in %s' % (str(result), str(value)))
         else:
             self.assertEqual(result, value,
-                             'values not equal "%s" and "%s"'
-                                 % (str(result), str(value)))
+                             '"%s" is "%s", expected "%s"'
+                                 % (path, str(result), str(value)))
 
     def assert_no_active_block_jobs(self):
         result = self.vm.qmp('query-block-jobs')
Signature · 1 line
2.20.1
#5 lore raw
In reply to Kevin Wolf
Quoted 19 lines · Kevin Wolf

The following changes since commit bbe165740a96f67f48ecd3029dc26bdd7fd5192c:

Merge remote-tracking branch 'remotes/vivier2/tags/ppc-for-4.2-pull-request' into staging (2019-11-18 11:09:06 +0000)

are available in the Git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to b1f6a8e180367c945b67c6c9bbcec5c856be3779:

iotests: Test multiple blockdev-snapshot calls (2019-11-18 17:50:08 +0100)

----------------------------------------------------------------
Block layer patches:

- Fix HMP savevm with -blockdev
- Minor iotests improvements

Quoted 8 lines

----------------------------------------------------------------
Kevin Wolf (3):
iotests: Fix "no qualified output" error path
block: Remove 'backing': null from bs->{explicit_,}options
iotests: Test multiple blockdev-snapshot calls

Vladimir Sementsov-Ogievskiy (1):
qemu-iotests/iotests.py: improve assert_qmp message

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM