Skip to contentSkip to conversation

qemu-iotests/195: Change multiple nodes in one run

PATCH In review Kevin Wolf 2 participants 2 messages Sep 20, 2017

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-iotests/195: Change multiple nodes in one run

This additional check for change-backing-file makes sure that actions on one part of the graph don't interfere with later actions elsewhere.

---
 tests/qemu-iotests/195     | 17 ++++++++++++++++
 tests/qemu-iotests/195.out | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
tests/qemu-iotests/195 +17 -0
index 05a239cbf5..eb2861380d 100755
@@ -86,6 +86,23 @@ EOF
 
 _img_info
 
+echo
+echo "Change backing file of multiple nodes in a single run"
+echo
+
+_make_test_img -b "$TEST_IMG.mid"
+
+run_qemu -drive if=none,file="$TEST_IMG",node-name=top,backing.node-name=mid <<EOF
+{"execute":"qmp_capabilities"}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"top","backing-file":"/dev/null"}}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
+{"execute":"quit"}
+EOF
+
+TEST_IMG="$TEST_IMG.mid" _img_info
+_img_info
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
tests/qemu-iotests/195.out +51 -0

55 lines not on this page · raw message

Signature · 1 line
2.13.5
#1 lore raw
Quoted 11 lines · Kevin Wolf

This additional check for change-backing-file makes sure that actions on one part of the graph don't interfere with later actions elsewhere.

---
 tests/qemu-iotests/195     | 17 ++++++++++++++++
 tests/qemu-iotests/195.out | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

tests/qemu-iotests/195 EOF · line 98

Quoted 4 lines
tests/qemu-iotests/195 +4 -0
+run_qemu -drive if=none,file="$TEST_IMG",node-name=top,backing.node-name=mid <<EOF
+{"execute":"qmp_capabilities"}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"top","backing-file":"/dev/null"}}

I guess 'mid' is still accessible even though 'top' now no longer points to mid in the header, because we rely on our cache of the relationships rather than what is written into the header (of course, as soon as qemu quits, we've broken the chain, but that doesn't matter for this test).

Quoted 1 line

+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}

Should the second modification to 'mid' be distinct from the first (as in, back to $TEST_IMG.mid), to make sure we are actually making another change, rather than triggering some short-cut that might treat a no-op change as something that can be skipped? Even bouncing between "$TEST_IMG.mid", "./$TEST_IMG.mid", and "././$TEST_IMG.mid" will access the same file (and thus not break the chain), while still making it obvious which changes took effect, when compared to your change to /dev/null.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org