[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/4] iotests: Add test for failing mirror comple
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH 4/4] iotests: Add test for failing mirror complete |
Date: |
Thu, 19 Sep 2019 18:51:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 18.09.19 18:30, Vladimir Sementsov-Ogievskiy wrote:
> 12.09.2019 16:56, Max Reitz wrote:
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> tests/qemu-iotests/041 | 44 ++++++++++++++++++++++++++++++++++++++
>> tests/qemu-iotests/041.out | 4 ++--
>> 2 files changed, 46 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
>> index 8568426311..84bc6d6581 100755
>> --- a/tests/qemu-iotests/041
>> +++ b/tests/qemu-iotests/041
>> @@ -1121,6 +1121,50 @@ class TestOrphanedSource(iotests.QMPTestCase):
>> target='dest-ro')
>> self.assert_qmp(result, 'error/class', 'GenericError')
>>
>> + def test_failing_permission_in_complete(self):
>> + self.assert_no_active_block_jobs()
>> +
>> + # Unshare consistent-read on the target
>> + # (The mirror job does not care)
>> + result = self.vm.qmp('blockdev-add',
>> + driver='blkdebug',
>> + node_name='dest-perm',
>> + image='dest',
>> + unshare_child_perms=['consistent-read'])
>> + self.assert_qmp(result, 'return', {})
>> +
>> + result = self.vm.qmp('blockdev-mirror', job_id='job', device='src',
>> + sync='full', target='dest',
>> + filter_node_name='mirror-filter')
>> + self.assert_qmp(result, 'return', {})
>> +
>> + # Require consistent-read on the source
>> + # (We can only add this node once the job has started, or it
>> + # will complain that it does not want to run on non-root nodes)
>> + result = self.vm.qmp('blockdev-add',
>> + driver='blkdebug',
>> + node_name='src-perm',
>> + image='src',
>> + take_child_perms=['consistent-read'])
>> + self.assert_qmp(result, 'return', {})
>> +
>> + # While completing, mirror will attempt to replace src by
>> + # dest, which must fail because src-perm requires
>> + # consistent-read but dest-perm does not share it; thus
>> + # aborting the job when it is supposed to complete
>> + self.complete_and_wait('job',
>> + completion_error='Operation not permitted')
>> +
>> + # Assert that all of our nodes are still there (except for the
>> + # mirror filter, which should be gone despite the failure)
>> + nodes = self.vm.qmp('query-named-block-nodes')['return']
>> + nodes = list(map(lambda image: image['node-name'], nodes))
>
> using list comprehension is a bit more pythonic:
> nodes = [node['node-name'] for node in nodes]
OK. I can never remember, so I rarely bother using list/dict
comprehensions and instead use what I would do in any other language.
(Hence the “Sadly” from John.)
(And then wait for some kind reviewer to tell me how to do it right. :-))
Max
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [Qemu-devel] [PATCH 1/4] mirror: Do not dereference invalid pointers, (continued)
Re: [Qemu-block] [Qemu-devel] [PATCH 0/4] mirror: Do not dereference invalid pointers, Vladimir Sementsov-Ogievskiy, 2019/09/18