aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-08-14 11:52:25 +0200
committerKevin Wolf <kwolf@redhat.com>2018-08-15 12:50:39 +0200
commit86fae10c64d642256cf019e6829929fa0d259c7a (patch)
tree00b6eb0df7a2de3d00cb1ccc2b3a5d92da5688b6 /tests
parentdbfdf6cb3625c68d0ea84ace4a786406cf43d4f3 (diff)
downloadqemu-86fae10c64d642256cf019e6829929fa0d259c7a.zip
qemu-86fae10c64d642256cf019e6829929fa0d259c7a.tar.gz
qemu-86fae10c64d642256cf019e6829929fa0d259c7a.tar.bz2
mirror: Fail gracefully for source == target
blockdev-mirror with the same node for source and target segfaults today: A node is in its own backing chain, so mirror_start_job() decides that this is an active commit. When adding the intermediate nodes with block_job_add_bdrv(), it starts the iteration through the subchain with the backing file of source, though, so it never reaches target and instead runs into NULL at the base. While we could fix that by starting with source itself, there is no point in allowing mirroring a node into itself and I wouldn't be surprised if this caused more problems later. So just check for this scenario and error out. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/0416
-rw-r--r--tests/qemu-iotests/041.out4
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index c20ac7d..9336ab6 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -234,6 +234,12 @@ class TestSingleBlockdev(TestSingleDrive):
result = self.vm.qmp("blockdev-add", **args)
self.assert_qmp(result, 'return', {})
+ def test_mirror_to_self(self):
+ result = self.vm.qmp(self.qmp_cmd, job_id='job0',
+ device=self.qmp_target, sync='full',
+ target=self.qmp_target)
+ self.assert_qmp(result, 'error/class', 'GenericError')
+
test_large_cluster = None
test_image_not_found = None
test_small_buffer2 = None
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
index c28b392..e071d0b 100644
--- a/tests/qemu-iotests/041.out
+++ b/tests/qemu-iotests/041.out
@@ -1,5 +1,5 @@
-.....................................................................................
+........................................................................................
----------------------------------------------------------------------
-Ran 85 tests
+Ran 88 tests
OK