|
|
9bac43 |
From c5ff50d391e5a1afa55d6f2394f404ce27c6ceb5 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Date: Fri, 22 Dec 2017 11:08:56 +0100
|
|
|
9bac43 |
Subject: [PATCH 38/42] qemu-iotests: add 202 external snapshots IOThread test
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Message-id: <20171222110900.24813-17-stefanha@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78496
|
|
|
9bac43 |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 16/20] qemu-iotests: add 202 external snapshots IOThread 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 |
QMP 'transaction' blockdev-snapshot-sync with multiple disks in an
|
|
|
9bac43 |
IOThread is an untested code path. Several bugs have been found in
|
|
|
9bac43 |
connection with this command. This patch adds a test case to prevent
|
|
|
9bac43 |
future regressions.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9bac43 |
Message-id: 20171206144550.22295-10-stefanha@redhat.com
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit 6dd64919ea36db9fd7e754ed394c25ced45ea39a)
|
|
|
9bac43 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
tests/qemu-iotests/202 | 95 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
9bac43 |
tests/qemu-iotests/202.out | 11 ++++++
|
|
|
9bac43 |
tests/qemu-iotests/group | 1 +
|
|
|
9bac43 |
3 files changed, 107 insertions(+)
|
|
|
9bac43 |
create mode 100755 tests/qemu-iotests/202
|
|
|
9bac43 |
create mode 100644 tests/qemu-iotests/202.out
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/202 b/tests/qemu-iotests/202
|
|
|
9bac43 |
new file mode 100755
|
|
|
9bac43 |
index 0000000..581ca34
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/202
|
|
|
9bac43 |
@@ -0,0 +1,95 @@
|
|
|
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 'transaction' blockdev-snapshot-sync with multiple drives on a
|
|
|
9bac43 |
+# single IOThread completes successfully. This particular command triggered a
|
|
|
9bac43 |
+# hang due to recursive AioContext locking and BDRV_POLL_WHILE(). Protect
|
|
|
9bac43 |
+# against regressions.
|
|
|
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.FilePath('disk0-snap.img') as disk0_snap_img_path, \
|
|
|
9bac43 |
+ iotests.FilePath('disk1-snap.img') as disk1_snap_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.launch()
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ iotests.log('Adding IOThread...')
|
|
|
9bac43 |
+ iotests.log(vm.qmp('object-add',
|
|
|
9bac43 |
+ qom_type='iothread',
|
|
|
9bac43 |
+ id='iothread0'))
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ iotests.log('Adding blockdevs...')
|
|
|
9bac43 |
+ iotests.log(vm.qmp('blockdev-add',
|
|
|
9bac43 |
+ driver=iotests.imgfmt,
|
|
|
9bac43 |
+ node_name='disk0',
|
|
|
9bac43 |
+ file={
|
|
|
9bac43 |
+ 'driver': 'file',
|
|
|
9bac43 |
+ 'filename': disk0_img_path,
|
|
|
9bac43 |
+ }))
|
|
|
9bac43 |
+ iotests.log(vm.qmp('blockdev-add',
|
|
|
9bac43 |
+ driver=iotests.imgfmt,
|
|
|
9bac43 |
+ node_name='disk1',
|
|
|
9bac43 |
+ file={
|
|
|
9bac43 |
+ 'driver': 'file',
|
|
|
9bac43 |
+ 'filename': disk1_img_path,
|
|
|
9bac43 |
+ }))
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ iotests.log('Setting iothread...')
|
|
|
9bac43 |
+ iotests.log(vm.qmp('x-blockdev-set-iothread',
|
|
|
9bac43 |
+ node_name='disk0',
|
|
|
9bac43 |
+ iothread='iothread0'))
|
|
|
9bac43 |
+ iotests.log(vm.qmp('x-blockdev-set-iothread',
|
|
|
9bac43 |
+ node_name='disk1',
|
|
|
9bac43 |
+ iothread='iothread0'))
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ iotests.log('Creating external snapshots...')
|
|
|
9bac43 |
+ iotests.log(vm.qmp(
|
|
|
9bac43 |
+ 'transaction',
|
|
|
9bac43 |
+ actions=[
|
|
|
9bac43 |
+ {
|
|
|
9bac43 |
+ 'data': {
|
|
|
9bac43 |
+ 'node-name': 'disk0',
|
|
|
9bac43 |
+ 'snapshot-file': disk0_snap_img_path,
|
|
|
9bac43 |
+ 'snapshot-node-name': 'disk0-snap',
|
|
|
9bac43 |
+ 'mode': 'absolute-paths',
|
|
|
9bac43 |
+ 'format': iotests.imgfmt,
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+ 'type': 'blockdev-snapshot-sync'
|
|
|
9bac43 |
+ }, {
|
|
|
9bac43 |
+ 'data': {
|
|
|
9bac43 |
+ 'node-name': 'disk1',
|
|
|
9bac43 |
+ 'snapshot-file': disk1_snap_img_path,
|
|
|
9bac43 |
+ 'snapshot-node-name': 'disk1-snap',
|
|
|
9bac43 |
+ 'mode': 'absolute-paths',
|
|
|
9bac43 |
+ 'format': iotests.imgfmt
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+ 'type': 'blockdev-snapshot-sync'
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ ]))
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/202.out b/tests/qemu-iotests/202.out
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..d5ea374
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/202.out
|
|
|
9bac43 |
@@ -0,0 +1,11 @@
|
|
|
9bac43 |
+Launching VM...
|
|
|
9bac43 |
+Adding IOThread...
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
+Adding blockdevs...
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
+Setting iothread...
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
+Creating external snapshots...
|
|
|
9bac43 |
+{u'return': {}}
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
|
|
9bac43 |
index 39b61ce..8d3752c 100644
|
|
|
9bac43 |
--- a/tests/qemu-iotests/group
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/group
|
|
|
9bac43 |
@@ -191,3 +191,4 @@
|
|
|
9bac43 |
195 rw auto quick
|
|
|
9bac43 |
198 rw auto
|
|
|
9bac43 |
200 rw auto
|
|
|
9bac43 |
+202 rw auto quick
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|