From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Krempa <pkrempa@redhat.com>, John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org,
"open list:Block layer core" <qemu-block@nongnu.org>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [PULL 3/5] qemu-iotests: 300: Add test case for modifying persistence of bitmap
Date: Mon, 15 Feb 2021 12:25:57 -0600 [thread overview]
Message-ID: <42192dc8-329c-ef2d-d8f7-3d02ae9d2c85@redhat.com> (raw)
In-Reply-To: <20210215170902.GS7226@merkur.fritz.box>
On 2/15/21 11:09 AM, Kevin Wolf wrote:
>>> This breaks 297:
>>> === mypy ===
>>> +300:646: error: Dict entry 2 has incompatible type "str": "Dict[str, bool]"; expected "str": "str"
>>> +Found 1 error in 1 file (checked 1 source file)
>>
>> is beyond my skill. The typing at line 33:
>>
>> BlockBitmapMapping = List[Dict[str, Union[str, List[Dict[str, str]]]]]
>>
>> is insufficient to allow our new 'transform' member in the new
>> transform_mapping() -> Block BitmapMapping near line 677:
>>
>> 'bitmaps': [
>> {
>> 'name': 'bmap-a',
>> 'alias': 'bmap-a',
>> 'transform':
>> {
>> 'persistent': True
>> }
>> },
>>
>> but I'm not sure how to tell python the right type it should be. John?
>
> To be honest, this looks sufficiently like JSON that I would just go for
> List[Dict[str, Any]] (as long as recursive types don't work), but if you
> really want to have an explicit type, I think you'd have to replace the
> rightmost str with Union[str, Dict[str, bool]] to allow both.
Indeed, I played with it before reading your response, and came up with
this. Shall I turn it into a formal patch?
diff --git i/tests/qemu-iotests/300 w/tests/qemu-iotests/300
index 63036f6a6e13..7501bd1018e2 100755
--- i/tests/qemu-iotests/300
+++ w/tests/qemu-iotests/300
@@ -30,7 +30,10 @@ import iotests
# pylint: disable=wrong-import-order
import qemu
-BlockBitmapMapping = List[Dict[str, Union[str, List[Dict[str, str]]]]]
+BlockBitmapMapping = List[Dict[str,
+ Union[str,
+ List[Dict[str,
+ Union[str, Dict[str,
bool]]]]]]]
mig_sock = os.path.join(iotests.sock_dir, 'mig_sock')
@@ -602,7 +605,8 @@ class TestCrossAliasMigration(TestDirtyBitmapMigration):
class TestAliasTransformMigration(TestDirtyBitmapMigration):
"""
- Tests the 'transform' option which modifies bitmap persistence on
migration.
+ Tests the 'transform' option which modifies bitmap persistence on
+ migration.
"""
src_node_name = 'node-a'
@@ -674,7 +678,8 @@ class
TestAliasTransformMigration(TestDirtyBitmapMigration):
bitmaps = self.vm_b.query_bitmaps()
for node in bitmaps:
- bitmaps[node] = sorted(((bmap['name'], bmap['persistent'])
for bmap in bitmaps[node]))
+ bitmaps[node] = sorted(((bmap['name'], bmap['persistent'])
+ for bmap in bitmaps[node]))
self.assertEqual(bitmaps,
{'node-a': [('bmap-a', True), ('bmap-b', False)],
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2021-02-15 18:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 23:21 [PULL 0/5] bitmaps patches through 2021-02-12 Eric Blake
2021-02-12 23:21 ` [PULL 1/5] migration: dirty-bitmap: Use struct for alias map inner members Eric Blake
2021-02-12 23:21 ` [PULL 2/5] migration: dirty-bitmap: Allow control of bitmap persistence Eric Blake
2021-02-12 23:21 ` [PULL 3/5] qemu-iotests: 300: Add test case for modifying persistence of bitmap Eric Blake
2021-02-15 12:31 ` Kevin Wolf
2021-02-15 16:46 ` Eric Blake
2021-02-15 17:09 ` Kevin Wolf
2021-02-15 18:25 ` Eric Blake [this message]
2021-02-15 19:00 ` John Snow
2021-02-15 20:26 ` Eric Blake
2021-02-15 21:37 ` John Snow
2021-02-12 23:21 ` [PULL 4/5] block: return status from bdrv_append and friends Eric Blake
2021-02-12 23:21 ` [PULL 5/5] block: use return status of bdrv_append() Eric Blake
2021-02-14 18:45 ` [PULL 0/5] bitmaps patches through 2021-02-12 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42192dc8-329c-ef2d-d8f7-3d02ae9d2c85@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).