[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-3.1 v10 07/31] iotests.py: Add node_info()
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH for-3.1 v10 07/31] iotests.py: Add node_info() |
Date: |
Wed, 29 Aug 2018 11:45:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 2018-08-28 14:48, Alberto Garcia wrote:
> On Thu 09 Aug 2018 11:35:04 PM 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 | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index 5c45788dac..6583001ac8 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
>> @@ -465,6 +465,16 @@ class VM(qtest.QEMUQtestMachine):
>> else:
>> iotests.log(ev)
>>
>> + def node_info(self, node_name, require_existence=True):
>> + nodes = self.qmp('query-named-block-nodes')
>> + for x in nodes['return']:
>> + if x['node-name'] == node_name:
>> + return x
>> + if require_existence:
>> + assert False
>> + else:
>> + return None
>> +
>
> I don't think you need the require_existence parameter here... if you
> simply return None you'll get an error as soon as you try to use the
> return value.
Hm! True. I'm not sure I like the non-verbosity of "Did not find key X
in None" (or whatever error Python's going to throw), but then again,
"assert False" is not really any better. So, yep, will change.
Thanks for reviewing,
Max
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH for-3.1 v10 03/31] block: Skip implicit nodes for filename info, (continued)
- [Qemu-devel] [PATCH for-3.1 v10 03/31] block: Skip implicit nodes for filename info, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 01/31] block: Use bdrv_refresh_filename() to pull, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 04/31] block: Add BDS.auto_backing_file, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 06/31] iotests.py: Add filter_imgfmt(), Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 05/31] block: Respect backing bs in bdrv_refresh_filename, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 07/31] iotests.py: Add node_info(), Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 09/31] block: Make path_combine() return the path, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 08/31] iotests: Add test for backing file overrides, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 10/31] block: bdrv_get_full_backing_filename_from_...'s ret. val., Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 12/31] block: Add bdrv_make_absolute_filename(), Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 11/31] block: bdrv_get_full_backing_filename's ret. val., Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 13/31] block: Fix bdrv_find_backing_image(), Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 14/31] block: Add bdrv_dirname(), Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 15/31] blkverify: Make bdrv_dirname() return NULL, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 16/31] quorum: Make bdrv_dirname() return NULL, Max Reitz, 2018/08/09
- [Qemu-devel] [PATCH for-3.1 v10 18/31] block/nfs: Implement bdrv_dirname(), Max Reitz, 2018/08/09