[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: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v9 07/31] iotests.py: Add node_info() |
Date: |
Tue, 07 Aug 2018 16:49:42 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
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.
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
- Re: [Qemu-devel] [Qemu-block] [PATCH v9 07/31] iotests.py: Add node_info(),
Alberto Garcia <=