diff options
author | Max Reitz | 2017-04-03 19:51:50 +0200 |
---|---|---|
committer | Kevin Wolf | 2017-04-07 14:44:06 +0200 |
commit | 5694923ad1c60a86383244793663c0715bd88e83 (patch) | |
tree | 18eebd64cbbc8c4b0cd41e8d0864c93e07ad4fcf /tests/qemu-iotests/041 | |
parent | block/mirror: Fix use-after-free (diff) | |
download | qemu-5694923ad1c60a86383244793663c0715bd88e83.tar.gz qemu-5694923ad1c60a86383244793663c0715bd88e83.tar.xz qemu-5694923ad1c60a86383244793663c0715bd88e83.zip |
iotests: Add mirror tests for orphaned source
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/041')
-rwxr-xr-x | tests/qemu-iotests/041 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index bc6cf782fe..2f54986434 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -966,5 +966,51 @@ class TestRepairQuorum(iotests.QMPTestCase): # to check that this file is really driven by quorum self.vm.shutdown() +# Test mirroring with a source that does not have any parents (not even a +# BlockBackend) +class TestOrphanedSource(iotests.QMPTestCase): + def setUp(self): + blk0 = { 'node-name': 'src', + 'driver': 'null-co' } + + blk1 = { 'node-name': 'dest', + 'driver': 'null-co' } + + blk2 = { 'node-name': 'dest-ro', + 'driver': 'null-co', + 'read-only': 'on' } + + self.vm = iotests.VM() + self.vm.add_blockdev(self.qmp_to_opts(blk0)) + self.vm.add_blockdev(self.qmp_to_opts(blk1)) + self.vm.add_blockdev(self.qmp_to_opts(blk2)) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + + def test_no_job_id(self): + self.assert_no_active_block_jobs() + + result = self.vm.qmp('blockdev-mirror', device='src', sync='full', + target='dest') + self.assert_qmp(result, 'error/class', 'GenericError') + + def test_success(self): + self.assert_no_active_block_jobs() + + result = self.vm.qmp('blockdev-mirror', job_id='job', device='src', + sync='full', target='dest') + self.assert_qmp(result, 'return', {}) + + self.complete_and_wait('job') + + def test_failing_permissions(self): + self.assert_no_active_block_jobs() + + result = self.vm.qmp('blockdev-mirror', device='src', sync='full', + target='dest-ro') + self.assert_qmp(result, 'error/class', 'GenericError') + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'qed']) |