Blame SOURCES/kvm-qemu-iotests-add-203-savevm-with-IOThreads-test.patch

9bac43
From 8c4af840ec684f51a9159ab65550653600ade7e8 Mon Sep 17 00:00:00 2001
9bac43
From: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Date: Fri, 22 Dec 2017 11:09:00 +0100
9bac43
Subject: [PATCH 42/42] qemu-iotests: add 203 savevm with IOThreads test
9bac43
9bac43
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Message-id: <20171222110900.24813-21-stefanha@redhat.com>
9bac43
Patchwork-id: 78502
9bac43
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 20/20] qemu-iotests: add 203 savevm with IOThreads test
9bac43
Bugzilla: 1519721
9bac43
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
This test case will prevent future regressions with savevm and
9bac43
IOThreads.
9bac43
9bac43
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Reviewed-by: Eric Blake <eblake@redhat.com>
9bac43
Message-id: 20171207201320.19284-7-stefanha@redhat.com
9bac43
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
(cherry picked from commit 7a9dda0d7f9831c2432620dcfefdadbb7ae888dc)
9bac43
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 tests/qemu-iotests/203     | 59 ++++++++++++++++++++++++++++++++++++++++++++++
9bac43
 tests/qemu-iotests/203.out |  6 +++++
9bac43
 tests/qemu-iotests/group   |  1 +
9bac43
 3 files changed, 66 insertions(+)
9bac43
 create mode 100755 tests/qemu-iotests/203
9bac43
 create mode 100644 tests/qemu-iotests/203.out
9bac43
9bac43
diff --git a/tests/qemu-iotests/203 b/tests/qemu-iotests/203
9bac43
new file mode 100755
9bac43
index 0000000..2c81191
9bac43
--- /dev/null
9bac43
+++ b/tests/qemu-iotests/203
9bac43
@@ -0,0 +1,59 @@
9bac43
+#!/usr/bin/env python
9bac43
+#
9bac43
+# Copyright (C) 2017 Red Hat, Inc.
9bac43
+#
9bac43
+# This program is free software; you can redistribute it and/or modify
9bac43
+# it under the terms of the GNU General Public License as published by
9bac43
+# the Free Software Foundation; either version 2 of the License, or
9bac43
+# (at your option) any later version.
9bac43
+#
9bac43
+# This program is distributed in the hope that it will be useful,
9bac43
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9bac43
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9bac43
+# GNU General Public License for more details.
9bac43
+#
9bac43
+# You should have received a copy of the GNU General Public License
9bac43
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
9bac43
+#
9bac43
+# Creator/Owner: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
+#
9bac43
+# Check that QMP 'migrate' with multiple drives on a single IOThread completes
9bac43
+# successfully.  This particular command triggered a hang in the source QEMU
9bac43
+# process due to recursive AioContext locking in bdrv_invalidate_all() and
9bac43
+# BDRV_POLL_WHILE().
9bac43
+
9bac43
+import iotests
9bac43
+
9bac43
+iotests.verify_image_format(supported_fmts=['qcow2'])
9bac43
+iotests.verify_platform(['linux'])
9bac43
+
9bac43
+with iotests.FilePath('disk0.img') as disk0_img_path, \
9bac43
+     iotests.FilePath('disk1.img') as disk1_img_path, \
9bac43
+     iotests.VM() as vm:
9bac43
+
9bac43
+    img_size = '10M'
9bac43
+    iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk0_img_path, img_size)
9bac43
+    iotests.qemu_img_pipe('create', '-f', iotests.imgfmt, disk1_img_path, img_size)
9bac43
+
9bac43
+    iotests.log('Launching VM...')
9bac43
+    (vm.add_object('iothread,id=iothread0')
9bac43
+       .add_drive(disk0_img_path, 'node-name=drive0-node', interface='none')
9bac43
+       .add_drive(disk1_img_path, 'node-name=drive1-node', interface='none')
9bac43
+       .launch())
9bac43
+
9bac43
+    iotests.log('Setting IOThreads...')
9bac43
+    iotests.log(vm.qmp('x-blockdev-set-iothread',
9bac43
+                       node_name='drive0-node', iothread='iothread0',
9bac43
+                       force=True))
9bac43
+    iotests.log(vm.qmp('x-blockdev-set-iothread',
9bac43
+                       node_name='drive1-node', iothread='iothread0',
9bac43
+                       force=True))
9bac43
+
9bac43
+    iotests.log('Starting migration...')
9bac43
+    iotests.log(vm.qmp('migrate', uri='exec:cat >/dev/null'))
9bac43
+    while True:
9bac43
+        vm.get_qmp_event(wait=60.0)
9bac43
+        result = vm.qmp('query-migrate')
9bac43
+        status = result.get('return', {}).get('status', None)
9bac43
+        if status == 'completed':
9bac43
+            break
9bac43
diff --git a/tests/qemu-iotests/203.out b/tests/qemu-iotests/203.out
9bac43
new file mode 100644
9bac43
index 0000000..3f1ff90
9bac43
--- /dev/null
9bac43
+++ b/tests/qemu-iotests/203.out
9bac43
@@ -0,0 +1,6 @@
9bac43
+Launching VM...
9bac43
+Setting IOThreads...
9bac43
+{u'return': {}}
9bac43
+{u'return': {}}
9bac43
+Starting migration...
9bac43
+{u'return': {}}
9bac43
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
9bac43
index 8d3752c..67b197e 100644
9bac43
--- a/tests/qemu-iotests/group
9bac43
+++ b/tests/qemu-iotests/group
9bac43
@@ -192,3 +192,4 @@
9bac43
 198 rw auto
9bac43
 200 rw auto
9bac43
 202 rw auto quick
9bac43
+203 rw auto
9bac43
-- 
9bac43
1.8.3.1
9bac43