[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] iotests/236: fix transaction kwarg order
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] iotests/236: fix transaction kwarg order |
Date: |
Wed, 30 Jan 2019 21:44:06 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/30/19 8:26 PM, John Snow wrote:
> It's not enough to order the kwargs for consistent QMP log output,
> we must also sort any sub-dictionaries in lists that appear as values.
>
> Reported-by: Kevin Wolf <address@hidden>
> Signed-off-by: John Snow <address@hidden>
> ---
> tests/qemu-iotests/236.out | 56 +++++++++++++++++------------------
> tests/qemu-iotests/iotests.py | 21 ++++++-------
> 2 files changed, 39 insertions(+), 38 deletions(-)
>
> +++ b/tests/qemu-iotests/iotests.py
> @@ -76,15 +76,16 @@ def qemu_img(*args):
> sys.stderr.write('qemu-img received signal %i: %s\n' % (-exitcode, '
> '.join(qemu_img_args + list(args))))
> return exitcode
>
> -def ordered_kwargs(kwargs):
> - # kwargs prior to 3.6 are not ordered, so:
> - od = OrderedDict()
> - for k, v in sorted(kwargs.items()):
> - if isinstance(v, dict):
> - od[k] = ordered_kwargs(v)
> - else:
> - od[k] = v
> - return od
> +def ordered_qmp(qmsg):
> + # Dictionaries are not ordered prior to 3.6, therefore:
> + if isinstance(qmsg, list):
> + return [ordered_qmp(atom) for atom in qmsg]
> + if isinstance(qmsg, dict):
> + od = OrderedDict()
> + for k, v in sorted(qmsg.items()):
> + od[k] = ordered_qmp(v)
> + return od
> + return qmsg
>
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature