[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v9 07/13] iotests: prepare 124 and 257 bitmap qu
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v9 07/13] iotests: prepare 124 and 257 bitmap querying for backup-top filter |
Date: |
Wed, 28 Aug 2019 18:40:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 26.08.19 18:13, Vladimir Sementsov-Ogievskiy wrote:
> After backup-top filter appearing it's not possible to see dirty
> bitmaps in top node, so use node-name instead.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
> tests/qemu-iotests/124 | 3 +-
> tests/qemu-iotests/257 | 39 +---
> tests/qemu-iotests/257.out | 364 +++++++++++++---------------------
> tests/qemu-iotests/iotests.py | 22 ++
> 4 files changed, 173 insertions(+), 255 deletions(-)
>
> diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124
> index 3440f54781..8b6024769c 100755
> --- a/tests/qemu-iotests/124
> +++ b/tests/qemu-iotests/124
> @@ -749,8 +749,7 @@ class
> TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
>
> # Bitmap Status Check
> query = self.vm.qmp('query-block')
> - ret = [bmap for bmap in query['return'][0]['dirty-bitmaps']
> - if bmap.get('name') == bitmap.name][0]
> + ret = self.vm.get_bitmap(None, drive0['id'], bitmap.name)
> self.assert_qmp(ret, 'count', 458752)
> self.assert_qmp(ret, 'granularity', 65536)
> self.assert_qmp(ret, 'status', 'frozen')
I see a couple more instances of querying the bitmaps through
query-block here. Wouldn’t it make sense to replace them all with
get_bitmap()?
[...]
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 84438e837c..9381964d9f 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -643,6 +643,28 @@ class VM(qtest.QEMUQtestMachine):
> return x
> return None
>
> + def query_bitmaps(self):
> + res = self.qmp("query-named-block-nodes")
> + return {"bitmaps": {device['node-name']: device['dirty-bitmaps']
> + for device in res['return']
> + if 'dirty-bitmaps' in device}}
I’d leave the wrapping in {"bitmaps": x} to the callers, if they need it.
> +
> + def get_bitmap(self, bitmaps, node_name, name, recording=None):
> + """
> + get a specific bitmap from the object returned by query_bitmaps.
> + :param recording: If specified, filter results by the specified
> value.
> + """
> + if bitmaps is None:
> + bitmaps = self.query_bitmaps()
> +
> + for bitmap in bitmaps['bitmaps'][node_name]:
> + if bitmap.get('name', '') == name:
> + if recording is None:
> + return bitmap
> + elif bitmap.get('recording') == recording:
> + return bitmap
Maybe add a “break” or “return None” here?
(Yes, yes, you just moved existing code. Still.)
Max
> + return None
> +
>
> index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
>
>
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-block] [PATCH v9 05/13] block: move block_copy from block/backup.c to separate file, (continued)