|
|
7711c0 |
From 206d8696a89a1b4076f7afd46b6ae0dcc0f377f5 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 20 Mar 2019 16:16:25 +0100
|
|
|
7711c0 |
Subject: [PATCH 027/163] iotests/236: fix transaction kwarg order
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190320161631.14841-14-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84945
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 13/19] iotests/236: fix transaction kwarg order
|
|
|
7711c0 |
Bugzilla: 1668956
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
It's not enough to order the kwargs for consistent QMP log output,
|
|
|
7711c0 |
we must also sort any sub-dictionaries in lists that appear as values.
|
|
|
7711c0 |
|
|
|
7711c0 |
Reported-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 039be85c410bfb4b53cdee2083b4245e0d4e4181)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/236.out | 56 +++++++++++++++++++++----------------------
|
|
|
7711c0 |
tests/qemu-iotests/iotests.py | 21 ++++++++--------
|
|
|
7711c0 |
2 files changed, 39 insertions(+), 38 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/236.out b/tests/qemu-iotests/236.out
|
|
|
7711c0 |
index 1dad24d..bb2d71e 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/236.out
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/236.out
|
|
|
7711c0 |
@@ -45,23 +45,23 @@ write -P0xcd 0x3ff0000 64k
|
|
|
7711c0 |
"actions": [
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapB"
|
|
|
7711c0 |
+ "name": "bitmapB",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-disable"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
+ "granularity": 65536,
|
|
|
7711c0 |
"name": "bitmapC",
|
|
|
7711c0 |
- "granularity": 65536
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-add"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapA"
|
|
|
7711c0 |
+ "name": "bitmapA",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-clear"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
@@ -105,30 +105,30 @@ write -P0xcd 0x3ff0000 64k
|
|
|
7711c0 |
"actions": [
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapB"
|
|
|
7711c0 |
+ "name": "bitmapB",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-disable"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
+ "granularity": 65536,
|
|
|
7711c0 |
"name": "bitmapC",
|
|
|
7711c0 |
- "granularity": 65536
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-add"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapC"
|
|
|
7711c0 |
+ "name": "bitmapC",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-disable"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapC"
|
|
|
7711c0 |
+ "name": "bitmapC",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-enable"
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -158,15 +158,15 @@ write -P0xea 0x3fe0000 64k
|
|
|
7711c0 |
"actions": [
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapA"
|
|
|
7711c0 |
+ "name": "bitmapA",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-disable"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "name": "bitmapC"
|
|
|
7711c0 |
+ "name": "bitmapC",
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-disable"
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -209,21 +209,21 @@ write -P0xea 0x3fe0000 64k
|
|
|
7711c0 |
"actions": [
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
"disabled": true,
|
|
|
7711c0 |
+ "granularity": 65536,
|
|
|
7711c0 |
"name": "bitmapD",
|
|
|
7711c0 |
- "granularity": 65536
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-add"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "target": "bitmapD",
|
|
|
7711c0 |
"bitmaps": [
|
|
|
7711c0 |
"bitmapB",
|
|
|
7711c0 |
"bitmapC"
|
|
|
7711c0 |
- ]
|
|
|
7711c0 |
+ ],
|
|
|
7711c0 |
+ "node": "drive0",
|
|
|
7711c0 |
+ "target": "bitmapD"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-merge"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
@@ -273,21 +273,21 @@ write -P0xea 0x3fe0000 64k
|
|
|
7711c0 |
"actions": [
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
"disabled": true,
|
|
|
7711c0 |
+ "granularity": 65536,
|
|
|
7711c0 |
"name": "bitmapD",
|
|
|
7711c0 |
- "granularity": 65536
|
|
|
7711c0 |
+ "node": "drive0"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-add"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
{
|
|
|
7711c0 |
"data": {
|
|
|
7711c0 |
- "node": "drive0",
|
|
|
7711c0 |
- "target": "bitmapD",
|
|
|
7711c0 |
"bitmaps": [
|
|
|
7711c0 |
"bitmapB",
|
|
|
7711c0 |
"bitmapC"
|
|
|
7711c0 |
- ]
|
|
|
7711c0 |
+ ],
|
|
|
7711c0 |
+ "node": "drive0",
|
|
|
7711c0 |
+ "target": "bitmapD"
|
|
|
7711c0 |
},
|
|
|
7711c0 |
"type": "block-dirty-bitmap-merge"
|
|
|
7711c0 |
}
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
index d178469..4e9b2c4 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
@@ -74,15 +74,16 @@ def qemu_img(*args):
|
|
|
7711c0 |
sys.stderr.write('qemu-img received signal %i: %s\n' % (-exitcode, ' '.join(qemu_img_args + list(args))))
|
|
|
7711c0 |
return exitcode
|
|
|
7711c0 |
|
|
|
7711c0 |
-def ordered_kwargs(kwargs):
|
|
|
7711c0 |
- # kwargs prior to 3.6 are not ordered, so:
|
|
|
7711c0 |
- od = OrderedDict()
|
|
|
7711c0 |
- for k, v in sorted(kwargs.items()):
|
|
|
7711c0 |
- if isinstance(v, dict):
|
|
|
7711c0 |
- od[k] = ordered_kwargs(v)
|
|
|
7711c0 |
- else:
|
|
|
7711c0 |
- od[k] = v
|
|
|
7711c0 |
- return od
|
|
|
7711c0 |
+def ordered_qmp(qmsg):
|
|
|
7711c0 |
+ # Dictionaries are not ordered prior to 3.6, therefore:
|
|
|
7711c0 |
+ if isinstance(qmsg, list):
|
|
|
7711c0 |
+ return [ordered_qmp(atom) for atom in qmsg]
|
|
|
7711c0 |
+ if isinstance(qmsg, dict):
|
|
|
7711c0 |
+ od = OrderedDict()
|
|
|
7711c0 |
+ for k, v in sorted(qmsg.items()):
|
|
|
7711c0 |
+ od[k] = ordered_qmp(v)
|
|
|
7711c0 |
+ return od
|
|
|
7711c0 |
+ return qmsg
|
|
|
7711c0 |
|
|
|
7711c0 |
def qemu_img_create(*args):
|
|
|
7711c0 |
args = list(args)
|
|
|
7711c0 |
@@ -485,7 +486,7 @@ class VM(qtest.QEMUQtestMachine):
|
|
|
7711c0 |
def qmp_log(self, cmd, filters=[], indent=None, **kwargs):
|
|
|
7711c0 |
full_cmd = OrderedDict((
|
|
|
7711c0 |
("execute", cmd),
|
|
|
7711c0 |
- ("arguments", ordered_kwargs(kwargs))
|
|
|
7711c0 |
+ ("arguments", ordered_qmp(kwargs))
|
|
|
7711c0 |
))
|
|
|
7711c0 |
log(full_cmd, filters, indent=indent)
|
|
|
7711c0 |
result = self.qmp(cmd, **kwargs)
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|