[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v9 07/31] iotests.py: Add node_info
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v9 07/31] iotests.py: Add node_info() |
Date: |
Thu, 9 Aug 2018 19:53:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 2018-08-07 16:49, Alberto Garcia wrote:
> On Thu 28 Jun 2018 02:07:21 AM CEST, Max Reitz wrote:
>> This function queries a node; since we cannot do that right now, it
>> executes query-named-block-nodes and returns the matching node's object.
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> tests/qemu-iotests/iotests.py | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index 5c45788dac..3b18907f6a 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
>> @@ -465,6 +465,13 @@ class VM(qtest.QEMUQtestMachine):
>> else:
>> iotests.log(ev)
>>
>> + def node_info(self, node_name):
>> + nodes = self.qmp('query-named-block-nodes')
>> + for x in nodes['return']:
>> + if x['node-name'] == node_name:
>> + return x
>> + assert False
>> +
>
> There are cases in which you want to verify that a node doesn't exist
> anymore (e.g. after you have removed it), so it would be nice to return
> None if the node doesn't exist.
Can do (and then maybe add a wrapper function that aborts if the node
doesn't exist).
Thanks for reviewing!
Max
> I actually have a similar function (minus the "return None" part) in one
> of my tests from the blockdev-reopen series, so I could make use of this
> one instead.
>
> Berto
>
signature.asc
Description: OpenPGP digital signature