Blame SOURCES/kvm-iotests-remove-default-filters-from-qmp_log.patch

7711c0
From ca5abb0f6123f6699f84125c7c358e29c5cce2a7 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 20 Mar 2019 16:16:21 +0100
7711c0
Subject: [PATCH 023/163] iotests: remove default filters from qmp_log
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190320161631.14841-10-jsnow@redhat.com>
7711c0
Patchwork-id: 84942
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 09/19] iotests: remove default filters from qmp_log
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
Several places in iotests deal with serializing objects into JSON
7711c0
strings, but to add pretty-printing it seems desirable to localize
7711c0
all of those cases.
7711c0
7711c0
log() seems like a good candidate for that centralized behavior.
7711c0
log() can already serialize json objects, but when it does so,
7711c0
it assumes filters=[] operates on QMP objects, not strings.
7711c0
7711c0
qmp_log currently operates by dumping outgoing and incoming QMP
7711c0
objects into strings and filtering them assuming that filters=[]
7711c0
are string filters.
7711c0
7711c0
To have qmp_log use log's serialization, qmp_log will need to
7711c0
accept only qmp filters, not text filters.
7711c0
7711c0
However, only a single caller of qmp_log actually requires any
7711c0
filters at all. I remove the default filter and add it explicitly
7711c0
to the caller in preparation for refactoring qmp_log to use rich
7711c0
filters instead.
7711c0
7711c0
test 206 is amended to name the filter explicitly and the default
7711c0
is removed.
7711c0
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
Message-Id: <20181221093529.23855-9-jsnow@redhat.com>
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
(cherry picked from commit f8ca8609d8549def45b28e82ecac64adaeee9f12)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 tests/qemu-iotests/206        | 8 ++++++--
7711c0
 tests/qemu-iotests/iotests.py | 2 +-
7711c0
 2 files changed, 7 insertions(+), 3 deletions(-)
7711c0
7711c0
diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206
7711c0
index 128c334..e92550f 100755
7711c0
--- a/tests/qemu-iotests/206
7711c0
+++ b/tests/qemu-iotests/206
7711c0
@@ -26,7 +26,9 @@ from iotests import imgfmt
7711c0
 iotests.verify_image_format(supported_fmts=['qcow2'])
7711c0
 
7711c0
 def blockdev_create(vm, options):
7711c0
-    result = vm.qmp_log('blockdev-create', job_id='job0', options=options)
7711c0
+    result = vm.qmp_log('blockdev-create',
7711c0
+                        filters=[iotests.filter_testfiles],
7711c0
+                        job_id='job0', options=options)
7711c0
 
7711c0
     if 'return' in result:
7711c0
         assert result['return'] == {}
7711c0
@@ -52,7 +54,9 @@ with iotests.FilePath('t.qcow2') as disk_path, \
7711c0
                           'filename': disk_path,
7711c0
                           'size': 0 })
7711c0
 
7711c0
-    vm.qmp_log('blockdev-add', driver='file', filename=disk_path,
7711c0
+    vm.qmp_log('blockdev-add',
7711c0
+               filters=[iotests.filter_testfiles],
7711c0
+               driver='file', filename=disk_path,
7711c0
                node_name='imgfile')
7711c0
 
7711c0
     blockdev_create(vm, { 'driver': imgfmt,
7711c0
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
7711c0
index bd508be..30d198a 100644
7711c0
--- a/tests/qemu-iotests/iotests.py
7711c0
+++ b/tests/qemu-iotests/iotests.py
7711c0
@@ -454,7 +454,7 @@ class VM(qtest.QEMUQtestMachine):
7711c0
             result.append(filter_qmp_event(ev))
7711c0
         return result
7711c0
 
7711c0
-    def qmp_log(self, cmd, filters=[filter_testfiles], **kwargs):
7711c0
+    def qmp_log(self, cmd, filters=[], **kwargs):
7711c0
         full_cmd = OrderedDict((
7711c0
             ("execute", cmd),
7711c0
             ("arguments", ordered_kwargs(kwargs))
7711c0
-- 
7711c0
1.8.3.1
7711c0