From nobody Fri May 17 22:30:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553076890321899.3580268790367; Wed, 20 Mar 2019 03:14:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:45479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6YFB-0005Mb-5X for importer@patchew.org; Wed, 20 Mar 2019 06:14:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6YBw-0003CO-HQ for qemu-devel@nongnu.org; Wed, 20 Mar 2019 06:11:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Y0t-0005Av-DS for qemu-devel@nongnu.org; Wed, 20 Mar 2019 06:00:00 -0400 Received: from relay.sw.ru ([185.231.240.75]:36884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Y0s-00058v-WC; Wed, 20 Mar 2019 05:59:59 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1h6Y0q-0007CF-5C; Wed, 20 Mar 2019 12:59:56 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 20 Mar 2019 12:59:54 +0300 Message-Id: <20190320095954.28874-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] iotests: add 248: test resume mirror after auto pause on ENOSPC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Test that mirror job actually resume on resume command after being automatically paused on ENOSPC error. It's a follow-up test for 8d9648cbf3e "blockjob: fix user pause in block_job_error_action" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/248 | 77 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/248.out | 12 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/qemu-iotests/248 create mode 100644 tests/qemu-iotests/248.out diff --git a/tests/qemu-iotests/248 b/tests/qemu-iotests/248 new file mode 100755 index 0000000000..ab88c96532 --- /dev/null +++ b/tests/qemu-iotests/248 @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# Test resume mirror after auto pause on ENOSPC +# +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests +from iotests import qemu_img_create, qemu_io, file_path, filter_qmp_testfi= les + +iotests.verify_image_format(supported_fmts=3D['qcow2']) + +source, target =3D file_path('source', 'target') +size =3D 5 * 1024 * 1024 +limit =3D 2 * 1024 * 1024 + +qemu_img_create('-f', iotests.imgfmt, source, str(size)) +qemu_img_create('-f', iotests.imgfmt, target, str(size)) +qemu_io('-c', 'write 0 {}'.format(size), source) + +# raw format don't like empty files +qemu_io('-c', 'write 0 {}'.format(size), target) + +vm =3D iotests.VM().add_drive(source) +vm.launch() + +vm.qmp_log('blockdev-add', filters=3D[filter_qmp_testfiles], **{ + 'driver': iotests.imgfmt, + 'node-name': 'target', + 'file': { + 'driver': 'raw', + 'size': 2 * 1024 * 1024, + 'file': { + 'driver': 'file', + 'filename': target + } + } +}) + +vm.qmp_log('blockdev-mirror', device=3D'drive0', sync=3D'full', target=3D'= target', + on_target_error=3D'enospc') + +vm.event_wait('JOB_STATUS_CHANGE', timeout=3D3.0, + match=3D{'data': {'status': 'paused'}}) + +vm.qmp_log('query-block-jobs') + +vm.qmp_log('x-blockdev-reopen', filters=3D[filter_qmp_testfiles], **{ + 'driver': iotests.imgfmt, + 'node-name': 'target', + 'file': { + 'driver': 'raw', + # size parameter dropped + 'file': { + 'driver': 'file', + 'filename': target + } + } +}) + +vm.qmp_log('block-job-resume', device=3D'drive0') +vm.qmp_log('query-block-jobs') # check that job is resumed + +vm.shutdown() diff --git a/tests/qemu-iotests/248.out b/tests/qemu-iotests/248.out new file mode 100644 index 0000000000..657f69b209 --- /dev/null +++ b/tests/qemu-iotests/248.out @@ -0,0 +1,12 @@ +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-target"},= "size": 2097152}, "node-name": "target"}} +{"return": {}} +{"execute": "blockdev-mirror", "arguments": {"device": "drive0", "on-targe= t-error": "enospc", "sync": "full", "target": "target"}} +{"return": {}} +{"execute": "query-block-jobs", "arguments": {}} +{"return": [{"auto-dismiss": true, "auto-finalize": true, "busy": false, "= device": "drive0", "io-status": "nospace", "len": 5242880, "offset": 104857= 6, "paused": true, "ready": false, "speed": 0, "status": "paused", "type": = "mirror"}]} +{"execute": "x-blockdev-reopen", "arguments": {"driver": "qcow2", "file": = {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-targ= et"}}, "node-name": "target"}} +{"return": {}} +{"execute": "block-job-resume", "arguments": {"device": "drive0"}} +{"return": {}} +{"execute": "query-block-jobs", "arguments": {}} +{"return": [{"auto-dismiss": true, "auto-finalize": true, "busy": true, "d= evice": "drive0", "io-status": "ok", "len": 5242880, "offset": 1048576, "pa= used": false, "ready": false, "speed": 0, "status": "running", "type": "mir= ror"}]} diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index d192abaecf..41da10c6cf 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -246,3 +246,4 @@ 245 rw auto 246 rw auto quick 247 rw auto quick +248 rw auto quick --=20 2.18.0