From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574258812; cv=none; d=zoho.com; s=zohoarc; b=Qo4UmxBE2aO4IcYwKjOb/seLTNY7WL+ZiqXLJBvkLLAu0D2Semlut/8X2vnNwSyPU+1r8VFE4H+5u7+riSMomwM/kVDMi0QXlPYp3o73zw5x6sQ8uq1WpznO4cipz/rlPsT+vKKAYzWinPkQtuQt28sZnmH8smA/f1Hlmov2QFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574258812; h=Content-Type: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; bh=CvE56udzdiFxJQ+oY8narTyNFfDLyHm1vvqTbdJj7/E=; b=han40LulhdKIEQ776yngUT2NqUTSfFTGtAZ0UWWkRE+dsxzz9mMl2o6NoA7XC+zAHyvQ207ZMQOYTXG+ptH82hfexoMcc5dv72pe8BV0jv6YgLqXYTFoRpYq7T3lt0r2PZVKNaxnOW0FFbT82Ny3i9HLyUBKJMcSLErdKV8U2ME= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 157425881201616.3720714423564; Wed, 20 Nov 2019 06:06:52 -0800 (PST) Received: from localhost ([::1]:58464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQd8-0001sc-Sf for importer@patchew.org; Wed, 20 Nov 2019 09:06:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47294) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaF-0006Mk-Jy for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaE-0000sO-Hp for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25123 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaE-0000s5-Ec for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-328-Y_ReeR6MNnSO7bts3Al6TA-1; Wed, 20 Nov 2019 09:03:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 211561005502; Wed, 20 Nov 2019 14:03:45 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D099C60493; Wed, 20 Nov 2019 14:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CvE56udzdiFxJQ+oY8narTyNFfDLyHm1vvqTbdJj7/E=; b=VEai6lSiGZiSfk4dxDUL1YUMQF4vevAGcXq2cEgcvrBVZgRaNRk52KGG+V/GBvsKZCxlTq WYnTlyfSc6ImGjUdnexFC384kAHNMkF6eaaVwyJQATy+OSYEHCZTlpExS12pXG8hScLJ+m o14H5y32SZR8PwXWYAkySgaLZNNvKQA= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 1/6] block: bdrv_co_do_pwrite_zeroes: 64 bit 'bytes' parameter Date: Wed, 20 Nov 2019 15:03:14 +0100 Message-Id: <20191120140319.1505-2-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Y_ReeR6MNnSO7bts3Al6TA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" bdrv_co_do_pwrite_zeroes() can already cope with maximum request sizes by calling the driver in a loop until everything is done. Make the small remaining change that is necessary to let it accept a 64 bit byte count. Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index f75777f5ea..003f4ea38c 100644 --- a/block/io.c +++ b/block/io.c @@ -42,7 +42,7 @@ =20 static void bdrv_parent_cb_resize(BlockDriverState *bs); static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags); + int64_t offset, int64_t bytes, BdrvRequestFlags flags); =20 static void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ign= ore, bool ignore_bds_parents) @@ -1730,7 +1730,7 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, } =20 static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int bytes, BdrvRequestFlags flags) + int64_t offset, int64_t bytes, BdrvRequestFlags flags) { BlockDriver *drv =3D bs->drv; QEMUIOVector qiov; @@ -1760,7 +1760,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(Bloc= kDriverState *bs, assert(max_write_zeroes >=3D bs->bl.request_alignment); =20 while (bytes > 0 && !ret) { - int num =3D bytes; + int num =3D MIN(bytes, BDRV_REQUEST_MAX_BYTES); =20 /* Align request. Block drivers can expect the "bulk" of the requ= est * to be aligned, and that unaligned requests do not cross cluster --=20 2.20.1 From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574258881; cv=none; d=zoho.com; s=zohoarc; b=aBKGFpdGEH/UZ0iGHHRtXidGXcBxyRYqEk9Mes//3DmvkoR0NLLGrGPblXZHKVjj0FCqzv7Ajqfzvy5AiKXLnPPe7OhC7E9U6r70TgSx5VOndE91xNwVkHaKL6C+3Wxhj9wxZ6OsgkRT0yRdLu0TQxrmprAKTi/fJCocV/fghzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574258881; h=Content-Type: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; bh=kj75bEF7gydfToKDJj/rPaqrglHCjvzP9RAgL97bSyo=; b=FDTqjh4pK+He+YVtKuYVy6gvl/tYadLSJj1lhiJCLHh3pbm+LSCFJLhVaRZ/YzN65cecKUnQWxGB5rDJn6DNEwy8G8gSmEQK0T78Sx+6Tm+u5G8JRhGCWxMrFeVnqHG0lN47TVQfIQZurXyYMvUyHUpyazgHyMLMULXbAdpcPUc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 157425888107137.25237611660657; Wed, 20 Nov 2019 06:08:01 -0800 (PST) Received: from localhost ([::1]:58476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQeF-0003dk-0q for importer@patchew.org; Wed, 20 Nov 2019 09:07:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47317) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaG-0006NX-P5 for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaF-0000sz-MV for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:52 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28510 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaF-0000sc-Ii for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-mOh5jKF5OJSmG10yHibUDQ-1; Wed, 20 Nov 2019 09:03:48 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11D158024D5; Wed, 20 Nov 2019 14:03:47 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C57960BB5; Wed, 20 Nov 2019 14:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kj75bEF7gydfToKDJj/rPaqrglHCjvzP9RAgL97bSyo=; b=XX6hRkF2K5dMji9O9yXZ2fevJO1cp0My7xKrTpA8bMS8CQc68ret2MPABP9RxWamlWv727 9iOr/3OHohkcrPya3XtlXZhxEdYdEKhHsu7Ig12KvNMyAnGMQm0WoPfnWg3WZSZELrWbWu WnhjmBLWDNwI0Ssrbhq1Pw2Hz853l0k= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 2/6] block: truncate: Don't make backing file data visible Date: Wed, 20 Nov 2019 15:03:15 +0100 Message-Id: <20191120140319.1505-3-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: mOh5jKF5OJSmG10yHibUDQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When extending the size of an image that has a backing file larger than its old size, make sure that the backing file data doesn't become visible in the guest, but the added area is properly zeroed out. The old behaviour made a difference in 'block_resize' (where showing the backing file data from an old snapshot rather than zeros is questionable) as well as in commit block jobs (both from active and intermediate nodes) and HMP 'commit', where committing to a short backing file would incorrectly omit writing zeroes for unallocated blocks on the top layer after the EOF of the short backing file. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/io.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/block/io.c b/block/io.c index 003f4ea38c..8683f7a4bd 100644 --- a/block/io.c +++ b/block/io.c @@ -3382,6 +3382,31 @@ int coroutine_fn bdrv_co_truncate(BdrvChild *child, = int64_t offset, bool exact, goto out; } =20 + /* + * If the image has a backing file that is large enough that it would + * provide data for the new area, we cannot leave it unallocated becau= se + * then the backing file content would become visible. Instead, zero-f= ill + * the area where backing file and new area overlap. + */ + if (new_bytes && bs->backing && prealloc =3D=3D PREALLOC_MODE_OFF) { + int64_t backing_len; + + backing_len =3D bdrv_getlength(backing_bs(bs)); + if (backing_len < 0) { + ret =3D backing_len; + goto out; + } + + if (backing_len > old_size) { + ret =3D bdrv_co_do_pwrite_zeroes(bs, old_size, + MIN(new_bytes, backing_len - ol= d_size), + BDRV_REQ_ZERO_WRITE | BDRV_REQ_= MAY_UNMAP); + if (ret < 0) { + goto out; + } + } + } + ret =3D refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not refresh total sector count= "); --=20 2.20.1 From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574258731; cv=none; d=zoho.com; s=zohoarc; b=lYub2ye9Ir0fF8E8TfOF8RHBR/mNzUjEZl3yVrjPMuunaOUFIzCZJqsCoFbzQVJjIvlwuHM4GyGNV+KGPn2GJLtvmSh1g9SWqF72pmOLSGyrswVoFzmYlvAs8vMiQNoWDAQA+4TVJlIsXxiwxdouTHDXi3TBEl3xq/anzN8VEqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574258731; h=Content-Type: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; bh=lzUY8MBww2k8ALhMSX8MM670TCCi9p8BmXeyT8wFin8=; b=i85PY8nHHIqs6wWjaPdwgHzINxCuj+FuPECT4gNDuErDvjXByB+N1xBN/KHyp3eizV8NuhDgd2DZPcvRTBSSf+2Ci2pFuUVIegGD525Q7Nrw7/f4Cf8LbeWLdcHAF8MYylFR7yRxOAUYTVi0Aqqs6GM4thkEF/ywIofSyYF5xso= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1574258731513836.0132833689121; Wed, 20 Nov 2019 06:05:31 -0800 (PST) Received: from localhost ([::1]:58444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQbo-0007wc-Ct for importer@patchew.org; Wed, 20 Nov 2019 09:05:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47334) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaH-0006Oi-Hl for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaG-0000tM-Cy for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:53 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32129 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaG-0000t8-7b for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-h2y2v_tLN5-ZootHc9gLdw-1; Wed, 20 Nov 2019 09:03:50 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 600B41083E81; Wed, 20 Nov 2019 14:03:49 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5160C60BB8; Wed, 20 Nov 2019 14:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lzUY8MBww2k8ALhMSX8MM670TCCi9p8BmXeyT8wFin8=; b=eGBn9tO2tguYlM181gjc/CYElp5OwwEqQ7vKEcKxZLfKUBBLjYhzUsn4gDdmIa+sxc7lCi 4a7RkPGPk6P+Up+sToBQuFUIrcyPWUgNEZd0IpttnbMjM6hMQEAAQBvFDx/WlK4S2BXQEl /ix38rWG2PMVHuLrSgPN0B+NL84AMpM= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 3/6] iotests: Add qemu_io_log() Date: Wed, 20 Nov 2019 15:03:16 +0100 Message-Id: <20191120140319.1505-4-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: h2y2v_tLN5-ZootHc9gLdw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add a function that runs qemu-io and logs the output with the appropriate filters applied. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6a248472b9..330681ad02 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -157,6 +157,11 @@ def qemu_io(*args): sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, = ' '.join(args))) return subp.communicate()[0] =20 +def qemu_io_log(*args): + result =3D qemu_io(*args) + log(result, filters=3D[filter_testfiles, filter_qemu_io]) + return result + def qemu_io_silent(*args): '''Run qemu-io and return the exit code, suppressing stdout''' args =3D qemu_io_args + list(args) --=20 2.20.1 From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574258740; cv=none; d=zoho.com; s=zohoarc; b=g+ah1AWmnJD5U9hifWXEF/CmLsE2c+yrYSzeSY139fZCBQvCJTz3QPSWWutckhrhZRZ8JhDLezLmeEPQGvd4AIPpCeab2U8TV62IgbmPig2yAvLN7XNBTwUCkZJHx28bkaZfpInkAX1xMQpwn7wwklBnlDzeUFUViXbZa62g8mU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574258740; h=Content-Type: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; bh=0V6vvCOmv2t4ZLGO+bnOMW0UAq6PLYbO2CTEzjwL2NM=; b=L3oun19CwxGIWBQ01FDyXappI5vGuv5/4ycydioGZ6EQHCMbZ0An2fwxRbv+gSFy+wDXPuVAOfUGwJPOnSwAfUb6M8jwSzO8UturiV7EgA3t28zkglPUgjOFa+ytiWIAb8Uwi536PfbBfm2CAQsgELBkAZnIt8wwk6/FQbvJ/TI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1574258740737359.82560054581813; Wed, 20 Nov 2019 06:05:40 -0800 (PST) Received: from localhost ([::1]:58446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQby-0008FI-Gi for importer@patchew.org; Wed, 20 Nov 2019 09:05:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaL-0006Uc-Ck for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaK-0000uy-AF for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:57 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34136 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaK-0000un-73 for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-3NtVv02hMA-yuG4-UpvUqg-1; Wed, 20 Nov 2019 09:03:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43E47804912; Wed, 20 Nov 2019 14:03:51 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABCA660BB5; Wed, 20 Nov 2019 14:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0V6vvCOmv2t4ZLGO+bnOMW0UAq6PLYbO2CTEzjwL2NM=; b=apHhuotXNgd80JUcSGaCQTjoYlR5zajTexy7Q7I/ClBMEf/LKcjZRvieoC1HL37vYg7UM/ B+iPhJq4QkMzPF/EiGDMOZiow4BCmJD7zhdRmqnP0Ih8+zt+Nn8qkTjuiv/jzXx7l2Llsx FPdwm7H3akpOKcbHVsgejWdnNzAWPfg= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 4/6] iotests: Fix timeout in run_job() Date: Wed, 20 Nov 2019 15:03:17 +0100 Message-Id: <20191120140319.1505-5-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 3NtVv02hMA-yuG4-UpvUqg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" run_job() accepts a wait parameter for a timeout, but it doesn't actually use it. The only thing that is missing is passing it to events_wait(), so do that now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 330681ad02..b409198e47 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -604,7 +604,7 @@ class VM(qtest.QEMUQtestMachine): ] error =3D None while True: - ev =3D filter_qmp_event(self.events_wait(events)) + ev =3D filter_qmp_event(self.events_wait(events, timeout=3Dwai= t)) if ev['event'] !=3D 'JOB_STATUS_CHANGE': if use_log: log(ev) --=20 2.20.1 From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574258962; cv=none; d=zoho.com; s=zohoarc; b=mvKhIpWV8s6EkPkhohWRpAT8bGXOffJCora5ZQsXjNZsGE/IBXjEASBHcaFCQlcBAPmI6U7C2MqvzyBQxuM6zByHbcjgrd3eP+ZtGrKMp6zruvFwY5ADLxRWCVH+2THZGyHUV1xQ+QviSZyh99d7AifaZa51Pwxb+xYZ7X6HerY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574258962; h=Content-Type: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; bh=fef28hGOYbnP0Ybv8bspBnRvYnulVyMGG/bogibbZOA=; b=KRubb6HspClFo4WouxSvMrZEwn2iqVKobr4OOZT0p14eLHBcn+FGphB8zYWlMHT23v6N6SDORelsRdx5Ao/v3NpQYVeLLo+aIVL094XkhykFcbhL3ltyqevNJdBd4KleY6S1VVC3RUhbX9KOzxU9BcX3/JJIhEDNcVmkMRKMNQk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1574258962142506.80355484762447; Wed, 20 Nov 2019 06:09:22 -0800 (PST) Received: from localhost ([::1]:58490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQfY-0005Ns-64 for importer@patchew.org; Wed, 20 Nov 2019 09:09:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47386) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaN-0006XC-5m for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:04:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaM-0000vl-27 for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:58 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30225 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaL-0000va-Ue for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:58 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-UfRF62IBPnOGYLBG3gzgdg-1; Wed, 20 Nov 2019 09:03:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 241AE1005514; Wed, 20 Nov 2019 14:03:53 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D70A60BB5; Wed, 20 Nov 2019 14:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fef28hGOYbnP0Ybv8bspBnRvYnulVyMGG/bogibbZOA=; b=POBD18yROeTT27zzxUGp2+a79LWShliEICTykMwfj/cm94zHF6tuCKjqesqsK2gQkWzCIh U5xX1kpqYt6Zz1691xDv1B5I4/a3TL+WkYhY0UUwzTIxOzXAuh2S3oE99jaz6PQBrJpvVy s242Ep/6WxcW4nT3sCv29/a1kCqHGEA= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 5/6] iotests: Support job-complete in run_job() Date: Wed, 20 Nov 2019 15:03:18 +0100 Message-Id: <20191120140319.1505-6-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: UfRF62IBPnOGYLBG3gzgdg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Automatically complete jobs that have a 'ready' state and need an explicit job-complete. Without this, run_job() would hang for such jobs. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index b409198e47..c4063ef6bb 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -617,6 +617,8 @@ class VM(qtest.QEMUQtestMachine): error =3D j['error'] if use_log: log('Job failed: %s' % (j['error'])) + elif status =3D=3D 'ready': + self.qmp_log('job-complete', id=3Djob) elif status =3D=3D 'pending' and not auto_finalize: if pre_finalize: pre_finalize() --=20 2.20.1 From nobody Wed May 8 05:34:26 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; dkim=fail; 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=1574259028; cv=none; d=zoho.com; s=zohoarc; b=lbKvdqDD9dOCTVaNlWi7dppScahct7LjbJZptAzGPaxDGzRX6QRH+F5uApCyLa8r8rktvUReALOOAfh21eAfyK9mSsbBG5f4tdOD/yj0mUuWpo5KrozPBYAOxgBe2xxis+YIv1qyLWTvIKOVsEeVZfNimrGf149+4J3kGtY9TDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574259028; h=Content-Type: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; bh=RsNlEvxTRmcP+MdbECcLdHWspCLvIsRQJe1Q/mpB4a4=; b=YXRrpk+KKTiqa7zIPN0tYhI43fj8UsTeSGGG9/5OjEWc+NNg4MPIXwvQB/0HlhqjwtFFAHoWgfYtnmAVe3da8eN7fs3AsZEaZkNHaGto+wlrUKeOyBOedzvZTYLBhv4jhngHWU+BtmNE/ndEo1plAcmOEKuG4h2krkj/fcgkiSI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1574259028295266.47855385484604; Wed, 20 Nov 2019 06:10:28 -0800 (PST) Received: from localhost ([::1]:58500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQgd-0007qU-4N for importer@patchew.org; Wed, 20 Nov 2019 09:10:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47426) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXQaQ-0006bW-4O for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXQaN-0000wb-SP for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:04:01 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32158 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXQaN-0000wJ-N5 for qemu-devel@nongnu.org; Wed, 20 Nov 2019 09:03:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-bWF8f7uXP9-ud6LSNT2KBQ-1; Wed, 20 Nov 2019 09:03:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 056BE63CCC; Wed, 20 Nov 2019 14:03:55 +0000 (UTC) Received: from linux.fritz.box.com (unknown [10.36.118.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71DD960BB5; Wed, 20 Nov 2019 14:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574258639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RsNlEvxTRmcP+MdbECcLdHWspCLvIsRQJe1Q/mpB4a4=; b=GfTlYsyKdlLtly0C8DLDNXGTxHgP3DO2w0COyVQEF/nnl4H9xaK2jjR0tyJqoAqEYrf98v /Oic6aJ6/+ulC9l9LjPRbqtr+k2xOyBs9uNInKz1ac+myfBkhie3gWuPAL6N3vwbU2lGMS oPuMXC3N2UceIJHm/5T7kH0Cn8WcoFo= From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 6/6] iotests: Test committing to short backing file Date: Wed, 20 Nov 2019 15:03:19 +0100 Message-Id: <20191120140319.1505-7-kwolf@redhat.com> In-Reply-To: <20191120140319.1505-1-kwolf@redhat.com> References: <20191120140319.1505-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: bWF8f7uXP9-ud6LSNT2KBQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/274 | 131 +++++++++++++++++++++++++++++ tests/qemu-iotests/274.out | 150 ++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + tests/qemu-iotests/iotests.py | 2 +- 4 files changed, 283 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/274 create mode 100644 tests/qemu-iotests/274.out diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 new file mode 100755 index 0000000000..f3b71e2859 --- /dev/null +++ b/tests/qemu-iotests/274 @@ -0,0 +1,131 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Red Hat, Inc. +# +# 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 . +# +# Creator/Owner: Kevin Wolf +# +# Some tests for short backing files and short overlays + +import iotests +import os + +iotests.verify_image_format(supported_fmts=3D['qcow2']) +iotests.verify_platform(['linux']) + +size_short =3D 1 * 1024 * 1024 +size_long =3D 2 * 1024 * 1024 +size_diff =3D size_long - size_short + +def create_chain(): + iotests.qemu_img_log('create', '-f', iotests.imgfmt, base, + str(size_long)) + iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', base, mid, + str(size_short)) + iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', mid, top, + str(size_long)) + + iotests.qemu_io_log('-c', 'write -P 1 0 %d' % size_long, base) + +def create_vm(): + vm =3D iotests.VM() + vm.add_blockdev('file,filename=3D%s,node-name=3Dbase-file' % (base)) + vm.add_blockdev('%s,file=3Dbase-file,node-name=3Dbase' % (iotests.imgf= mt)) + vm.add_blockdev('file,filename=3D%s,node-name=3Dmid-file' % (mid)) + vm.add_blockdev('%s,file=3Dmid-file,node-name=3Dmid,backing=3Dbase' % = (iotests.imgfmt)) + vm.add_drive(top, 'backing=3Dmid,node-name=3Dtop') + return vm + +with iotests.FilePath('base') as base, \ + iotests.FilePath('mid') as mid, \ + iotests.FilePath('top') as top: + + iotests.log('=3D=3D Commit tests =3D=3D') + + create_chain() + + iotests.log('=3D=3D=3D Check visible data =3D=3D=3D') + + iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, top) + iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff),= top) + + iotests.log('=3D=3D=3D Checking allocation status =3D=3D=3D') + + iotests.qemu_io_log('-c', 'alloc 0 %d' % size_short, + '-c', 'alloc %d %d' % (size_short, size_diff), + base) + + iotests.qemu_io_log('-c', 'alloc 0 %d' % size_short, + '-c', 'alloc %d %d' % (size_short, size_diff), + mid) + + iotests.qemu_io_log('-c', 'alloc 0 %d' % size_short, + '-c', 'alloc %d %d' % (size_short, size_diff), + top) + + iotests.log('=3D=3D=3D Checking map =3D=3D=3D') + + iotests.qemu_img_log('map', '--output=3Djson', base) + iotests.qemu_img_log('map', '--output=3Dhuman', base) + iotests.qemu_img_log('map', '--output=3Djson', mid) + iotests.qemu_img_log('map', '--output=3Dhuman', mid) + iotests.qemu_img_log('map', '--output=3Djson', top) + iotests.qemu_img_log('map', '--output=3Dhuman', top) + + iotests.log('=3D=3D=3D Testing qemu-img commit (top -> mid) =3D=3D=3D') + + iotests.qemu_img_log('commit', top) + iotests.img_info_log(mid) + iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, mid) + iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff),= mid) + + iotests.log('=3D=3D=3D Testing HMP commit (top -> mid) =3D=3D=3D') + + create_chain() + with create_vm() as vm: + vm.launch() + vm.qmp_log('human-monitor-command', command_line=3D'commit drive0') + + iotests.img_info_log(mid) + iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, mid) + iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff),= mid) + + iotests.log('=3D=3D=3D Testing QMP active commit (top -> mid) =3D=3D= =3D') + + create_chain() + with create_vm() as vm: + vm.launch() + vm.qmp_log('block-commit', device=3D'top', base_node=3D'mid', + job_id=3D'job0', auto_dismiss=3DFalse) + vm.run_job('job0', wait=3D5) + + iotests.img_info_log(mid) + iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, mid) + iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff),= mid) + + + iotests.log('=3D=3D Resize tests =3D=3D') + + iotests.qemu_img_log('create', '-f', iotests.imgfmt, base, '6G') + iotests.qemu_img_log('create', '-f', iotests.imgfmt, '-b', base, top, = '1G') + iotests.qemu_io_log('-c', 'write -P 1 3G 64k', base) + iotests.qemu_io_log('-c', 'write -P 2 5G 64k', base) + + # After this, 0 to 6 GB should be allocated/zeroed + # 6 GB to 8 BG should be unallocated + iotests.qemu_img_log('resize', '-f', iotests.imgfmt, top, '8G') + iotests.qemu_io_log('-c', 'read -P 0 3G 64k', top) + iotests.qemu_io_log('-c', 'read -P 0 5G 64k', top) + iotests.qemu_img_log('map', '--output=3Djson', top) diff --git a/tests/qemu-iotests/274.out b/tests/qemu-iotests/274.out new file mode 100644 index 0000000000..def0ac7d27 --- /dev/null +++ b/tests/qemu-iotests/274.out @@ -0,0 +1,150 @@ +=3D=3D Commit tests =3D=3D +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 + +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 + +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 + +wrote 2097152/2097152 bytes at offset 0 +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D Check visible data =3D=3D=3D +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D Checking allocation status =3D=3D=3D +1048576/1048576 bytes allocated at offset 0 bytes +1048576/1048576 bytes allocated at offset 1 MiB + +0/1048576 bytes allocated at offset 0 bytes +0/0 bytes allocated at offset 1 MiB + +0/1048576 bytes allocated at offset 0 bytes +0/1048576 bytes allocated at offset 1 MiB + +=3D=3D=3D Checking map =3D=3D=3D +[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true,= "offset": 327680}] + +Offset Length Mapped to File +0 0x200000 0x50000 TEST_DIR/PID-base + +[{ "start": 0, "length": 1048576, "depth": 1, "zero": false, "data": true,= "offset": 327680}] + +Offset Length Mapped to File +0 0x100000 0x50000 TEST_DIR/PID-base + +[{ "start": 0, "length": 1048576, "depth": 2, "zero": false, "data": true,= "offset": 327680}, +{ "start": 1048576, "length": 1048576, "depth": 0, "zero": true, "data": f= alse}] + +Offset Length Mapped to File +0 0x100000 0x50000 TEST_DIR/PID-base + +=3D=3D=3D Testing qemu-img commit (top -> mid) =3D=3D=3D +Image committed. + +image: TEST_IMG +file format: IMGFMT +virtual size: 2 MiB (2097152 bytes) +cluster_size: 65536 +backing file: TEST_DIR/PID-base +Format specific information: + compat: 1.1 + lazy refcounts: false + refcount bits: 16 + corrupt: false + +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D Testing HMP commit (top -> mid) =3D=3D=3D +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 + +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 + +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 + +wrote 2097152/2097152 bytes at offset 0 +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +{"execute": "human-monitor-command", "arguments": {"command-line": "commit= drive0"}} +{"return": ""} +image: TEST_IMG +file format: IMGFMT +virtual size: 2 MiB (2097152 bytes) +cluster_size: 65536 +backing file: TEST_DIR/PID-base +Format specific information: + compat: 1.1 + lazy refcounts: false + refcount bits: 16 + corrupt: false + +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D Testing QMP active commit (top -> mid) =3D=3D=3D +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 + +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 + +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 + +wrote 2097152/2097152 bytes at offset 0 +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +{"execute": "block-commit", "arguments": {"auto-dismiss": false, "base-nod= e": "mid", "device": "top", "job-id": "job0"}} +{"return": {}} +{"execute": "job-complete", "arguments": {"id": "job0"}} +{"return": {}} +{"data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "co= mmit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds": "USECS", = "seconds": "SECS"}} +{"data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "co= mmit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USEC= S", "seconds": "SECS"}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +image: TEST_IMG +file format: IMGFMT +virtual size: 2 MiB (2097152 bytes) +cluster_size: 65536 +backing file: TEST_DIR/PID-base +Format specific information: + compat: 1.1 + lazy refcounts: false + refcount bits: 16 + corrupt: false + +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D Resize tests =3D=3D +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D6442450944 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 + +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D1073741824 backing_file= =3DTEST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bit= s=3D16 + +wrote 65536/65536 bytes at offset 3221225472 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +wrote 65536/65536 bytes at offset 5368709120 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +Image resized. + +read 65536/65536 bytes at offset 3221225472 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +read 65536/65536 bytes at offset 5368709120 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +[{ "start": 0, "length": 1073741824, "depth": 1, "zero": true, "data": fal= se}, +{ "start": 1073741824, "length": 7516192768, "depth": 0, "zero": true, "da= ta": false}] + diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index c56bb69031..329c9e4d37 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -285,3 +285,4 @@ 270 rw backing quick 272 rw 273 backing quick +274 rw backing quick diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index c4063ef6bb..5fd6d820b1 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -144,7 +144,7 @@ def img_info_log(filename, filter_path=3DNone, imgopts= =3DFalse, extra_args=3D[]): output =3D qemu_img_pipe(*args) if not filter_path: filter_path =3D filename - log(filter_img_info(output, filter_path)) + log(filter_img_info(output, filter_path), filters=3D[filter_testfiles]) =20 def qemu_io(*args): '''Run qemu-io and return the stdout data''' --=20 2.20.1