From nobody Wed Dec 17 21:42:55 2025 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563544043; cv=none; d=zoho.com; s=zohoarc; b=j9Xo1nhufu+d/ekrS6HDRcKFDnreVN2DZ03wgQRx3bmZcB3fHZO8rEU7RVa6rlX0KhB5OCfNeHwKSjsOtN2qlo2Gv7cv3hmd/8P0bnHylyNkxkMHvD2C+MxgxBs0skcRsYx3778vEyWjw1WVakPRWrtRfCyh9rOURffjGaLJj5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563544043; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=I6NcqbW5HDxp8UVSfvuL55pM1j7xG3oVMMB/5njWWp4=; b=iq4jEz+PK3JTTNiDilZQjYGrgLCGCSD2m8FWwLl+bvIdKpz/spVD35y07P1RvhbBtlc+QSShH0bibCjaw1fKPdEdpMXAWW+RhAfgb40Yura8JZnG17Zu5UJ74NFdc6FjQJk0X+/dnkzH84o/leIJt6Iu6lQ+0/rXUCECDivfH94= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563544043128764.5312178590516; Fri, 19 Jul 2019 06:47:23 -0700 (PDT) Received: from localhost ([::1]:45696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoTEH-00078R-N4 for importer@patchew.org; Fri, 19 Jul 2019 09:47:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40561) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoTBJ-0004Cw-RI for qemu-devel@nongnu.org; Fri, 19 Jul 2019 09:44:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoTBI-0003e9-B8 for qemu-devel@nongnu.org; Fri, 19 Jul 2019 09:44:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hoTBF-0003aZ-Gj; Fri, 19 Jul 2019 09:44:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8692307D844; Fri, 19 Jul 2019 13:44:12 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC8DC608A4; Fri, 19 Jul 2019 13:44:11 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 19 Jul 2019 15:43:45 +0200 Message-Id: <20190719134345.23526-14-kwolf@redhat.com> In-Reply-To: <20190719134345.23526-1-kwolf@redhat.com> References: <20190719134345.23526-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 19 Jul 2019 13:44:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz When qemu quits, all throttling should be ignored. That means, if there is a mirror job running from a throttled node, it should be cancelled immediately and qemu close without blocking. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/218 | 55 ++++++++++++++++++++++++++++++++++++-- tests/qemu-iotests/218.out | 4 +++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 index 92c331b6fb..2554d84581 100755 --- a/tests/qemu-iotests/218 +++ b/tests/qemu-iotests/218 @@ -27,9 +27,9 @@ # Creator/Owner: Max Reitz =20 import iotests -from iotests import log +from iotests import log, qemu_img, qemu_io_silent =20 -iotests.verify_platform(['linux']) +iotests.verify_image_format(supported_fmts=3D['qcow2', 'raw']) =20 =20 # Launches the VM, adds two null-co nodes (source and target), and @@ -136,3 +136,54 @@ with iotests.VM() as vm: =20 log(vm.event_wait('BLOCK_JOB_CANCELLED'), filters=3D[iotests.filter_qmp_event]) + +log('') +log('=3D=3D=3D Cancel mirror job from throttled node by quitting =3D=3D=3D= ') +log('') + +with iotests.VM() as vm, \ + iotests.FilePath('src.img') as src_img_path: + + assert qemu_img('create', '-f', iotests.imgfmt, src_img_path, '64M') = =3D=3D 0 + assert qemu_io_silent('-f', iotests.imgfmt, src_img_path, + '-c', 'write -P 42 0M 64M') =3D=3D 0 + + vm.launch() + + ret =3D vm.qmp('object-add', qom_type=3D'throttle-group', id=3D'tg', + props=3D{'x-bps-read': 4096}) + assert ret['return'] =3D=3D {} + + ret =3D vm.qmp('blockdev-add', + node_name=3D'source', + driver=3Diotests.imgfmt, + file=3D{ + 'driver': 'file', + 'filename': src_img_path + }) + assert ret['return'] =3D=3D {} + + ret =3D vm.qmp('blockdev-add', + node_name=3D'throttled-source', + driver=3D'throttle', + throttle_group=3D'tg', + file=3D'source') + assert ret['return'] =3D=3D {} + + ret =3D vm.qmp('blockdev-add', + node_name=3D'target', + driver=3D'null-co', + size=3D(64 * 1048576)) + assert ret['return'] =3D=3D {} + + ret =3D vm.qmp('blockdev-mirror', + job_id=3D'mirror', + device=3D'throttled-source', + target=3D'target', + sync=3D'full') + assert ret['return'] =3D=3D {} + + log(vm.qmp('quit')) + + with iotests.Timeout(5, 'Timeout waiting for VM to quit'): + vm.shutdown(has_quit=3DTrue) diff --git a/tests/qemu-iotests/218.out b/tests/qemu-iotests/218.out index 825a657081..5a86a97550 100644 --- a/tests/qemu-iotests/218.out +++ b/tests/qemu-iotests/218.out @@ -28,3 +28,7 @@ Cancelling job Cancelling job {"return": {}} {"data": {"device": "mirror", "len": 1048576, "offset": 1048576, "speed": = 0, "type": "mirror"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} + +=3D=3D=3D Cancel mirror job from throttled node by quitting =3D=3D=3D + +{"return": {}} --=20 2.20.1