From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600771896; cv=none; d=zohomail.com; s=zohoarc; b=GYQnEY2L8pjnYuDNFnuWHPDdNKf9w/vgrNb1A29kZSDhqlzpRd/m5cI0U1Oiuyeh/OR8wRoWgXg6lCHQO90SOkTgeALSir5zT1VznOLMOa7aFBiqSY6Pte4jYZKEyxfFizgih/ZeL8uip5Khr/wCQWwy9J8hp1OS1L0RPAenaSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600771896; 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=q1aJG1Km4rcSQhjOJ0lnTuTVRdzX4MZUleXqSWlvaDw=; b=hv2zqIrFnix+E4IzgGibCVek4muDd/m/AnNBcBiS1Hr5W0Ykb+3Pb2BVBjwxOMsY5NOHcHKTmLzpezJPFmwsvkpMje8vdTCo9l09SHg87baq6ap3+KeW61SC7Yj9D+02KD7XGu42I/ZLeHlUQa+ftgYSQkBeP4MBKih31cxmZQA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600771896814624.404284925998; Tue, 22 Sep 2020 03:51:36 -0700 (PDT) Received: from localhost ([::1]:43966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKftV-00023z-KV for importer@patchew.org; Tue, 22 Sep 2020 06:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfrt-0008V1-KR for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:49:53 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40909 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfrm-0000Rt-UF for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:49:51 -0400 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-517-jXx2FdytNh6C1a-F_Gq4MA-1; Tue, 22 Sep 2020 06:49:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 848ED1084C8A; Tue, 22 Sep 2020 10:49:42 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 44B8F5DD99; Tue, 22 Sep 2020 10:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771785; 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=q1aJG1Km4rcSQhjOJ0lnTuTVRdzX4MZUleXqSWlvaDw=; b=LBaA0anj2uEgiP1jqfwqTTpn1XvBJfCWvgRtaNXITrcv6bWqdQTn/MiWPpu4RfJra02QLK 3ZLqnposKDP8TDiz/nv9jfJ6HqpxF6vWk3nzLrPZYeoxhtIIjRAlkNMc0IuTeuwEjmdVw4 30+EpTqgTtWwf0bbkckGH6CUyIOZrT4= X-MC-Unique: jXx2FdytNh6C1a-F_Gq4MA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 01/20] configure: Detect libfuse Date: Tue, 22 Sep 2020 12:49:13 +0200 Message-Id: <20200922104932.46384-2-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 01:57:21 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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: Max Reitz Reviewed-by: Kevin Wolf --- configure | 34 ++++++++++++++++++++++++++++++++++ meson.build | 6 ++++++ 2 files changed, 40 insertions(+) diff --git a/configure b/configure index ce27eafb0a..21c31e4694 100755 --- a/configure +++ b/configure @@ -538,6 +538,7 @@ meson=3D"" ninja=3D"" skip_meson=3Dno gettext=3D"" +fuse=3D"" =20 bogus_os=3D"no" malloc_trim=3D"" @@ -1621,6 +1622,10 @@ for opt do ;; --disable-libdaxctl) libdaxctl=3Dno ;; + --enable-fuse) fuse=3Dyes + ;; + --disable-fuse) fuse=3Dno + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1945,6 +1950,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: xkbcommon xkbcommon support rng-none dummy RNG, avoid using /dev/(u)random and getrandom() libdaxctl libdaxctl support + fuse fuse block device export =20 NOTE: The object files are built at the place where configure is launched EOF @@ -6206,6 +6212,28 @@ but not implemented on your system" fi fi =20 +########################################## +# FUSE support + +if test "$fuse" !=3D "no"; then + cat > $TMPC < +#include +int main(void) { return 0; } +EOF + fuse_cflags=3D$(pkg-config --cflags fuse3) + fuse_libs=3D$(pkg-config --libs fuse3) + if compile_prog "$fuse_cflags" "$fuse_libs"; then + fuse=3Dyes + else + if test "$fuse" =3D "yes"; then + feature_not_found "fuse" + fi + fuse=3Dno + fi +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -7393,6 +7421,12 @@ if test "$secret_keyring" =3D "yes" ; then echo "CONFIG_SECRET_KEYRING=3Dy" >> $config_host_mak fi =20 +if test "$fuse" =3D "yes"; then + echo "CONFIG_FUSE=3Dy" >> $config_host_mak + echo "FUSE_CFLAGS=3D$fuse_cflags" >> $config_host_mak + echo "FUSE_LIBS=3D$fuse_libs" >> $config_host_mak +fi + if test "$tcg_interpreter" =3D "yes"; then QEMU_INCLUDES=3D"-iquote ${source_path}/tcg/tci $QEMU_INCLUDES" elif test "$ARCH" =3D "sparc64" ; then diff --git a/meson.build b/meson.build index 86e1cca0ad..85addd8562 100644 --- a/meson.build +++ b/meson.build @@ -436,6 +436,11 @@ if 'CONFIG_TASN1' in config_host endif keyutils =3D dependency('libkeyutils', required: false, method: 'pkg-config', static: enable_static) +libfuse =3D not_found +if 'CONFIG_FUSE' in config_host + libfuse =3D declare_dependency(compile_args: config_host['FUSE_CFLAGS'].= split(), + link_args: config_host['FUSE_LIBS'].split()) +endif =20 has_gettid =3D cc.has_function('gettid') =20 @@ -1531,6 +1536,7 @@ endif summary_info +=3D {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} summary_info +=3D {'rng-none': config_host.has_key('CONFIG_RNG_NO= NE')} summary_info +=3D {'Linux keyring': config_host.has_key('CONFIG_SECRET= _KEYRING')} +summary_info +=3D {'fuse exports': config_host.has_key('CONFIG_FUSE')} summary(summary_info, bool_yn: true) =20 if not supported_cpus.contains(cpu) --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772139; cv=none; d=zohomail.com; s=zohoarc; b=ID0x/HDiFBU7kHMA17sl0dNmAa7nGubAo+cVNCYf7tnBeziUDk5/ovOKPNOOT00zil3AQkLxFvi2uSFQHKq4EACR+j6B8I5ZBXoJmHNPAf3aK1fRb/md2239FgRrRDEEHpQi1nBOiaNUgsh+GVx02t+sGPTwIT/cTmx8SyXVw4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772139; 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=UTrRI+Vh+mX14W1DwBs1CjcLTpVNkRFF6rwR1vpThhk=; b=YzWcQWPbsn+LQZZBTZdYpYYAYKbzR+4c1+7d+loPRC/3JpgiomnVCtyxDHBgYbMt0vNuJYMoSfHT65HYOFDQg2wt2a448wLYuyDoDNtRB94ni2VvTbpFNLvmuI0oW/KXhPjIAP48uZw0S+a1QPP7eYroWDR5ikeVQlL3IibDhzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772139682968.1625312963901; Tue, 22 Sep 2020 03:55:39 -0700 (PDT) Received: from localhost ([::1]:53910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKfxR-0006J6-TS for importer@patchew.org; Tue, 22 Sep 2020 06:55:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfs2-0000BK-P2 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfrt-0000SN-QP for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:02 -0400 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-438-jaAqkxTQMR-QkAkoFBVe3Q-1; Tue, 22 Sep 2020 06:49:46 -0400 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 1FA561868406; Tue, 22 Sep 2020 10:49:45 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FA7378805; Tue, 22 Sep 2020 10:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771789; 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=UTrRI+Vh+mX14W1DwBs1CjcLTpVNkRFF6rwR1vpThhk=; b=ZcAULSsBaRQHTIAmS7U6GF36RRNZDAUHfcAJxaMlEQthcaQxD6wMSFxH7vb3v2JVZRw3l2 CM4+CmyZa2p7aeS7ZW14hX5+UPF3+BiYoG/aUo60rvu7dUCeE75/1R87TLkUmpaz8QxmIe nU9DwW2bi8xtDa16npa0Jza8IQXM4rc= X-MC-Unique: jaAqkxTQMR-QkAkoFBVe3Q-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 02/20] fuse: Allow exporting BDSs via FUSE Date: Tue, 22 Sep 2020 12:49:14 +0200 Message-Id: <20200922104932.46384-3-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" block-export-add type=3Dfuse allows mounting block graph nodes via FUSE on some existing regular file. That file should then appears like a raw disk image, and accesses to it result in accesses to the exported BDS. Right now, we only implement the necessary block export functions to set it up and shut it down. We do not implement any access functions, so accessing the mount point only results in errors. This will be addressed by a followup patch. We keep a hash table of exported mount points, because we want to be able to detect when users try to use a mount point twice. This is because we invoke stat() to check whether the given mount point is a regular file, but if that file is served by ourselves (because it is already used as a mount point), then this stat() would have to be served by ourselves, too, which is impossible to do while we (as the caller) are waiting for it to settle. Therefore, keep track of mount point paths to at least catch the most obvious instances of that problem. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- qapi/block-export.json | 24 +++- include/block/fuse.h | 30 +++++ block.c | 1 + block/export/export.c | 4 + block/export/fuse.c | 253 +++++++++++++++++++++++++++++++++++++++ block/export/meson.build | 1 + 6 files changed, 311 insertions(+), 2 deletions(-) create mode 100644 include/block/fuse.h create mode 100644 block/export/fuse.c diff --git a/qapi/block-export.json b/qapi/block-export.json index 0c045dfe7b..cb5bd54cbf 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -174,6 +174,21 @@ ## { 'command': 'nbd-server-stop' } =20 +## +# @BlockExportOptionsFuse: +# +# Options for exporting a block graph node on some (file) mountpoint +# as a raw image. +# +# @mountpoint: Path on which to export the block device via FUSE. +# This must point to an existing regular file. +# +# Since: 5.2 +## +{ 'struct': 'BlockExportOptionsFuse', + 'data': { 'mountpoint': 'str' }, + 'if': 'defined(CONFIG_FUSE)' } + ## # @BlockExportType: # @@ -181,10 +196,13 @@ # # @nbd: NBD export # +# @fuse: Fuse export (since: 5.2) +# # Since: 4.2 ## { 'enum': 'BlockExportType', - 'data': [ 'nbd' ] } + 'data': [ 'nbd', + { 'name': 'fuse', 'if': 'defined(CONFIG_FUSE)' } ] } =20 ## # @BlockExportOptions: @@ -213,7 +231,9 @@ '*writethrough': 'bool' }, 'discriminator': 'type', 'data': { - 'nbd': 'BlockExportOptionsNbd' + 'nbd': 'BlockExportOptionsNbd', + 'fuse': { 'type': 'BlockExportOptionsFuse', + 'if': 'defined(CONFIG_FUSE)' } } } =20 ## diff --git a/include/block/fuse.h b/include/block/fuse.h new file mode 100644 index 0000000000..ffa91fe364 --- /dev/null +++ b/include/block/fuse.h @@ -0,0 +1,30 @@ +/* + * Present a block device as a raw image through FUSE + * + * Copyright (c) 2020 Max Reitz + * + * 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; under version 2 or later of the License. + * + * 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 . + */ + +#ifndef BLOCK_FUSE_H +#define BLOCK_FUSE_H + +#ifdef CONFIG_FUSE + +#include "block/export.h" + +extern const BlockExportDriver blk_exp_fuse; + +#endif /* CONFIG_FUSE */ + +#endif diff --git a/block.c b/block.c index acde53f92a..7bf45f6ede 100644 --- a/block.c +++ b/block.c @@ -26,6 +26,7 @@ #include "block/trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "block/fuse.h" #include "block/nbd.h" #include "block/qdict.h" #include "qemu/error-report.h" diff --git a/block/export/export.c b/block/export/export.c index 64d39a6934..ba866d6ba7 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -16,6 +16,7 @@ #include "block/block.h" #include "sysemu/block-backend.h" #include "block/export.h" +#include "block/fuse.h" #include "block/nbd.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-export.h" @@ -24,6 +25,9 @@ =20 static const BlockExportDriver *blk_exp_drivers[] =3D { &blk_exp_nbd, +#ifdef CONFIG_FUSE + &blk_exp_fuse, +#endif }; =20 /* Only accessed from the main thread */ diff --git a/block/export/fuse.c b/block/export/fuse.c new file mode 100644 index 0000000000..75f11d2514 --- /dev/null +++ b/block/export/fuse.c @@ -0,0 +1,253 @@ +/* + * Present a block device as a raw image through FUSE + * + * Copyright (c) 2020 Max Reitz + * + * 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; under version 2 or later of the License. + * + * 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 . + */ + +#define FUSE_USE_VERSION 31 + +#include "qemu/osdep.h" +#include "block/aio.h" +#include "block/block.h" +#include "block/export.h" +#include "block/fuse.h" +#include "block/qapi.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-block.h" +#include "sysemu/block-backend.h" + +#include +#include + + +typedef struct FuseExport { + BlockExport common; + + struct fuse_session *fuse_session; + struct fuse_buf fuse_buf; + bool mounted, fd_handler_set_up; + + char *mountpoint; + bool writable; +} FuseExport; + +static GHashTable *exports; +static const struct fuse_lowlevel_ops fuse_ops; + +static void fuse_export_shutdown(BlockExport *exp); +static void fuse_export_delete(BlockExport *exp); + +static void init_fuse(void); +static int setup_fuse_export(FuseExport *exp, const char *mountpoint, + Error **errp); +static void read_from_fuse_export(void *opaque); + +static bool is_regular_file(const char *path, Error **errp); + + +static int fuse_export_create(BlockExport *blk_exp, + BlockExportOptions *blk_exp_args, + Error **errp) +{ + FuseExport *exp =3D container_of(blk_exp, FuseExport, common); + BlockExportOptionsFuse *args =3D &blk_exp_args->u.fuse; + int ret; + + assert(blk_exp_args->type =3D=3D BLOCK_EXPORT_TYPE_FUSE); + + init_fuse(); + + /* + * It is important to do this check before calling is_regular_file() -- + * that function will do a stat(), which we would have to handle if we + * already exported something on @mountpoint. But we cannot, because + * we are currently caught up here. + * (Note that ideally we would want to resolve relative paths here, + * but bdrv_make_absolute_filename() might do the wrong thing for + * paths that contain colons, and realpath() would resolve symlinks, + * which we do not want: The mount point is not going to be the + * symlink's destination, but the link itself.) + * So this will not catch all potential clashes, but hopefully at + * least the most common one of specifying exactly the same path + * string twice. + */ + if (g_hash_table_contains(exports, args->mountpoint)) { + error_setg(errp, "There already is a FUSE export on '%s'", + args->mountpoint); + ret =3D -EEXIST; + goto fail; + } + + if (!is_regular_file(args->mountpoint, errp)) { + ret =3D -EINVAL; + goto fail; + } + + exp->mountpoint =3D g_strdup(args->mountpoint); + exp->writable =3D blk_exp_args->writable; + + ret =3D setup_fuse_export(exp, args->mountpoint, errp); + if (ret < 0) { + goto fail; + } + + g_hash_table_insert(exports, g_strdup(args->mountpoint), NULL); + return 0; + +fail: + fuse_export_shutdown(blk_exp); + fuse_export_delete(blk_exp); + return ret; +} + +/** + * Ensure that the global FUSE context is set up. + */ +static void init_fuse(void) +{ + if (exports) { + return; + } + + exports =3D g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NUL= L); +} + +/** + * Create exp->fuse_session and mount it. + */ +static int setup_fuse_export(FuseExport *exp, const char *mountpoint, + Error **errp) +{ + const char *fuse_argv[2]; + struct fuse_args fuse_args; + int ret; + + fuse_argv[0] =3D ""; /* Dummy program name */ + fuse_argv[1] =3D NULL; + fuse_args =3D (struct fuse_args)FUSE_ARGS_INIT(1, (char **)fuse_argv); + + exp->fuse_session =3D fuse_session_new(&fuse_args, &fuse_ops, + sizeof(fuse_ops), exp); + if (!exp->fuse_session) { + error_setg(errp, "Failed to set up FUSE session"); + return -EIO; + } + + ret =3D fuse_session_mount(exp->fuse_session, mountpoint); + if (ret < 0) { + error_setg(errp, "Failed to mount FUSE session to export"); + return -EIO; + } + exp->mounted =3D true; + + aio_set_fd_handler(exp->common.ctx, + fuse_session_fd(exp->fuse_session), true, + read_from_fuse_export, NULL, NULL, exp); + exp->fd_handler_set_up =3D true; + + return 0; +} + +/** + * Callback to be invoked when the FUSE session FD can be read from. + * (This is basically the FUSE event loop.) + */ +static void read_from_fuse_export(void *opaque) +{ + FuseExport *exp =3D opaque; + int ret; + + blk_exp_ref(&exp->common); + + ret =3D fuse_session_receive_buf(exp->fuse_session, &exp->fuse_buf); + if (ret < 0) { + goto out; + } + + fuse_session_process_buf(exp->fuse_session, &exp->fuse_buf); + +out: + blk_exp_unref(&exp->common); +} + +static void fuse_export_shutdown(BlockExport *blk_exp) +{ + FuseExport *exp =3D container_of(blk_exp, FuseExport, common); + + if (exp->fuse_session) { + fuse_session_exit(exp->fuse_session); + + if (exp->mounted) { + fuse_session_unmount(exp->fuse_session); + exp->mounted =3D false; + } + + if (exp->fd_handler_set_up) { + aio_set_fd_handler(exp->common.ctx, + fuse_session_fd(exp->fuse_session), true, + NULL, NULL, NULL, NULL); + exp->fd_handler_set_up =3D false; + } + + fuse_session_destroy(exp->fuse_session); + exp->fuse_session =3D NULL; + } + + if (exp->mountpoint) { + g_hash_table_remove(exports, exp->mountpoint); + } +} + +static void fuse_export_delete(BlockExport *blk_exp) +{ + FuseExport *exp =3D container_of(blk_exp, FuseExport, common); + + free(exp->fuse_buf.mem); + g_free(exp->mountpoint); +} + +/** + * Check whether @path points to a regular file. If not, put an + * appropriate message into *errp. + */ +static bool is_regular_file(const char *path, Error **errp) +{ + struct stat statbuf; + int ret; + + ret =3D stat(path, &statbuf); + if (ret < 0) { + error_setg_errno(errp, errno, "Failed to stat '%s'", path); + return false; + } + + if (!S_ISREG(statbuf.st_mode)) { + error_setg(errp, "'%s' is not a regular file", path); + return false; + } + + return true; +} + +static const struct fuse_lowlevel_ops fuse_ops =3D { +}; + +const BlockExportDriver blk_exp_fuse =3D { + .type =3D BLOCK_EXPORT_TYPE_FUSE, + .instance_size =3D sizeof(FuseExport), + .create =3D fuse_export_create, + .delete =3D fuse_export_delete, + .request_shutdown =3D fuse_export_shutdown, +}; diff --git a/block/export/meson.build b/block/export/meson.build index 558ef35d38..3f7f8c5263 100644 --- a/block/export/meson.build +++ b/block/export/meson.build @@ -1 +1,2 @@ block_ss.add(files('export.c')) +block_ss.add(when: ['CONFIG_FUSE', libfuse], if_true: files('fuse.c')) --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772000; cv=none; d=zohomail.com; s=zohoarc; b=LRHYfKcApCMkuXi6xAYa8AQzOURZ0sj5ppFpBmKHED1BLW6Xsr7FiUk6rBy9ToiDf8Mgie4cobIgLCQ2RFiB4+5r86zvt0KV4O1x0LKqZ7/bHHv3jU2LQ176X04qHhXvMf3P6oBknawtXZAsNBOf2vIPBWy77mJ9z0tnphLZ9W0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772000; 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=h0+ghJ5Sv0SORUEp9BeRfqdslF+Xrc9zeLUiqNtoejU=; b=gxvkymCaLUi5fdYeCEUy4P2S8NRIP03N7imty1dGCus0DXNQ9rRaUssocW7Px9McstqziBp3XCptLhvAaTEx9ci0+GTWoWoSiDEvHnz4SYEXYwkVBrtoB116v8hU+vn1kdIBmNabHXP7QvVUhOrnk4DDE40HOn6CIKJykPXYuUY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772000788145.17709124152032; Tue, 22 Sep 2020 03:53:20 -0700 (PDT) Received: from localhost ([::1]:48136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKfvD-0003rW-Gq for importer@patchew.org; Tue, 22 Sep 2020 06:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfrz-00006t-Q1 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:49:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfrt-0000SY-K1 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:49:55 -0400 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-488-8Gp9NcPwPJCz93ARxjAMTA-1; Tue, 22 Sep 2020 06:49:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83E351006705; Tue, 22 Sep 2020 10:49:47 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F08645DD99; Tue, 22 Sep 2020 10:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771790; 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=h0+ghJ5Sv0SORUEp9BeRfqdslF+Xrc9zeLUiqNtoejU=; b=WAOMtHhNZNxfgxm4OBamiyNGPAJQMxUKcHk7TNl3DKge4GeYXU8Z5c6815Y9myKI0B6s/h kRAqX7gklmLsQCNWPqrVAhIkH/uFqMgcUAy9rT08Olm5x5it21kQtVnJyiLBuSuMeYy2os /736ue0SKaPfqrgp1jUidjdAPOCBHnw= X-MC-Unique: 8Gp9NcPwPJCz93ARxjAMTA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 03/20] fuse: Implement standard FUSE operations Date: Tue, 22 Sep 2020 12:49:15 +0200 Message-Id: <20200922104932.46384-4-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This makes the export actually useful instead of only producing errors whenever it is accessed. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block/export/fuse.c | 226 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index 75f11d2514..8fc667231d 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -32,6 +32,10 @@ #include =20 =20 +/* Prevent overly long bounce buffer allocations */ +#define FUSE_MAX_BOUNCE_BYTES (MIN(BDRV_REQUEST_MAX_BYTES, 64 * 1024 * 102= 4)) + + typedef struct FuseExport { BlockExport common; =20 @@ -241,7 +245,229 @@ static bool is_regular_file(const char *path, Error *= *errp) return true; } =20 + +/** + * Let clients look up files. Always return ENOENT because we only + * care about the mountpoint itself. + */ +static void fuse_lookup(fuse_req_t req, fuse_ino_t parent, const char *nam= e) +{ + fuse_reply_err(req, ENOENT); +} + +/** + * Let clients get file attributes (i.e., stat() the file). + */ +static void fuse_getattr(fuse_req_t req, fuse_ino_t inode, + struct fuse_file_info *fi) +{ + struct stat statbuf; + int64_t length, allocated_blocks; + time_t now =3D time(NULL); + ImageInfo *info =3D NULL; + FuseExport *exp =3D fuse_req_userdata(req); + mode_t mode; + Error *local_error =3D NULL; + + length =3D blk_getlength(exp->common.blk); + if (length < 0) { + fuse_reply_err(req, -length); + return; + } + + bdrv_query_image_info(blk_bs(exp->common.blk), &info, &local_error); + if (local_error) { + allocated_blocks =3D DIV_ROUND_UP(length, 512); + } else { + allocated_blocks =3D DIV_ROUND_UP(info->actual_size, 512); + } + + qapi_free_ImageInfo(info); + error_free(local_error); + local_error =3D NULL; + + mode =3D S_IFREG | S_IRUSR; + if (exp->writable) { + mode |=3D S_IWUSR; + } + + statbuf =3D (struct stat) { + .st_ino =3D inode, + .st_mode =3D mode, + .st_nlink =3D 1, + .st_uid =3D getuid(), + .st_gid =3D getgid(), + .st_size =3D length, + .st_blksize =3D blk_bs(exp->common.blk)->bl.request_alignment, + .st_blocks =3D allocated_blocks, + .st_atime =3D now, + .st_mtime =3D now, + .st_ctime =3D now, + }; + + fuse_reply_attr(req, &statbuf, 1.); +} + +static int fuse_do_truncate(const FuseExport *exp, int64_t size, + PreallocMode prealloc) +{ + uint64_t blk_perm, blk_shared_perm; + int ret; + + blk_get_perm(exp->common.blk, &blk_perm, &blk_shared_perm); + + ret =3D blk_set_perm(exp->common.blk, blk_perm | BLK_PERM_RESIZE, + blk_shared_perm, NULL); + if (ret < 0) { + return ret; + } + + ret =3D blk_truncate(exp->common.blk, size, true, prealloc, 0, NULL); + + /* Must succeed, because we are only giving up the RESIZE permission */ + blk_set_perm(exp->common.blk, blk_perm, blk_shared_perm, &error_abort); + + return ret; +} + +/** + * Let clients set file attributes. Only resizing is supported. + */ +static void fuse_setattr(fuse_req_t req, fuse_ino_t inode, struct stat *st= atbuf, + int to_set, struct fuse_file_info *fi) +{ + FuseExport *exp =3D fuse_req_userdata(req); + int ret; + + if (!exp->writable) { + fuse_reply_err(req, EACCES); + return; + } + + if (to_set & ~FUSE_SET_ATTR_SIZE) { + fuse_reply_err(req, ENOTSUP); + return; + } + + ret =3D fuse_do_truncate(exp, statbuf->st_size, PREALLOC_MODE_OFF); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + + fuse_getattr(req, inode, fi); +} + +/** + * Let clients open a file (i.e., the exported image). + */ +static void fuse_open(fuse_req_t req, fuse_ino_t inode, + struct fuse_file_info *fi) +{ + fuse_reply_open(req, fi); +} + +/** + * Handle client reads from the exported image. + */ +static void fuse_read(fuse_req_t req, fuse_ino_t inode, + size_t size, off_t offset, struct fuse_file_info *fi) +{ + FuseExport *exp =3D fuse_req_userdata(req); + int64_t length; + void *buf; + int ret; + + /** + * Clients will expect short reads at EOF, so we have to limit + * offset+size to the image length. + */ + length =3D blk_getlength(exp->common.blk); + if (length < 0) { + fuse_reply_err(req, -length); + return; + } + + size =3D MIN(size, FUSE_MAX_BOUNCE_BYTES); + if (offset + size > length) { + size =3D length - offset; + } + + buf =3D qemu_try_blockalign(blk_bs(exp->common.blk), size); + if (!buf) { + fuse_reply_err(req, ENOMEM); + return; + } + + ret =3D blk_pread(exp->common.blk, offset, buf, size); + if (ret >=3D 0) { + fuse_reply_buf(req, buf, size); + } else { + fuse_reply_err(req, -ret); + } + + qemu_vfree(buf); +} + +/** + * Handle client writes to the exported image. + */ +static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf, + size_t size, off_t offset, struct fuse_file_info *f= i) +{ + FuseExport *exp =3D fuse_req_userdata(req); + int64_t length; + int ret; + + if (!exp->writable) { + fuse_reply_err(req, EACCES); + return; + } + + /** + * Clients will expect short writes at EOF, so we have to limit + * offset+size to the image length. + */ + length =3D blk_getlength(exp->common.blk); + if (length < 0) { + fuse_reply_err(req, -length); + return; + } + + size =3D MIN(size, BDRV_REQUEST_MAX_BYTES); + if (offset + size > length) { + size =3D length - offset; + } + + ret =3D blk_pwrite(exp->common.blk, offset, buf, size, 0); + if (ret >=3D 0) { + fuse_reply_write(req, size); + } else { + fuse_reply_err(req, -ret); + } +} + +/** + * Let clients flush the exported image. + */ +static void fuse_flush(fuse_req_t req, fuse_ino_t inode, + struct fuse_file_info *fi) +{ + FuseExport *exp =3D fuse_req_userdata(req); + int ret; + + ret =3D blk_flush(exp->common.blk); + fuse_reply_err(req, ret < 0 ? -ret : 0); +} + static const struct fuse_lowlevel_ops fuse_ops =3D { + .lookup =3D fuse_lookup, + .getattr =3D fuse_getattr, + .setattr =3D fuse_setattr, + .open =3D fuse_open, + .read =3D fuse_read, + .write =3D fuse_write, + .flush =3D fuse_flush, }; =20 const BlockExportDriver blk_exp_fuse =3D { --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772038; cv=none; d=zohomail.com; s=zohoarc; b=WtJWBEi5kArU9RQXIBizpdOBZ7n7qHGZAKoLqve6S4kH4zgR+gEneGCJiBMy91hzWbKbxP27hvC7x9Aosdn99CrpzBbHN9VnXpM1o6oIn+GcTpysDzWBcjd+vsv/R0HjV18roxzaD7HkqKXwtD+XS86Q5pb7S2vZ7eMCloFcbbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772038; 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=BhZVKFSwmuAzcH2/U49rQXlAOhCA8MgG3ekspSBU1Lw=; b=O8hxiKt3JSlO4SMAnPBaC60pvYEnDhesaZ5stXt020ZRY+BOT6EfIAW7FxtNWiTcxLLOdAdJ1LKbxqJGvP/u2+x/voW47I29NncLz3BZeCXK3TMgaCV1T0eREE11ToP/c8pJ5bynTJ9jIOkras56cxUhokijUlixkq2ngqpcAe0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772038251636.8930954385022; Tue, 22 Sep 2020 03:53:58 -0700 (PDT) Received: from localhost ([::1]:50138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKfvo-0004iz-R3 for importer@patchew.org; Tue, 22 Sep 2020 06:53:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfs2-0000BB-Mo for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfrz-0000TE-Kl for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:02 -0400 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-180-obQtaXCZPXyv3nJPYBNaig-1; Tue, 22 Sep 2020 06:49:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80AD580EF8B; Tue, 22 Sep 2020 10:49:52 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D6825C1DC; Tue, 22 Sep 2020 10:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771795; 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=BhZVKFSwmuAzcH2/U49rQXlAOhCA8MgG3ekspSBU1Lw=; b=gMGn3XLIpw2JzJ+mD2QTXNNQqk3iD5nMp1/7ngwIBTXspH1e6jHaNY271nf+eSSfpAqOWZ jPlx1dk5baQMaBejyFa+39KmDu9wFKBuRDrDWSuydwHHZ4n3beDd6vcIMGRmmZv/4VwSUY U51Z8fnEQQZOFkq1DhK0f/i+yKhX6EY= X-MC-Unique: obQtaXCZPXyv3nJPYBNaig-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 04/20] fuse: Allow growable exports Date: Tue, 22 Sep 2020 12:49:16 +0200 Message-Id: <20200922104932.46384-5-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" These will behave more like normal files in that writes beyond the EOF will automatically grow the export size. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- qapi/block-export.json | 6 +++++- block/export/fuse.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index cb5bd54cbf..cb26daa98b 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -183,10 +183,14 @@ # @mountpoint: Path on which to export the block device via FUSE. # This must point to an existing regular file. # +# @growable: Whether writes beyond the EOF should grow the block node +# accordingly. (default: false) +# # Since: 5.2 ## { 'struct': 'BlockExportOptionsFuse', - 'data': { 'mountpoint': 'str' }, + 'data': { 'mountpoint': 'str', + '*growable': 'bool' }, 'if': 'defined(CONFIG_FUSE)' } =20 ## diff --git a/block/export/fuse.c b/block/export/fuse.c index 8fc667231d..f3a84579ba 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -45,6 +45,7 @@ typedef struct FuseExport { =20 char *mountpoint; bool writable; + bool growable; } FuseExport; =20 static GHashTable *exports; @@ -101,6 +102,7 @@ static int fuse_export_create(BlockExport *blk_exp, =20 exp->mountpoint =3D g_strdup(args->mountpoint); exp->writable =3D blk_exp_args->writable; + exp->growable =3D args->growable; =20 ret =3D setup_fuse_export(exp, args->mountpoint, errp); if (ret < 0) { @@ -436,7 +438,15 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inod= e, const char *buf, =20 size =3D MIN(size, BDRV_REQUEST_MAX_BYTES); if (offset + size > length) { - size =3D length - offset; + if (exp->growable) { + ret =3D fuse_do_truncate(exp, offset + size, PREALLOC_MODE_OFF= ); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + } else { + size =3D length - offset; + } } =20 ret =3D blk_pwrite(exp->common.blk, offset, buf, size, 0); --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772173; cv=none; d=zohomail.com; s=zohoarc; b=m041gNZ1Ez7hbOvVsvOnCXnUQtrecryRo9warJjO+UnVwQglqRekGY9WKNgXS64nPwvm5y8oT9h2DC7QprBI2H7znh4p334Dk0kLn1vFvCOmbpwHnNRe1LX25N4QMCkFRsQJlISDwRw3v7HmMMupF1P4gaWdG3pS5i5UOZj1RxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772173; 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=JVZyCNs/Dn0aSo/qEbqYorUsU/1QreNRX/oTOcK5AQk=; b=hR3I0HhFNrNSQDTIKfEVtQHoOyp9gHm1RlhYIPPI9Ix4IIN38bzG+i8fwklPTMmhbt6D2B585rMiIrEv0IR9KZKPt21Qer9giwJevNGpWWggwhiJ4Q5mNFtlKja0Su4OUf2Rb3Mnfi9KQkcfehQlIdwiyxzLgFhFXVG5MXJH3Iw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772173514160.20795107316656; Tue, 22 Sep 2020 03:56:13 -0700 (PDT) Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKfy0-0007nW-2P for importer@patchew.org; Tue, 22 Sep 2020 06:56:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfs3-0000Dy-Nl for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:24695 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfs1-0000Ti-Ij for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:03 -0400 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-532-sJggnF1eNhqqQOVP0JdP9w-1; Tue, 22 Sep 2020 06:49:58 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id ADC358030C7; Tue, 22 Sep 2020 10:49:57 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 552BD73682; Tue, 22 Sep 2020 10:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771800; 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=JVZyCNs/Dn0aSo/qEbqYorUsU/1QreNRX/oTOcK5AQk=; b=eRE5wpBEKxEDPHuW3LoQ8ByjutWE9KSm5/jpbNCdHiMFdce6zgG6eVZUqyJqw+pcZmcmBh dAntEocAZwGnj6Fx4igTa+PSnEVp7dnrQjumm7EwVWKFX8c8hZs/GgD22fhfWZh568nGNo f1Qy70UYZihzBgVc5D6SrdS9J/0SGxI= X-MC-Unique: sJggnF1eNhqqQOVP0JdP9w-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 05/20] fuse: (Partially) implement fallocate() Date: Tue, 22 Sep 2020 12:49:17 +0200 Message-Id: <20200922104932.46384-6-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:27:12 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This allows allocating areas after the (old) EOF as part of a growing resize, writing zeroes, and discarding. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block/export/fuse.c | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index f3a84579ba..7dfb4eb280 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -457,6 +457,84 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inod= e, const char *buf, } } =20 +/** + * Let clients perform various fallocate() operations. + */ +static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode, + off_t offset, off_t length, + struct fuse_file_info *fi) +{ + FuseExport *exp =3D fuse_req_userdata(req); + int64_t blk_len; + int ret; + + if (!exp->writable) { + fuse_reply_err(req, EACCES); + return; + } + + blk_len =3D blk_getlength(exp->common.blk); + if (blk_len < 0) { + fuse_reply_err(req, -blk_len); + return; + } + + if (mode & FALLOC_FL_KEEP_SIZE) { + length =3D MIN(length, blk_len - offset); + } + + if (mode & FALLOC_FL_PUNCH_HOLE) { + if (!(mode & FALLOC_FL_KEEP_SIZE)) { + fuse_reply_err(req, EINVAL); + return; + } + + do { + int size =3D MIN(length, BDRV_REQUEST_MAX_BYTES); + + ret =3D blk_pdiscard(exp->common.blk, offset, size); + length -=3D size; + } while (ret =3D=3D 0 && length > 0); + } else if (mode & FALLOC_FL_ZERO_RANGE) { + if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) { + ret =3D fuse_do_truncate(exp, offset + length, PREALLOC_MODE_O= FF); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + } + + do { + int size =3D MIN(length, BDRV_REQUEST_MAX_BYTES); + + ret =3D blk_pwrite_zeroes(exp->common.blk, + offset, size, 0); + length -=3D size; + } while (ret =3D=3D 0 && length > 0); + } else if (!mode) { + /* We can only fallocate at the EOF with a truncate */ + if (offset < blk_len) { + fuse_reply_err(req, EOPNOTSUPP); + return; + } + + if (offset > blk_len) { + /* No preallocation needed here */ + ret =3D fuse_do_truncate(exp, offset, PREALLOC_MODE_OFF); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + } + + ret =3D fuse_do_truncate(exp, offset + length, PREALLOC_MODE_FALLO= C); + } else { + ret =3D -EOPNOTSUPP; + } + + fuse_reply_err(req, ret < 0 ? -ret : 0); +} + /** * Let clients flush the exported image. */ @@ -477,6 +555,7 @@ static const struct fuse_lowlevel_ops fuse_ops =3D { .open =3D fuse_open, .read =3D fuse_read, .write =3D fuse_write, + .fallocate =3D fuse_fallocate, .flush =3D fuse_flush, }; =20 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772355; cv=none; d=zohomail.com; s=zohoarc; b=EDDvbXDgPcQdOkkmLhpIhrYvIHHFDn/sjTlHoa2vqgsjdHIJy3E58YJcew/XjDmVD7rjzT5Bka51HXyrU80qU96RfpLMAm9643uSYy7fY6j3Rwb9Zaj7zRPN9tasCtzXSdfSmyZEUNBOpKuSJ/CI99dI3loRMKoEm9vkrny5Ya4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772355; 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=yVqR4YkAYebBr45NHt4mXQykwLwrAbCfW2ZO2xLVLrQ=; b=B3EsqN4xJX+eDB95tnn7/9BrcuBu0D88Op/lTszn1MbwNmEJ+Mdb1CyqYJU469nYX+aYufnDZSTjrSv3raTWplQ//gCo0ekrP/18SXbZy4zCaxc8mzPc9ssMv0W2Ne69oBO4xR8bXEAjpIEXEaIjPp8wwS8HsYx1b+KznP+zjD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 160077235520418.28079778320705; Tue, 22 Sep 2020 03:59:15 -0700 (PDT) Received: from localhost ([::1]:37124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg0v-0002u8-SH for importer@patchew.org; Tue, 22 Sep 2020 06:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsA-0000Tt-7N for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55666 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfs8-0000Uv-Cf for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:09 -0400 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-511-DveOHsiVN_a8WCIbUByumA-1; Tue, 22 Sep 2020 06:50:03 -0400 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 D42B11084C80; Tue, 22 Sep 2020 10:50:02 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A005178803; Tue, 22 Sep 2020 10:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771807; 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=yVqR4YkAYebBr45NHt4mXQykwLwrAbCfW2ZO2xLVLrQ=; b=cDQ6QG5FAMDkfL4TFtlcS3ua9Hu6ZfktPi1m4zE9dz9x0K8D2+l3tbf+UR0VNf1+bBc9Z2 ngNnAhQt3JD9l+MwMxLABldncphuI4mFptZc4Ikpi81QEdU5py5wLIKLVHu77k/rGeKmFc VBcM8vGAoFyRG3PI2LJ6mnWhVCyJe50= X-MC-Unique: DveOHsiVN_a8WCIbUByumA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 06/20] fuse: Implement hole detection through lseek Date: Tue, 22 Sep 2020 12:49:18 +0200 Message-Id: <20200922104932.46384-7-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 01:57:21 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This is a relatively new feature in libfuse (available since 3.8.0, which was released in November 2019), so we have to let configure check whether it is available before making use of it. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- configure | 32 +++++++++++++++++++ block/export/fuse.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ meson.build | 1 + 3 files changed, 110 insertions(+) diff --git a/configure b/configure index 21c31e4694..6b9184b62a 100755 --- a/configure +++ b/configure @@ -6226,11 +6226,39 @@ EOF fuse_libs=3D$(pkg-config --libs fuse3) if compile_prog "$fuse_cflags" "$fuse_libs"; then fuse=3Dyes + + cat > $TMPC < +#include +#include +#include +#include +static void fuse_lseek(fuse_req_t req, fuse_ino_t inode, off_t offset, + int whence, struct fuse_file_info *fi) +{ + if (whence =3D=3D SEEK_DATA || whence =3D=3D SEEK_HOLE) { + fuse_reply_lseek(req, offset); + } else { + fuse_reply_err(req, EINVAL); + } +} +const struct fuse_lowlevel_ops fuse_ops =3D { + .lseek =3D fuse_lseek, +}; +int main(void) { return 0; } +EOF + if compile_prog "$fuse_cflags" "$fuse_libs"; then + fuse_lseek=3Dyes + else + fuse_lseek=3Dno + fi else if test "$fuse" =3D "yes"; then feature_not_found "fuse" fi fuse=3Dno + fuse_lseek=3Dno fi fi =20 @@ -7425,6 +7453,10 @@ if test "$fuse" =3D "yes"; then echo "CONFIG_FUSE=3Dy" >> $config_host_mak echo "FUSE_CFLAGS=3D$fuse_cflags" >> $config_host_mak echo "FUSE_LIBS=3D$fuse_libs" >> $config_host_mak + + if test "$fuse_lseek" =3D "yes"; then + echo "CONFIG_FUSE_LSEEK=3Dy" >> $config_host_mak + fi fi =20 if test "$tcg_interpreter" =3D "yes"; then diff --git a/block/export/fuse.c b/block/export/fuse.c index 7dfb4eb280..ee90f5a185 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -548,6 +548,80 @@ static void fuse_flush(fuse_req_t req, fuse_ino_t inod= e, fuse_reply_err(req, ret < 0 ? -ret : 0); } =20 +#ifdef CONFIG_FUSE_LSEEK +/** + * Let clients inquire allocation status. + */ +static void fuse_lseek(fuse_req_t req, fuse_ino_t inode, off_t offset, + int whence, struct fuse_file_info *fi) +{ + FuseExport *exp =3D fuse_req_userdata(req); + + if (whence !=3D SEEK_HOLE && whence !=3D SEEK_DATA) { + fuse_reply_err(req, EINVAL); + return; + } + + while (true) { + int64_t pnum; + int ret; + + ret =3D bdrv_block_status_above(blk_bs(exp->common.blk), NULL, + offset, INT64_MAX, &pnum, NULL, NULL= ); + if (ret < 0) { + fuse_reply_err(req, -ret); + return; + } + + if (!pnum && (ret & BDRV_BLOCK_EOF)) { + int64_t blk_len; + + /* + * If blk_getlength() rounds (e.g. by sectors), then the + * export length will be rounded, too. However, + * bdrv_block_status_above() may return EOF at unaligned + * offsets. We must not let this become visible and thus + * always simulate a hole between @offset (the real EOF) + * and @blk_len (the client-visible EOF). + */ + + blk_len =3D blk_getlength(exp->common.blk); + if (blk_len < 0) { + fuse_reply_err(req, -blk_len); + return; + } + + if (offset > blk_len || whence =3D=3D SEEK_DATA) { + fuse_reply_err(req, ENXIO); + } else { + fuse_reply_lseek(req, offset); + } + return; + } + + if (ret & BDRV_BLOCK_DATA) { + if (whence =3D=3D SEEK_DATA) { + fuse_reply_lseek(req, offset); + return; + } + } else { + if (whence =3D=3D SEEK_HOLE) { + fuse_reply_lseek(req, offset); + return; + } + } + + /* Safety check against infinite loops */ + if (!pnum) { + fuse_reply_err(req, ENXIO); + return; + } + + offset +=3D pnum; + } +} +#endif + static const struct fuse_lowlevel_ops fuse_ops =3D { .lookup =3D fuse_lookup, .getattr =3D fuse_getattr, @@ -557,6 +631,9 @@ static const struct fuse_lowlevel_ops fuse_ops =3D { .write =3D fuse_write, .fallocate =3D fuse_fallocate, .flush =3D fuse_flush, +#ifdef CONFIG_FUSE_LSEEK + .lseek =3D fuse_lseek, +#endif }; =20 const BlockExportDriver blk_exp_fuse =3D { diff --git a/meson.build b/meson.build index 85addd8562..1db6a46d14 100644 --- a/meson.build +++ b/meson.build @@ -1537,6 +1537,7 @@ summary_info +=3D {'thread sanitizer': config_host.h= as_key('CONFIG_TSAN')} summary_info +=3D {'rng-none': config_host.has_key('CONFIG_RNG_NO= NE')} summary_info +=3D {'Linux keyring': config_host.has_key('CONFIG_SECRET= _KEYRING')} summary_info +=3D {'fuse exports': config_host.has_key('CONFIG_FUSE')} +summary_info +=3D {'fuse lseek': config_host.has_key('CONFIG_FUSE_L= SEEK')} summary(summary_info, bool_yn: true) =20 if not supported_cpus.contains(cpu) --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772573; cv=none; d=zohomail.com; s=zohoarc; b=dMPBDw0KxZMBefsoZKLnnAj8siB0pgGlG43G5SLovwbufGUS0aLwBd+y2iX9WWEw0UhYk9rEzsTR+dMZkgAhwYxCrhJVTF1Kq9uIk4Zjn5LyvLliZwylrlCmzE1FK4wCLzMSNfaU33epdVvQuf7lsXVtsOx3PXvkbslJEOKpkr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772573; 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=R5nakXbYlk88+VkFoAoMK3+G+5E1jXjd5F5+C6SFMYE=; b=J23YE1enJ5qNeFVS3XuMpSPIb2xFNpZ+FFOb3B+h5vCQMNPhNXxqXpz0y9IQsHu8fQi38NJyzK2C6T2XM42J5O5vQCKfPYXHxmwShUuvIrOESPB7BYsepwOSfM5qQQhLOtrM5l4wCYWdoTm/IFVQOLAaROdq4Yj7bXF+KW78328= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 160077257317946.39047424839782; Tue, 22 Sep 2020 04:02:53 -0700 (PDT) Received: from localhost ([::1]:45464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg4R-0006nA-St for importer@patchew.org; Tue, 22 Sep 2020 07:02:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsA-0000Uc-KA for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:10 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:51680 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfs8-0000Uy-Jl for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:10 -0400 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-564-FEazPNE6OIyzHvht6mbrMQ-1; Tue, 22 Sep 2020 06:50:06 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F4381006704; Tue, 22 Sep 2020 10:50:05 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADBC573689; Tue, 22 Sep 2020 10:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771807; 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=R5nakXbYlk88+VkFoAoMK3+G+5E1jXjd5F5+C6SFMYE=; b=aR/At+cx0e1uAoBX5B9krVlUD/BPRWAmhU8lKRc4Wui4AVE6lBjty8sqnb3znWmGYxATln UoOqU4JYNbbk5iWPCIFYy/d70fZcEnMppAPeEm/aA9jasc72rA55mSdi3L66sK/s5kvZ8f ZcgyPyMtCsvfIGgAfzXJkJLlaeA5Zh8= X-MC-Unique: FEazPNE6OIyzHvht6mbrMQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 07/20] iotests: Do not needlessly filter _make_test_img Date: Tue, 22 Sep 2020 12:49:19 +0200 Message-Id: <20200922104932.46384-8-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 01:27:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" In most cases, _make_test_img does not need a _filter_imgfmt on top. It does that by itself. (The exception is when IMGFMT has been overwritten but TEST_IMG has not. In such cases, we do need a _filter_imgfmt on top to filter the test's original IMGFMT from TEST_IMG.) Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/161 | 12 ++++++------ tests/qemu-iotests/175 | 6 +++--- tests/qemu-iotests/249 | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161 index e270976d87..bbf7dbbc5c 100755 --- a/tests/qemu-iotests/161 +++ b/tests/qemu-iotests/161 @@ -48,9 +48,9 @@ _supported_os Linux IMG_SIZE=3D1M =20 # Create the images -TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt -TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT |= _filter_imgfmt -_make_test_img -b "$TEST_IMG.int" -F $IMGFMT -F $IMGFMT | _filter_imgfmt +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE +TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT +_make_test_img -b "$TEST_IMG.int" -F $IMGFMT -F $IMGFMT =20 # First test: reopen $TEST.IMG changing the detect-zeroes option on # its backing file ($TEST_IMG.int). @@ -105,9 +105,9 @@ echo echo "*** Commit and then change an option on the backing file" echo # Create the images again -TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt -TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT| = _filter_imgfmt -_make_test_img -b "$TEST_IMG.int" -F $IMGFMT | _filter_imgfmt +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE +TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT +_make_test_img -b "$TEST_IMG.int" -F $IMGFMT =20 _launch_qemu -drive if=3Dnone,file=3D"${TEST_IMG}" _send_qemu_cmd $QEMU_HANDLE \ diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 index 00a626aa63..c3c2aed653 100755 --- a/tests/qemu-iotests/175 +++ b/tests/qemu-iotests/175 @@ -89,20 +89,20 @@ min_blocks=3D$(stat -c '%b' "$TEST_DIR/empty") =20 echo echo "=3D=3D creating image with default preallocation =3D=3D" -_make_test_img -o extent_size_hint=3D0 $size | _filter_imgfmt +_make_test_img -o extent_size_hint=3D0 $size stat -c "size=3D%s, blocks=3D%b" $TEST_IMG | _filter_blocks $extra_blocks = $min_blocks $size =20 for mode in off full falloc; do echo echo "=3D=3D creating image with preallocation $mode =3D=3D" - _make_test_img -o preallocation=3D$mode,extent_size_hint=3D0 $size | _= filter_imgfmt + _make_test_img -o preallocation=3D$mode,extent_size_hint=3D0 $size stat -c "size=3D%s, blocks=3D%b" $TEST_IMG | _filter_blocks $extra_blo= cks $min_blocks $size done =20 for new_size in 4096 1048576; do echo echo "=3D=3D resize empty image with block_resize =3D=3D" - _make_test_img -o extent_size_hint=3D0 0 | _filter_imgfmt + _make_test_img -o extent_size_hint=3D0 0 _block_resize $TEST_IMG $new_size >/dev/null stat -c "size=3D%s, blocks=3D%b" $TEST_IMG | _filter_blocks $extra_blo= cks $min_blocks $new_size done diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index 68f13ed328..a9aa9303eb 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -48,9 +48,9 @@ _supported_os Linux IMG_SIZE=3D1M =20 # Create the images: base <- int <- active -TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt -TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT |= _filter_imgfmt -_make_test_img -b "$TEST_IMG.int" -F $IMGFMT | _filter_imgfmt +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE +TEST_IMG=3D"$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" -F $IMGFMT +_make_test_img -b "$TEST_IMG.int" -F $IMGFMT =20 # Launch QEMU with these two drives: # none0: base (read-only) --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772398; cv=none; d=zohomail.com; s=zohoarc; b=Ja1S3hXiSsdS74y1ZBavLdOOVsoH8bZX12jnvuTHXK8x3AHLXm2dQIJ/4Lp/v93fIg5GISQUhCDRQ9Whw0Wx4ekEXtlDC///jQmo69+FYAMMkmGPcP3hzUx55xFoMb+h41BZKBpmbCIkjsZjZGoC06Us7+qka0cmKZae8g++ZFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772398; 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=VrNLWWGu/NoYYLfuGrYjBz7L2ZkHTFzeHVYUhsv1N7Q=; b=JKC32nbMErxIjZ+66aX2K1OLf10GT66LCu55rh7R+AdNj5AxbUsn6QsDDSwmZS+VksRAZRIXcJC7eSCdA/w6+u9chlb6g4yodX3Z0AB6D0us5uhkPpPje0mzS6GES1jBBfNqnq/6TTDDHtHJZGa7eCwz67Td2ugimjXGgDZ60aY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772398196112.17312506768974; Tue, 22 Sep 2020 03:59:58 -0700 (PDT) Received: from localhost ([::1]:39690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg1c-0003zu-U2 for importer@patchew.org; Tue, 22 Sep 2020 06:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsI-0000ZB-Sn for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsD-0000Vm-IZ for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:18 -0400 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-243-q7OcGV0AMtKK-vYte8rYmw-1; Tue, 22 Sep 2020 06:50:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A2A51006706; Tue, 22 Sep 2020 10:50:10 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF33C5DA7B; Tue, 22 Sep 2020 10:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771812; 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=VrNLWWGu/NoYYLfuGrYjBz7L2ZkHTFzeHVYUhsv1N7Q=; b=CQyer6eiPa022hajrTT2FR9J1ZIjr1GA1rWBv+8CYtLZ3TuZ5CuqNfqvxbbR/2/YzpAOf/ CO2uN/v8tjagA1m4WqGlDAXyu/BQYtYoOao1/5OFZCjjLxZlwVTkR5MzYJf7UYazVZor8o 6dBMMqcCCtHOKCJ9i0kvcQQfT54yLlc= X-MC-Unique: q7OcGV0AMtKK-vYte8rYmw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 08/20] iotests: Do not pipe _make_test_img Date: Tue, 22 Sep 2020 12:49:20 +0200 Message-Id: <20200922104932.46384-9-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Executing _make_test_img as part of a pipe will undo all variable changes it has done. As such, this could not work with FUSE (because we want to remember all of our exports and their qemu instances). Replace the pipe by a temporary file in 071 and 174 (the two tests that can run on FUSE). Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/071 | 19 +++++++++++++++---- tests/qemu-iotests/174 | 10 +++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 88faebcc1d..18fe9054b0 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -61,8 +61,17 @@ echo echo "=3D=3D=3D Testing blkverify through filename =3D=3D=3D" echo =20 -TEST_IMG=3D"$TEST_IMG.base" IMGFMT=3D"raw" _make_test_img --no-opts $IMG_S= IZE |\ - _filter_imgfmt +# _make_test_img may set variables that we need to retain. Everything +# in a pipe is executed in a subshell, so doing so would throw away +# all changes. Therefore, we have to store the output in some temp +# file and filter that. +scratch_out=3D"$TEST_DIR/img-create.out" + +TEST_IMG=3D"$TEST_IMG.base" IMGFMT=3D"raw" _make_test_img --no-opts $IMG_S= IZE \ + >"$scratch_out" +_filter_imgfmt <"$scratch_out" +rm -f "$scratch_out" + _make_test_img $IMG_SIZE $QEMU_IO -c "open -o driver=3Draw,file.driver=3Dblkverify,file.raw.filenam= e=3D$TEST_IMG.base $TEST_IMG" \ -c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x380= 00 512' | _filter_qemu_io @@ -76,8 +85,10 @@ echo echo "=3D=3D=3D Testing blkverify through file blockref =3D=3D=3D" echo =20 -TEST_IMG=3D"$TEST_IMG.base" IMGFMT=3D"raw" _make_test_img --no-opts $IMG_S= IZE |\ - _filter_imgfmt +TEST_IMG=3D"$TEST_IMG.base" IMGFMT=3D"raw" _make_test_img --no-opts $IMG_S= IZE \ + >"$scratch_out" +_filter_imgfmt <"$scratch_out" + _make_test_img $IMG_SIZE $QEMU_IO -c "open -o driver=3Draw,file.driver=3Dblkverify,file.raw.filenam= e=3D$TEST_IMG.base,file.test.driver=3D$IMGFMT,file.test.file.filename=3D$TE= ST_IMG" \ -c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x380= 00 512' | _filter_qemu_io diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174 index e2f14a38c6..1b0dd2e8b7 100755 --- a/tests/qemu-iotests/174 +++ b/tests/qemu-iotests/174 @@ -40,7 +40,15 @@ _unsupported_fmt raw =20 =20 size=3D256K -IMGFMT=3Draw IMGKEYSECRET=3D _make_test_img --no-opts $size | _filter_imgf= mt + +# _make_test_img may set variables that we need to retain. Everything +# in a pipe is executed in a subshell, so doing so would throw away +# all changes. Therefore, we have to store the output in some temp +# file and filter that. +scratch_out=3D"$TEST_DIR/img-create.out" +IMGFMT=3Draw IMGKEYSECRET=3D _make_test_img --no-opts $size >"$scratch_out" +_filter_imgfmt <"$scratch_out" +rm -f "$scratch_out" =20 echo echo "=3D=3D reading wrong format should fail =3D=3D" --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772162; cv=none; d=zohomail.com; s=zohoarc; b=b2RTgQ+8hcHlkSkSXq982dnSB8uGf1wh9CaJWhWrNmd4Rdku5U/PgOM+vEUW+gDZUj1PA2aGiaS4uuBHYHJhcjsXtUF72/SjcR91HDDKc8FDxs8gIPsdh0SRZtXdw5RtDPneN6FFPcSr6lJ6hwsuJCCD1gkL5gOJTRRXvlmBl/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772162; 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=q0+mbpy7TGMFbJ2dlBNKv31mcrtHShg9gJHn2HPnyPQ=; b=j11ysrs0U8y/tuK/PGQ+7SNrsJUj/Ieefq4tH6EhbjKGa1FseIsqBAZWPEoE53dSrdUqibZa8Ay8OZjT+La6e7QycqJYiOmlw4Cocw5woieRkVSwYS2UpaxqmzoXhBfZFXr54+ukAsFuPBjm24AjH9av2T9MvAcqRjkf8qacCRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772162832597.5850655547737; Tue, 22 Sep 2020 03:56:02 -0700 (PDT) Received: from localhost ([::1]:56112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKfxp-0007Mm-Ir for importer@patchew.org; Tue, 22 Sep 2020 06:56:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsP-0000as-Oa for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55681 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsL-0000c5-LJ for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:25 -0400 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-499-Ji-blN25NsaVotPGqm11IQ-1; Tue, 22 Sep 2020 06:50:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E096C57053; Tue, 22 Sep 2020 10:50:15 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FC06610AF; Tue, 22 Sep 2020 10:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771820; 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=q0+mbpy7TGMFbJ2dlBNKv31mcrtHShg9gJHn2HPnyPQ=; b=gva83zgtW3HvDee08UlDg6kgpF55rcStzj4TYoHyfchzBnOoLa+/x0msmIj86Bhksccti/ huwDlBGi6ZGDvtNh383XRom/ROT2QCD7WCWydcQMNy6TRcD9mD1yVC4mBxQrU5ygnlj7YC ZadAcvEG/JpZWgq7hgkEnJM3OqORn2o= X-MC-Unique: Ji-blN25NsaVotPGqm11IQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 09/20] iotests: Use convert -n in some cases Date: Tue, 22 Sep 2020 12:49:21 +0200 Message-Id: <20200922104932.46384-10-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 01:57:21 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" qemu-img convert (without -n) can often be replaced by a combination of _make_test_img + qemu-img convert -n. Doing so allows converting to protocols that do not allow direct file creation, such as FUSE exports. The only problem is that for formats other than qcow2 and qed (qcow1 at least), this may lead to high disk usage for some reason, so we cannot do it everywhere. But we can do it in 028 and 089, so let us do that so they can run on FUSE exports. Also, in 028 this allows us to remove a 9-line comment that used to explain why we cannot safely filter drive-backup's image creation output. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/028 | 14 ++++---------- tests/qemu-iotests/028.out | 3 +++ tests/qemu-iotests/089 | 3 ++- tests/qemu-iotests/089.out | 1 + 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 6dd3ae09a3..864dc4a4e2 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -116,16 +116,10 @@ else QEMU_COMM_TIMEOUT=3D1 fi =20 -# Silence output since it contains the disk image path and QEMU's readline -# character echoing makes it very hard to filter the output. Plus, there -# is no telling how many times the command will repeat before succeeding. -# (Note that creating the image results in a "Formatting..." message over -# stdout, which is the same channel the monitor uses. We cannot reliably -# wait for it because the monitor output may interact with it in such a -# way that _timed_wait_for cannot read it. However, once the block job is -# done, we know that the "Formatting..." message must have appeared -# already, so the output is still deterministic.) -silent=3Dy _send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)" +TEST_IMG=3D"$TEST_IMG.copy" _make_test_img $image_size +_send_qemu_cmd $h "drive_backup -n disk ${TEST_IMG}.copy" "(qemu)" \ + | _filter_imgfmt + silent=3Dy qemu_cmd_repeat=3D20 _send_qemu_cmd $h "info block-jobs" "No ac= tive jobs" _send_qemu_cmd $h "info block-jobs" "No active jobs" _send_qemu_cmd $h 'quit' "" diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out index 5a68de5c46..e580488216 100644 --- a/tests/qemu-iotests/028.out +++ b/tests/qemu-iotests/028.out @@ -468,6 +468,9 @@ No errors were found on the image. =20 block-backup =20 +Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=3DIMGFMT size=3D4294968832 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) drive_backup -n disk TEST_DIR/t.IMGFMT.copy (qemu) info block-jobs No active jobs =3D=3D=3D IO: pattern 195 diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089 index 66c5415abe..03a2ccf1e8 100755 --- a/tests/qemu-iotests/089 +++ b/tests/qemu-iotests/089 @@ -62,7 +62,8 @@ TEST_IMG=3D"$TEST_IMG.base" _make_test_img $IMG_SIZE $QEMU_IO -c 'write -P 42 0 512' -c 'write -P 23 512 512' \ -c 'write -P 66 1024 512' "$TEST_IMG.base" | _filter_qemu_io =20 -$QEMU_IMG convert -f raw -O $IMGFMT "$TEST_IMG.base" "$TEST_IMG" +_make_test_img $IMG_SIZE +$QEMU_IMG convert -f raw -O $IMGFMT -n "$TEST_IMG.base" "$TEST_IMG" =20 $QEMU_IO_PROG --cache $CACHEMODE --aio $AIOMODE \ -c 'read -P 42 0 512' -c 'read -P 23 512 512' \ diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out index 15682c2886..c53fc4823a 100644 --- a/tests/qemu-iotests/089.out +++ b/tests/qemu-iotests/089.out @@ -9,6 +9,7 @@ wrote 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 512 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772640; cv=none; d=zohomail.com; s=zohoarc; b=DXXzFfn7+c5Yv9zAu/KSvqeh/4oRyP3QhTw+56XBhi5zV6hwFjWODDxg+lo70RzkCDWPMWnYGvMCx/HIsEuUlgCNFCZpwSQF3BJGSTcaEcAdv6AfcVmppx8pH9TBerF1P0iZw/zs5ETh6KHKw5oY7k1E/3FNQZJ48oZq903YjsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772640; 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=bMqqcLr9JG95ly+lj7FE8wdO+45EOuRAVEGeYi7CymE=; b=XngY34+91XNVTW+RfteHTy/Zqbl0BkeT1sCFEUan1NcKr4Y5DkDKW/uT7nz02gPXXKcI6UEAcl0Hd8ifN1Ms9sYSVBfu/kQETg2kN770yb3ffaJMto2TTRwCfmDMReVMAAjLikjksYwPymjPMyffgHC76dj6AYL4BHJWWTVCPOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772640763580.6448409509751; Tue, 22 Sep 2020 04:04:00 -0700 (PDT) Received: from localhost ([::1]:48616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg5S-0008EK-El for importer@patchew.org; Tue, 22 Sep 2020 07:03:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsS-0000ii-VZ for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsR-0000ih-8k for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:28 -0400 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-13-gE7TE96RMXil7LJCTwV4yQ-1; Tue, 22 Sep 2020 06:50:22 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32CED186841B; Tue, 22 Sep 2020 10:50:21 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D46177367E; Tue, 22 Sep 2020 10:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771826; 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=bMqqcLr9JG95ly+lj7FE8wdO+45EOuRAVEGeYi7CymE=; b=ed9xKkavhtZ1JXkLxetyaXYRUqcKR6FODwfTHXYHS1N47IR5OwLyiLOqUq6LMr/T9c5H32 gH7rOFEYixBLTIaw6ZmX4amULCC2DFzJo3vHhCD68n4nGAkly7gb8dw+IsPuJ9b61hAW7T tKpact/DOJTD3WRtdLVDStNEa3KDi+E= X-MC-Unique: gE7TE96RMXil7LJCTwV4yQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 10/20] iotests/046: Avoid renaming images Date: Tue, 22 Sep 2020 12:49:22 +0200 Message-Id: <20200922104932.46384-11-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This generally does not work on non-file protocols. It is better to create the image with the final name from the start, and most tests do this already. Let 046 follow suit. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/046 | 5 +++-- tests/qemu-iotests/046.out | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 index 88b3363c19..40a9f30087 100755 --- a/tests/qemu-iotests/046 +++ b/tests/qemu-iotests/046 @@ -47,6 +47,8 @@ size=3D128M echo echo "=3D=3D creating backing file for COW tests =3D=3D" =20 +TEST_IMG_SAVE=3D$TEST_IMG +TEST_IMG=3D"$TEST_IMG.base" _make_test_img $size =20 backing_io() @@ -67,8 +69,7 @@ backing_io() =20 backing_io 0 32 write | $QEMU_IO "$TEST_IMG" | _filter_qemu_io =20 -mv "$TEST_IMG" "$TEST_IMG.base" - +TEST_IMG=3D$TEST_IMG_SAVE _make_test_img -b "$TEST_IMG.base" -F $IMGFMT 6G =20 echo diff --git a/tests/qemu-iotests/046.out b/tests/qemu-iotests/046.out index b022bcddd5..66ad987ab3 100644 --- a/tests/qemu-iotests/046.out +++ b/tests/qemu-iotests/046.out @@ -1,7 +1,7 @@ QA output created by 046 =20 =3D=3D creating backing file for COW tests =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D134217728 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 65536/65536 bytes at offset 65536 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772916; cv=none; d=zohomail.com; s=zohoarc; b=CPPSVQmaq7JVGLeX9PeBlCfysPbYYxi5UOYfmKZbdsHstwsI0zYOhkA6t3Xapa7PyRHG0LBEuK+zIvv2/5soPqQzp4LvlnrH1qBDdaOQzkw5tzzT9WGddtYkxVDmL2YKSbDuc21N39T5CgOh38Vt+VScX0YonZ5WRANvvXK85f8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772916; 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=dCRydtgaPvrptI+7Vg+MSDxHu+Qo9x3X8lvCx49A8Ww=; b=mCrW6ew5tWxoQyhhjkizFBOsrP2W0ljByA2DyL0y7tAt7lwpa7UqvgRSU4QuPwwvDiUbUIj4uX8C3B5cz55SJSjcKgN2f81LVNv5huomv8171TzU+SUsMOcaQJ1BvdLy18qYI1xdTT8xpF/8yN54IQZHFjl8XrMb63yTnhw5SQU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772916958662.0440343986799; Tue, 22 Sep 2020 04:08:36 -0700 (PDT) Received: from localhost ([::1]:56886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg9z-0003Ty-Ia for importer@patchew.org; Tue, 22 Sep 2020 07:08:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsZ-00011G-PO for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsX-0000kq-5p for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:35 -0400 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-353-xxBw6ATPN6KtTXJOepAJNw-1; Tue, 22 Sep 2020 06:50:30 -0400 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 7A2E41007382; Tue, 22 Sep 2020 10:50:29 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F8697881A; Tue, 22 Sep 2020 10:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771832; 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=dCRydtgaPvrptI+7Vg+MSDxHu+Qo9x3X8lvCx49A8Ww=; b=AOO/W5PViBNiEjovVhaIl/BwFWO+iOm5N2UGaWsYMn9P8Hge/FqhWWvgFzoQx8AJahYP14 orwoa9XBe+Zgl/zXXV5uzEo/TGFtpDP4G6bOBraQAorUxwhHY3+1IUBy0HPrhS87gpF7b6 fMdiVEwX4Qd5toW6yK1TyjEjdB4uhk8= X-MC-Unique: xxBw6ATPN6KtTXJOepAJNw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 11/20] iotests: Derive image names from $TEST_IMG Date: Tue, 22 Sep 2020 12:49:23 +0200 Message-Id: <20200922104932.46384-12-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Avoid creating images with custom filenames in $TEST_DIR, because non-file protocols may want to keep $TEST_IMG (and all other test images) in some other directory. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/200 | 3 +-- tests/qemu-iotests/200.out | 4 ++-- tests/qemu-iotests/229 | 3 +-- tests/qemu-iotests/229.out | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200 index 59f7854b9f..a7aabbd032 100755 --- a/tests/qemu-iotests/200 +++ b/tests/qemu-iotests/200 @@ -44,8 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file =20 -BACKING_IMG=3D"${TEST_DIR}/backing.img" -TEST_IMG=3D"${TEST_DIR}/test.img" +BACKING_IMG=3D"$TEST_IMG.base" =20 TEST_IMG=3D"$BACKING_IMG" _make_test_img 512M _make_test_img -F $IMGFMT -b "$BACKING_IMG" 512M diff --git a/tests/qemu-iotests/200.out b/tests/qemu-iotests/200.out index a6776070e4..5883f16ac3 100644 --- a/tests/qemu-iotests/200.out +++ b/tests/qemu-iotests/200.out @@ -1,6 +1,6 @@ QA output created by 200 -Formatting 'TEST_DIR/backing.img', fmt=3DIMGFMT size=3D536870912 -Formatting 'TEST_DIR/test.img', fmt=3DIMGFMT size=3D536870912 backing_file= =3DTEST_DIR/backing.img backing_fmt=3DIMGFMT +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D536870912 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D536870912 backing_file= =3DTEST_DIR/t.IMGFMT.base backing_fmt=3DIMGFMT wrote 314572800/314572800 bytes at offset 512 300 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229 index 89a5359f32..5f759fa587 100755 --- a/tests/qemu-iotests/229 +++ b/tests/qemu-iotests/229 @@ -51,8 +51,7 @@ _supported_os Linux _unsupported_imgopts data_file =20 =20 -DEST_IMG=3D"$TEST_DIR/d.$IMGFMT" -TEST_IMG=3D"$TEST_DIR/b.$IMGFMT" +DEST_IMG=3D"$TEST_IMG.dest" BLKDEBUG_CONF=3D"$TEST_DIR/blkdebug.conf" =20 _make_test_img 2M diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out index 4de6dfaa28..7eed393013 100644 --- a/tests/qemu-iotests/229.out +++ b/tests/qemu-iotests/229.out @@ -1,6 +1,6 @@ QA output created by 229 -Formatting 'TEST_DIR/b.IMGFMT', fmt=3DIMGFMT size=3D2097152 -Formatting 'TEST_DIR/d.IMGFMT', fmt=3DIMGFMT size=3D2097152 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2097152 +Formatting 'TEST_DIR/t.IMGFMT.dest', fmt=3DIMGFMT size=3D2097152 wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {'execute': 'qmp_capabilities'} @@ -8,7 +8,7 @@ wrote 2097152/2097152 bytes at offset 0 =20 =3D=3D=3D Starting drive-mirror, causing error & stop =3D=3D=3D =20 -{'execute': 'drive-mirror', 'arguments': {'device': 'testdisk', 'format': = 'IMGFMT', 'target': 'blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/d.IMGFMT', 's= ync': 'full', 'mode': 'existing', 'on-source-error': 'stop', 'on-target-err= or': 'stop' }} +{'execute': 'drive-mirror', 'arguments': {'device': 'testdisk', 'format': = 'IMGFMT', 'target': 'blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT.dest= ', 'sync': 'full', 'mode': 'existing', 'on-source-error': 'stop', 'on-targe= t-error': 'stop' }} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} {"return": {}} --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772343; cv=none; d=zohomail.com; s=zohoarc; b=DmuzCQLfzwMN4TR0+Fj7V7NRPsSJqJ+MhKTyYwN9MWYLb6I9w51Enr65zfe9uMvDet0wJNgJciMWWk9D+N3BXneQMw3Y36xqX0AHLUL07hzCKlpKoah2+L6GcNF6gAo2LiO+KkGJsAoJPk9bhTh6db7n+tECYCvw/i9q4CoMd58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772343; 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=XiXJEsxxw18B62bLr54jVtcPVTPsXYJ26yY4Rm7pLDY=; b=Hx3ITlN+pyzenqTcqb7fGmC4P+tGKo4gyk6qrU7fnqg7hQyBJcFlF5aL1IfyFWMojmK5gxCpfujZvt1F8nuMvqQjEPsBXmC4zn6XNUiDRJv7pgCxRYJQZ1uFhWSB7IL8crjV0fDstub6Uwlhe8DN0aR1Dy9B4C6WYDnqUN9YEPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772343508370.8349762117708; Tue, 22 Sep 2020 03:59:03 -0700 (PDT) Received: from localhost ([::1]:35984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg0k-0002Qs-6a for importer@patchew.org; Tue, 22 Sep 2020 06:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsd-0001CJ-Uv for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:40 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35883 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsc-0000lj-7p for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:39 -0400 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-330-PQVVPcWWM-a-pldnQmG_1Q-1; Tue, 22 Sep 2020 06:50:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC92957084; Tue, 22 Sep 2020 10:50:34 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6906F5DD99; Tue, 22 Sep 2020 10:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771837; 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=XiXJEsxxw18B62bLr54jVtcPVTPsXYJ26yY4Rm7pLDY=; b=hBFIgsUGWsaS3TTlKauosqrgtpl30U7tzRREUm3lzxkoI9HVQO7tiWvRht7MDED5Kt/Fiv lIG4sSXKBCKbtAOsQTQfPyjg7qW5N7sUdfFpb4tNLZuR3nH5UgdWV9ruKXrZRa7ulPoD2d rOzyYku607ANO1MljIMFIlVlKkSUIqo= X-MC-Unique: PQVVPcWWM-a-pldnQmG_1Q-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 12/20] iotests/091: Use _cleanup_qemu instad of "wait" Date: Tue, 22 Sep 2020 12:49:24 +0200 Message-Id: <20200922104932.46384-13-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:27:12 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" If the test environment has some other child processes running (like a storage daemon that provides a FUSE export), then "wait" will never finish. Use wait=3Dyes _cleanup_qemu instead. (We need to discard the output so there is no change to the reference output.) Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/091 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 68fbfd777b..8a4ce5b7e2 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -96,7 +96,8 @@ _send_qemu_cmd $h2 'qemu-io disk flush' "(qemu)" _send_qemu_cmd $h2 'quit' "" _send_qemu_cmd $h1 'quit' "" =20 -wait +wait=3Dyes _cleanup_qemu >/dev/null + echo "Check image pattern" ${QEMU_IO} -c "read -P 0x22 0 4M" "${TEST_IMG}" | _filter_testdir | _filte= r_qemu_io =20 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772901; cv=none; d=zohomail.com; s=zohoarc; b=VWaIgYPNtXhbv9C+xihLGAD5AYQtcDdBrve/uFY4dzKTEeHK972Fq2/0QGhrbjkxzF2u6KPGDgr7xyWICM+tG9Vl5IPeiBeECw6fN88T4/IKxtSq2E4jGNlrJVVEjle3gLARsggDTefGoojkKaudGHTLatkjqvGpmeh/vhpvLwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772901; 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=sJmiZ/4gGL9X7a1xMH1e51jL8e7xdhV5NxQVc0NJXHA=; b=SlXpLdJ8/7jfuNoONJRrCJa/UpH+rxvnu6OZDwVSx/4qGa96TVlQZAGX+ELasrFUC9iekpjjAn8HXWwUcGQ4y/j+ryVUeoIqm9rsVO4u1JGJ97ksLYdsO2OLybEdCGh3ZhgYUMhf2HHucbjsF7a+FEfl0jWdLPWnKO2kz/oMCAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772901547117.99275453305358; Tue, 22 Sep 2020 04:08:21 -0700 (PDT) Received: from localhost ([::1]:56332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg9j-0003FP-SW for importer@patchew.org; Tue, 22 Sep 2020 07:08:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsj-0001HR-V9 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsh-0000mJ-Mc for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:45 -0400 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-268-jUXg152VPUS54t8__fjnLw-1; Tue, 22 Sep 2020 06:50:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6159D873073; Tue, 22 Sep 2020 10:50:40 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF9135577E; Tue, 22 Sep 2020 10:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771843; 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=sJmiZ/4gGL9X7a1xMH1e51jL8e7xdhV5NxQVc0NJXHA=; b=RGhmLuIb/Q2JQDoa0vKLCgkdTPHVR5CZKwHHNZRDG9c2TDfK6j/RMzbHZiKnxg0qTOgoAu kGk6LUQBElr2SFBEp169OxKHQPMou8SSBv5ytYTeOOOI38WRhdu2WPYfrVduI97Fqx/ceZ F07i4drhIOKAPEGOmlulAeOsvJUR89I= X-MC-Unique: jUXg152VPUS54t8__fjnLw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 13/20] iotests: Restrict some Python tests to file Date: Tue, 22 Sep 2020 12:49:25 +0200 Message-Id: <20200922104932.46384-14-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 02:07:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Most Python tests are restricted to the file protocol (without explicitly saying so), but these are the ones that would break ./check -fuse -qcow2. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/206 | 3 ++- tests/qemu-iotests/242 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206 index 11bc51f256..0a3ee5ef00 100755 --- a/tests/qemu-iotests/206 +++ b/tests/qemu-iotests/206 @@ -23,7 +23,8 @@ import iotests from iotests import imgfmt =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2'], + supported_protocols=3D['file']) iotests.verify_working_luks() =20 with iotests.FilePath('t.qcow2') as disk_path, \ diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 index 64f1bd95e4..a16de3085f 100755 --- a/tests/qemu-iotests/242 +++ b/tests/qemu-iotests/242 @@ -24,7 +24,8 @@ import struct from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \ file_path, img_info_log, log, filter_qemu_io =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2'], + supported_protocols=3D['file']) =20 disk =3D file_path('disk') chunk =3D 256 * 1024 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600773064; cv=none; d=zohomail.com; s=zohoarc; b=I9reNN/k6AdYKTvhWRF9ul6jnfClHP4OSye7ZY2g8znE/7kC++pUN0voLhirldf+npmPR8/HpaIxxp5G6dhpg9RMLLfNYk9J088YbE7OS58Va4cLMb5vG0p+lmdf4DA8+/fmzVxcTEumUue5Erq6qwcN21bT+mn/WfO9GgQvmRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600773064; 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=VxaBXukieqd0bKROHpBknWZKD/JELXqlMlAShG+WSFs=; b=jkFBSiC6iWYt/1lZjMDWYgFS9fjMW3YP7sW8GJEydVXrSTnvSlUH3Vlu5zJtogq/IFnTxF7V2+EZXYnPCN4lbSKcpiEI56nk00BNfvh9mmhhVMI0RAnEdRua4Mmn22kOkWFrA6AeGETZRKZyjFjPAqtaw447vmWC5j0dnYUSKMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600773064385700.4763993466347; Tue, 22 Sep 2020 04:11:04 -0700 (PDT) Received: from localhost ([::1]:38036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKgCN-0007NY-3y for importer@patchew.org; Tue, 22 Sep 2020 07:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfst-0001Lf-Gp for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsp-0000mn-EU for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:55 -0400 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-143-pcITSo-xOgy3TQR4N7EJrg-1; Tue, 22 Sep 2020 06:50:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99002593B1; Tue, 22 Sep 2020 10:50:45 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EC9E610AF; Tue, 22 Sep 2020 10:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771850; 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=VxaBXukieqd0bKROHpBknWZKD/JELXqlMlAShG+WSFs=; b=D2Ci6OAVSM0XIViBJIgx8OfOAPYoGA6MXzcl4wjp/tSR6e0udc6AsLXPyFlJn35+E1EJpW bsaAxY/okdtlGU9GLiD7jSwjHA0SNE2peCcPaenbTIwriiLUXxYsRio+4awXKEZyKGHJ8t HuSoEwa1FpQLS6S552/mt80g2xCc6xw= X-MC-Unique: pcITSo-xOgy3TQR4N7EJrg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 14/20] iotests: Let _make_test_img guess $TEST_IMG_FILE Date: Tue, 22 Sep 2020 12:49:26 +0200 Message-Id: <20200922104932.46384-15-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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 most iotests want to create a test image that is named differently from the default $TEST_IMG, they do something like this: TEST_IMG=3D"$TEST_IMG.base" _make_test_img $options This works fine with the "file" protocol, but not so much for anything else: _make_test_img tries to create an image under $TEST_IMG_FILE first, and only under $TEST_IMG if the former is not set; and on everything but "file", $TEST_IMG_FILE is set. There are two ways we can fix this: First, we could make all tests adjust not only TEST_IMG, but also TEST_IMG_FILE if that is present (e.g. with something like _set_test_img_suffix $suffix that would affect not only TEST_IMG but also TEST_IMG_FILE, if necessary). This is a pretty clean solution, and this is maybe what we should have done from the start. But it would also require changes to most existing bash tests. So the alternative is this: Let _make_test_img see whether $TEST_IMG_FILE still points to the original value. If so, it is possible that the caller has adjusted $TEST_IMG but not $TEST_IMG_FILE. In such a case, we can (for most protocols) derive the corresponding $TEST_IMG_FILE value from $TEST_IMG value and thus work around what technically is the caller misbehaving. This second solution is less clean, but it is robust against people keeping their old habit of adjusting TEST_IMG only, and requires much less changes. So this patch implements it. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/common.rc | 40 +++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 494490a272..23f46da2db 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -268,6 +268,7 @@ else TEST_IMG=3D$IMGPROTO:$TEST_DIR/t.$IMGFMT fi fi +ORIG_TEST_IMG_FILE=3D$TEST_IMG_FILE ORIG_TEST_IMG=3D"$TEST_IMG" =20 if [ -z "$TEST_DIR" ]; then @@ -330,6 +331,30 @@ _get_data_file() | sed -e "s#\\\$TEST_IMG#$1#" } =20 +# Translate a $TEST_IMG to its corresponding $TEST_IMG_FILE for +# different protocols +_test_img_to_test_img_file() +{ + case "$IMGPROTO" in + file) + echo "$1" + ;; + + nfs) + echo "$1" | sed -e "s#nfs://127.0.0.1##" + ;; + + ssh) + echo "$1" | \ + sed -e "s#ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\?= ##" + ;; + + *) + return 1 + ;; + esac +} + _make_test_img() { # extra qemu-img options can be added by tests @@ -343,10 +368,19 @@ _make_test_img() local opts_param=3Dfalse local misc_params=3D() =20 - if [ -n "$TEST_IMG_FILE" ]; then - img_name=3D$TEST_IMG_FILE - else + if [ -z "$TEST_IMG_FILE" ]; then img_name=3D$TEST_IMG + elif [ "$IMGOPTSSYNTAX" !=3D "true" -a \ + "$TEST_IMG_FILE" =3D "$ORIG_TEST_IMG_FILE" ]; then + # Handle cases of tests only updating TEST_IMG, but not TEST_IMG_F= ILE + img_name=3D$(_test_img_to_test_img_file "$TEST_IMG") + if [ "$?" !=3D 0 ]; then + img_name=3D$TEST_IMG_FILE + fi + else + # $TEST_IMG_FILE is not the default value, so it definitely has be= en + # modified by the test + img_name=3D$TEST_IMG_FILE fi =20 if [ -n "$IMGOPTS" ]; then --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772548; cv=none; d=zohomail.com; s=zohoarc; b=kYYzChzeOh3q0bUG9Ghz0Cf3NvQz4FtfRcW+UW97UJUfnVkzpjaPq0W7WfJPBLEe0SFrfvVNkV5KbOmnZhzdE8E/OWz5bjfYgtq4hQRhGotlrfpNi3L6GNxWP1fJhjVoB/vLU36O2JMUEOodgBBU8LH3IDpatWDaHb6SbS4ovE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772548; 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=6myIzIpPpfQk7f8cX7ESa28mxlQ3CXxT0+4no5Nq+1Y=; b=CU51dS6oM6dMCHySiYVvIFXMPPkvEvIAIkv+BrbwGoExoGlD59z6q7BWgvh9Eh6/W3UgkByo7mWf8q5mjb8fRt7ZtOoUNahumEHLOphLXahl1BKNbnFThtHnG2VoM0yogoyzc2AO5mvSrYkJHti0C3e2IN7bZ9FEqqIkZcCNG+A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772548515562.8908908915332; Tue, 22 Sep 2020 04:02:28 -0700 (PDT) Received: from localhost ([::1]:44270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg42-0006FD-6Y for importer@patchew.org; Tue, 22 Sep 2020 07:02:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsr-0001KY-KX for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:30537 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsp-0000mx-Eu for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:53 -0400 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-401-9jS_P2HlOJ2B_bif1fiytA-1; Tue, 22 Sep 2020 06:50:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10D441007464; Tue, 22 Sep 2020 10:50:48 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A81C23782; Tue, 22 Sep 2020 10:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771850; 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=6myIzIpPpfQk7f8cX7ESa28mxlQ3CXxT0+4no5Nq+1Y=; b=IkygV+qfXBvJqDCC1Wt/QLkwKXD6l5o9HoGE/CHNPP3o6UPDUyHq04OSFPL6/GU3ZofCxA /LeEsyotAjqXCjIi17xDHBkdpCRKit/mz4S3t9iF8712jpPbtwXzDdSl4JujG77AO+qlCh AiUiPSuRsDvC0MAVMBukBBJA6xFIyxE= X-MC-Unique: 9jS_P2HlOJ2B_bif1fiytA-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 15/20] iotests/287: Clean up subshell test image Date: Tue, 22 Sep 2020 12:49:27 +0200 Message-Id: <20200922104932.46384-16-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mreitz@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 01:57:21 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" 287 creates an image in a subshell (thanks to the pipe) to see whether that is possible with compression_type=3Dzstd. If _make_test_img were to modify any global state, this global state would then be lost before we could cleanup the image. When using FUSE as the test protocol, this global state is important, so clean up the image before the state is lost. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/287 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287 index f98a4cadc1..036cc09e82 100755 --- a/tests/qemu-iotests/287 +++ b/tests/qemu-iotests/287 @@ -51,8 +51,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 CLUSTER_SIZE=3D65536 =20 # Check if we can run this test. -if IMGOPTS=3D'compression_type=3Dzstd' _make_test_img 64M | - grep "Invalid parameter 'zstd'"; then +output=3D$(_make_test_img -o 'compression_type=3Dzstd' 64M; _cleanup_test_= img) +if echo "$output" | grep -q "Invalid parameter 'zstd'"; then _notrun "ZSTD is disabled" fi =20 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600773059; cv=none; d=zohomail.com; s=zohoarc; b=R7vRif+FRkJ9rKPl6oTVMLqSIBqBBYamCqHQvz4tMGrWywp8Iw0XSqTZdLq9zWYQG92ETj4zzF/zG5i3DtqXw7OYCDoBr8iyccRXvB7iXsOZ87JvbHg+w6a6LE2tlu+dwj+n4vS4OGd/vEegISevu6eOxHOu2TilbUOJhPgVz0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600773059; 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=Ea+fAxd76C35M69AMFmG807EWQmuEAGwHDLdotk1wII=; b=isUk7QJmesLdfaGiiN+8UNQgP5vCp2ImrWXy039x+MlD2bVxiNBhG99oOMFJp7HXAVAHFQEPI2kaFXsl+oe43BLFMlGuLmdz2RACrqc+HYB+mTdTRa1qPg+rycGVJgX8VIefwEIDewhB+PyPlln6CUipsn1+9EUmnQSmG8xOeD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600773059631851.633061145041; Tue, 22 Sep 2020 04:10:59 -0700 (PDT) Received: from localhost ([::1]:37494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKgCI-0007AJ-Cs for importer@patchew.org; Tue, 22 Sep 2020 07:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKfsx-0001Ng-Dk for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfst-0000nP-ML for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:50:59 -0400 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-303-qR_5u4mlMg2ZWNeAQdcvqw-1; Tue, 22 Sep 2020 06:50:51 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51EB91084C80; Tue, 22 Sep 2020 10:50:50 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF27D5DA7B; Tue, 22 Sep 2020 10:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771855; 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=Ea+fAxd76C35M69AMFmG807EWQmuEAGwHDLdotk1wII=; b=i4sKxCohazqmQlNoqB+lqm1+8+H4EcEPfT4abvEZj8Bjte+5YFsiMvPnD24XfuceWzJoFh wyCxq6XQvhXy/vxrI39CWAFDI09wVvCCrJVl8Dw6DQtzrfeTqxbIDTx22Dp0VVDnqdq1sI ZAtMRbeo6BsWyzpQD29hxQPDzMoyofg= X-MC-Unique: qR_5u4mlMg2ZWNeAQdcvqw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 16/20] storage-daemon: Call bdrv_close_all() on exit Date: Tue, 22 Sep 2020 12:49:28 +0200 Message-Id: <20200922104932.46384-17-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Otherwise, exports and block devices are not properly shut down and closed, unless the users explicitly issues blockdev-del and block-export-del commands for each of them. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- storage-daemon/qemu-storage-daemon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index e6157ff518..0b6d469751 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -324,6 +324,9 @@ int main(int argc, char *argv[]) main_loop_wait(false); } =20 + bdrv_drain_all_begin(); + bdrv_close_all(); + monitor_cleanup(); qemu_chr_cleanup(); user_creatable_cleanup(); --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600773192; cv=none; d=zohomail.com; s=zohoarc; b=PxptcYu4L5R2cuFoaWFy0Nedu2bBeSvXO8x56N1zkXWJ6y0O1Yi3/vLyYhrzxdS3m7oKx4nax+jGy0NiZRvy/ugVoWZ5ZjcNLbxQIknQGsG0Yw7XvsuI+TclLwGvnZbKAEvqMmtPSbOwcRvGlREXjvJGxhv2+AcN7cJga3oYdio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600773192; 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=Hnj3PSRtLOsHp9ec4/iMuR+OvApwM2qEmtwfQx+hol0=; b=kx1MzZVlsLXqYcS8cmAFxDZlNWRy7WW5ehsVl2H6trt0TvNpR6JhJGWhB6he4CvED00/j/WwyH5xZEVaQiYIvLqzM5W7Yrt2XnDUXUGMNLMcOxf5g1GAFrB4KSyeAoiqpDiWE0VpnkvTaMGiJFs6tQU6mxOgLAhS1v+CD5KWJCA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600773192850107.6455922154912; Tue, 22 Sep 2020 04:13:12 -0700 (PDT) Received: from localhost ([::1]:46314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKgER-0002OQ-K3 for importer@patchew.org; Tue, 22 Sep 2020 07:13:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKft1-0001XO-5V for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48270) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKfsz-0000oA-4P for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:02 -0400 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-567-oQ6tuRm6NHe59JC-tTsvTg-1; Tue, 22 Sep 2020 06:50:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57E2964082; Tue, 22 Sep 2020 10:50:55 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 238CF5C1DC; Tue, 22 Sep 2020 10:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771860; 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=Hnj3PSRtLOsHp9ec4/iMuR+OvApwM2qEmtwfQx+hol0=; b=D8+36IOGX+p4xGhvJrUyyM5k1+IbGqEzMI4kawBz3lZzbNOznWt2VhzrMNSXRgmDozN2tY wvyO8wJchPqPKlc+JfrY+9c7IyrizPk08ELQXUq+Wo9ccUv1X2k1uFl5UaQm6dCLzQV8AY +OLlqp3ENXFsgbrHdZSpie4TTmfCskc= X-MC-Unique: oQ6tuRm6NHe59JC-tTsvTg-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 17/20] iotests: Give access to the qemu-storage-daemon Date: Tue, 22 Sep 2020 12:49:29 +0200 Message-Id: <20200922104932.46384-18-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/check | 11 +++++++++++ tests/qemu-iotests/common.rc | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index e14a1f354d..467a7cf1b7 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -644,6 +644,17 @@ if [ -z $QEMU_NBD_PROG ]; then fi export QEMU_NBD_PROG=3D"$(type -p "$QEMU_NBD_PROG")" =20 +if [ -z "$QEMU_STGD_PROG" ]; then + if [ -x "$build_iotests/qemu-storage-daemon" ]; then + export QEMU_STGD_PROG=3D"$build_iotests/qemu-storage-daemon" + elif [ -x "$build_root/storage-daemon/qemu-storage-daemon" ]; then + export QEMU_STGD_PROG=3D"$build_root/storage-daemon/qemu-storage-d= aemon" + else + _init_error "qemu-storage-daemon not found" + fi +fi +export QEMU_STGD_PROG=3D"$(type -p "$QEMU_STGD_PROG")" + if [ -x "$build_iotests/socket_scm_helper" ] then export SOCKET_SCM_HELPER=3D"$build_iotests/socket_scm_helper" diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 23f46da2db..e4751d4985 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -124,6 +124,7 @@ fi : ${VALGRIND_QEMU_IMG=3D$VALGRIND_QEMU} : ${VALGRIND_QEMU_IO=3D$VALGRIND_QEMU} : ${VALGRIND_QEMU_NBD=3D$VALGRIND_QEMU} +: ${VALGRIND_QEMU_STGD=3D$VALGRIND_QEMU} =20 # The Valgrind own parameters may be set with # its environment variable VALGRIND_OPTS, e.g. @@ -211,6 +212,21 @@ _qemu_nbd_wrapper() return $RETVAL } =20 +_qemu_storage_daemon_wrapper() +{ + local VALGRIND_LOGFILE=3D"${TEST_DIR}"/$$.valgrind + ( + if [ -n "${QEMU_STGD_NEED_PID}" ]; then + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-storage-daemon.pid" + fi + VALGRIND_QEMU=3D"${VALGRIND_QEMU_STGD}" _qemu_proc_exec "${VALGRIN= D_LOGFILE}" \ + "$QEMU_STGD_PROG" $QEMU_STGD_OPTIONS "$@" + ) + RETVAL=3D$? + _qemu_proc_valgrind_log "${VALGRIND_LOGFILE}" $RETVAL + return $RETVAL +} + # Valgrind bug #409141 https://bugs.kde.org/show_bug.cgi?id=3D409141 # Until valgrind 3.16+ is ubiquitous, we must work around a hang in # valgrind when issuing sigkill. Disable valgrind for this invocation. @@ -223,6 +239,7 @@ export QEMU=3D_qemu_wrapper export QEMU_IMG=3D_qemu_img_wrapper export QEMU_IO=3D_qemu_io_wrapper export QEMU_NBD=3D_qemu_nbd_wrapper +export QEMU_STGD=3D_qemu_storage_daemon_wrapper =20 if [ "$IMGOPTSSYNTAX" =3D "true" ]; then DRIVER=3D"driver=3D$IMGFMT" --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772542; cv=none; d=zohomail.com; s=zohoarc; b=IglAyEv3ZvlO76pN1IrGDLciQNOhd9MY8ADY2UeEtGQOUSm5Jh95xRv//MEA2TZNSGea/9eyScb95oFJUUHisIvvxZA45S3Khi4DFhy1d7bgl3e4/XHqHu0J9uXc7VJZO62Jf1K+MC00kmvbzDjoigkSx0NehgbJAhDHjXlcdeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772542; 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=rGUZsjHgqLj5E8LG5C3k/EV9yuWT8nhX0OrJwrirL4w=; b=Tk/fzWmJAd+Zr1oBv98cccGSVkiwF5MFo+CWOLUHho2QIJMJE1/Exp3tnnTSbt0xYJh1pGBbdORv7z3cnKFlGrAxmv2yneVpvFjt7HUuGqZvyoAit1yrMrgaJ3eBYeuBqTTB4eOrDq4PNEL51U2fpPnSplrJVtOA2XTEDy8XEuA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772542353143.26703055827375; Tue, 22 Sep 2020 04:02:22 -0700 (PDT) Received: from localhost ([::1]:43846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg3w-00062L-LW for importer@patchew.org; Tue, 22 Sep 2020 07:02:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKft8-0001ps-L1 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKft5-0000on-Bi for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:10 -0400 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-23-Jyb7PmWANuqi1Mo6T3YHiQ-1; Tue, 22 Sep 2020 06:51:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 769401084C80; Tue, 22 Sep 2020 10:51:01 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6052319C4F; Tue, 22 Sep 2020 10:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771866; 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=rGUZsjHgqLj5E8LG5C3k/EV9yuWT8nhX0OrJwrirL4w=; b=i/cs4p0TdnIAtJgAq/EZJzCi6fXtRzL8L52zBotyhF+VliewQJtgU8mApnZwcHYpZ92Gxd 5OKEAL6FvXmsXi6o/tLwkhhVepS7WIO6ZHsNL3ac2iOz/TSEHqx3OMRFmOo//1Ica5R/0K D/UgKawRQlKo2+ZexinspU9xApAi99Y= X-MC-Unique: Jyb7PmWANuqi1Mo6T3YHiQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 18/20] iotests: Allow testing FUSE exports Date: Tue, 22 Sep 2020 12:49:30 +0200 Message-Id: <20200922104932.46384-19-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This pretends FUSE exports are a kind of protocol. As such, they are always tested under the format node. This is probably the best way to test them, actually, because this will generate more I/O load and more varied patterns. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/check | 6 ++ tests/qemu-iotests/common.filter | 5 +- tests/qemu-iotests/common.rc | 124 +++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 467a7cf1b7..07232138d7 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -270,6 +270,7 @@ image protocol options -rbd test rbd -sheepdog test sheepdog -nbd test nbd + -fuse test fuse -ssh test ssh -nfs test nfs =20 @@ -382,6 +383,11 @@ testlist options xpand=3Dfalse ;; =20 + -fuse) + IMGPROTO=3Dfuse + xpand=3Dfalse + ;; + -ssh) IMGPROTO=3Dssh xpand=3Dfalse diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index 838ed15793..172ea5752e 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -44,7 +44,8 @@ _filter_qom_path() _filter_testdir() { $SED -e "s#$TEST_DIR/#TEST_DIR/#g" \ - -e "s#$SOCK_DIR/#SOCK_DIR/#g" + -e "s#$SOCK_DIR/#SOCK_DIR/#g" \ + -e "s#SOCK_DIR/fuse-#TEST_DIR/#g" } =20 # replace occurrences of the actual IMGFMT value with IMGFMT @@ -127,6 +128,7 @@ _filter_img_create_filenames() -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ -e "s#$SOCK_DIR#SOCK_DIR#g" \ + -e 's#SOCK_DIR/fuse-#TEST_DIR/#g' \ -e "s#$IMGFMT#IMGFMT#g" \ -e 's#nbd:127.0.0.1:[0-9]\\+#TEST_DIR/t.IMGFMT#g' \ -e 's#nbd+unix:///\??socket=3DSOCK_DIR/nbd#TEST_DIR/t.IMGFMT#g' @@ -227,6 +229,7 @@ _filter_img_info() -e "s#$IMGFMT#IMGFMT#g" \ -e 's#nbd://127.0.0.1:[0-9]\\+$#TEST_DIR/t.IMGFMT#g' \ -e 's#nbd+unix:///\??socket=3DSOCK_DIR/nbd#TEST_DIR/t.IMGFMT#g' \ + -e 's#SOCK_DIR/fuse-#TEST_DIR/#g' \ -e "/encrypted: yes/d" \ -e "/cluster_size: [0-9]\\+/d" \ -e "/table_size: [0-9]\\+/d" \ diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index e4751d4985..e17f813f06 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -257,6 +257,9 @@ if [ "$IMGOPTSSYNTAX" =3D "true" ]; then TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT TEST_IMG=3D"$DRIVER,file.driver=3Dnbd,file.type=3Dunix" TEST_IMG=3D"$TEST_IMG,file.path=3D$SOCK_DIR/nbd" + elif [ "$IMGPROTO" =3D "fuse" ]; then + TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT + TEST_IMG=3D"$DRIVER,file.filename=3D$SOCK_DIR/fuse-t.$IMGFMT" elif [ "$IMGPROTO" =3D "ssh" ]; then TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT TEST_IMG=3D"$DRIVER,file.driver=3Dssh,file.host=3D127.0.0.1,file.p= ath=3D$TEST_IMG_FILE" @@ -273,6 +276,9 @@ else elif [ "$IMGPROTO" =3D "nbd" ]; then TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT TEST_IMG=3D"nbd+unix:///?socket=3D$SOCK_DIR/nbd" + elif [ "$IMGPROTO" =3D "fuse" ]; then + TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT + TEST_IMG=3D"$SOCK_DIR/fuse-t.$IMGFMT" elif [ "$IMGPROTO" =3D "ssh" ]; then TEST_IMG_FILE=3D$TEST_DIR/t.$IMGFMT REMOTE_TEST_DIR=3D"ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\= ?$TEST_DIR" @@ -288,6 +294,9 @@ fi ORIG_TEST_IMG_FILE=3D$TEST_IMG_FILE ORIG_TEST_IMG=3D"$TEST_IMG" =20 +FUSE_PIDS=3D() +FUSE_EXPORTS=3D() + if [ -z "$TEST_DIR" ]; then TEST_DIR=3D$PWD/scratch fi @@ -357,6 +366,10 @@ _test_img_to_test_img_file() echo "$1" ;; =20 + fuse) + echo "$1" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#" + ;; + nfs) echo "$1" | sed -e "s#nfs://127.0.0.1##" ;; @@ -385,6 +398,11 @@ _make_test_img() local opts_param=3Dfalse local misc_params=3D() =20 + if [[ $IMGPROTO =3D=3D fuse && $TEST_IMG =3D=3D $SOCK_DIR/fuse-* ]]; t= hen + # The caller may be trying to overwrite an existing image + _rm_test_img "$TEST_IMG" + fi + if [ -z "$TEST_IMG_FILE" ]; then img_name=3D$TEST_IMG elif [ "$IMGOPTSSYNTAX" !=3D "true" -a \ @@ -469,11 +487,105 @@ _make_test_img() eval "$QEMU_NBD -v -t -k '$SOCK_DIR/nbd' -f $IMGFMT -e 42 -x '' $T= EST_IMG_FILE >/dev/null &" sleep 1 # FIXME: qemu-nbd needs to be listening before we continue fi + + if [ $IMGPROTO =3D "fuse" -a -f "$img_name" ]; then + local export_mp + local pid + local pidfile + local timeout + + export_mp=3D$(echo "$img_name" | sed -e "s#$TEST_DIR/#$SOCK_DIR/fu= se-#") + if ! echo "$export_mp" | grep -q "^$SOCK_DIR"; then + echo 'Cannot use FUSE exports with images outside of TEST_DIR'= >&2 + return 1 + fi + + touch "$export_mp" + rm -f "$SOCK_DIR/fuse-output" + + # Usually, users would export formatted nodes. But we present fus= e as a + # protocol-level driver here, so we have to leave the format to the + # client. + QEMU_STGD_NEED_PID=3Dy $QEMU_STGD \ + --blockdev file,node-name=3Dexport-node,filename=3D$img_name= ,discard=3Dunmap \ + --export fuse,id=3Dfuse-export,node-name=3Dexport-node,mount= point=3D"$export_mp",writable=3Don,growable=3Don \ + & + + pidfile=3D"$QEMU_TEST_DIR/qemu-storage-daemon.pid" + + # Wait for the PID file + while [ ! -f "$pidfile" ]; do + sleep 0.5 + done + + pid=3D$(cat "$pidfile") + rm -f "$pidfile" + + FUSE_PIDS+=3D($pid) + FUSE_EXPORTS+=3D("$export_mp") + fi } =20 _rm_test_img() { local img=3D$1 + + if [[ $IMGPROTO =3D=3D fuse && $img =3D=3D $SOCK_DIR/fuse-* ]]; then + # Drop a FUSE export + local df_output + local i + local image_file + local index=3D'' + local timeout + + for i in "${!FUSE_EXPORTS[@]}"; do + if [ "${FUSE_EXPORTS[i]}" =3D "$img" ]; then + index=3D$i + break + fi + done + + if [ -z "$index" ]; then + # Probably gone already + return 0 + fi + + kill "${FUSE_PIDS[index]}" + + # Wait until the mount is gone + timeout=3D10 # *0.5 s + while true; do + # Will show the mount point; if the mount is still there, + # it will be $img. + df_output=3D$(df -T "$img" 2>/dev/null) + + # But df may also show an error ("Transpoint endpoint not + # connected"), so retry in such cases + if [ -n "$df_output" ]; then + if ! echo "$df_output" | grep -q "$img"; then + break + fi + fi + + sleep 0.5 + + timeout=3D$((timeout - 1)) + if [ "$timeout" =3D 0 ]; then + echo 'Failed to take down FUSE export' >&2 + return 1 + fi + done + + rm -f "$img" + + unset "FUSE_PIDS[$index]" + unset "FUSE_EXPORTS[$index]" + + image_file=3D$(echo "$img" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#= ") + _rm_test_img "$image_file" + return + fi + if [ "$IMGFMT" =3D "vmdk" ]; then # Remove all the extents for vmdk "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 = -d: \ @@ -496,6 +608,17 @@ _cleanup_test_img() rm -f "$TEST_IMG_FILE" ;; =20 + fuse) + local mp + + for mp in "${FUSE_EXPORTS[@]}"; do + _rm_test_img "$mp" + done + + FUSE_PIDS=3D() + FUSE_EXPORTS=3D() + ;; + file) _rm_test_img "$TEST_DIR/t.$IMGFMT" _rm_test_img "$TEST_DIR/t.$IMGFMT.orig" @@ -562,6 +685,7 @@ _img_info() sed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \ -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ + -e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \ -e "s#$IMGFMT#IMGFMT#g" \ -e "/^disk size:/ D" \ -e "/actual-size/ D" | \ --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600772748; cv=none; d=zohomail.com; s=zohoarc; b=L2yPleQk5M0JnDMe9LvtL8pI068pTmNgkHlSI62vkQrm/uZaMPaQa6TeEHKBpNsvH0SEZWaT61+sngVZfK1/giwillMmxjC8Df3W+BWiF6PcFhxVlRV2fnfWPC+ymWsrIlC89rPrHIAn4vdiwRKArOX8kpCgzwZIaoOI6f0gaVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600772748; 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=vT4MYAgtIArZ0D5OmwTyZcngHUN5T9zEu9FtMyIEaOM=; b=RV1nJtz/wiL+9AaV7HMgz53P/1rsWfZiS6uDLQbXHG5LrLJqQhLYnSclqbSpr+Mr8bTCwl+3wdzL07nAgGocEiatupi965dg7f5Qvt2LIxXy3oys3+A1b2yaeq1pWMFUpIUuV9M7dQje7u507osqIgxyVzImSE6DGktCTtzrac8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600772748101578.575287118745; Tue, 22 Sep 2020 04:05:48 -0700 (PDT) Received: from localhost ([::1]:52420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKg7G-0001WP-BJ for importer@patchew.org; Tue, 22 Sep 2020 07:05:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKftE-00025J-L2 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKftA-0000py-Eo for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:16 -0400 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-357-YetIuk_IN8m1E0HETSZ-aQ-1; Tue, 22 Sep 2020 06:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7448B8030AC; Tue, 22 Sep 2020 10:51:07 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7354D1002D41; Tue, 22 Sep 2020 10:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771871; 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=vT4MYAgtIArZ0D5OmwTyZcngHUN5T9zEu9FtMyIEaOM=; b=Pt/i637Dyl1tXhesirIV2ILoIsx3cqrNs8TcZrG3igxHyjRXtIFgo6q+wGNygMZjrnx/5n xhWRQMkEMIMg/8wJeRBLfrMJJHdCSd2Vj4qHjGQG62DGAy7v3sIqWyTuUKWFR1VaRgNf5M GCtRt4NGRMBvg0lKwuTFOYLlyKV4uu4= X-MC-Unique: YetIuk_IN8m1E0HETSZ-aQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 19/20] iotests: Enable fuse for many tests Date: Tue, 22 Sep 2020 12:49:31 +0200 Message-Id: <20200922104932.46384-20-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 00:31:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Many tests (that do not support generic protocols) can run just fine with FUSE-exported images, so allow them to. Note that this is no attempt at being definitely complete. There are some tests that might be modified to run on FUSE, but this patch still skips them. This patch only tries to pick the rather low-hanging fruits. Note that 221 and 250 only pass when .lseek is correctly implemented, which is only possible with a libfuse that is 3.8 or newer. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/025 | 2 +- tests/qemu-iotests/026 | 2 +- tests/qemu-iotests/028 | 2 +- tests/qemu-iotests/031 | 2 +- tests/qemu-iotests/034 | 2 +- tests/qemu-iotests/036 | 2 +- tests/qemu-iotests/037 | 2 +- tests/qemu-iotests/038 | 2 +- tests/qemu-iotests/039 | 2 +- tests/qemu-iotests/046 | 2 +- tests/qemu-iotests/050 | 2 +- tests/qemu-iotests/054 | 2 +- tests/qemu-iotests/060 | 2 +- tests/qemu-iotests/071 | 2 +- tests/qemu-iotests/079 | 2 +- tests/qemu-iotests/080 | 2 +- tests/qemu-iotests/089 | 2 +- tests/qemu-iotests/090 | 2 +- tests/qemu-iotests/091 | 2 +- tests/qemu-iotests/095 | 2 +- tests/qemu-iotests/097 | 2 +- tests/qemu-iotests/098 | 2 +- tests/qemu-iotests/102 | 2 +- tests/qemu-iotests/103 | 2 +- tests/qemu-iotests/106 | 2 +- tests/qemu-iotests/107 | 2 +- tests/qemu-iotests/108 | 2 +- tests/qemu-iotests/111 | 2 +- tests/qemu-iotests/112 | 2 +- tests/qemu-iotests/115 | 2 +- tests/qemu-iotests/117 | 2 +- tests/qemu-iotests/120 | 2 +- tests/qemu-iotests/121 | 2 +- tests/qemu-iotests/127 | 2 +- tests/qemu-iotests/133 | 2 +- tests/qemu-iotests/137 | 2 +- tests/qemu-iotests/138 | 2 +- tests/qemu-iotests/140 | 2 +- tests/qemu-iotests/154 | 2 +- tests/qemu-iotests/161 | 2 +- tests/qemu-iotests/171 | 2 +- tests/qemu-iotests/175 | 2 +- tests/qemu-iotests/176 | 2 +- tests/qemu-iotests/177 | 2 +- tests/qemu-iotests/179 | 2 +- tests/qemu-iotests/183 | 2 +- tests/qemu-iotests/186 | 2 +- tests/qemu-iotests/187 | 2 +- tests/qemu-iotests/191 | 2 +- tests/qemu-iotests/195 | 2 +- tests/qemu-iotests/200 | 2 +- tests/qemu-iotests/204 | 2 +- tests/qemu-iotests/214 | 2 +- tests/qemu-iotests/217 | 2 +- tests/qemu-iotests/220 | 2 +- tests/qemu-iotests/221 | 2 +- tests/qemu-iotests/229 | 2 +- tests/qemu-iotests/247 | 2 +- tests/qemu-iotests/249 | 2 +- tests/qemu-iotests/250 | 2 +- tests/qemu-iotests/252 | 2 +- tests/qemu-iotests/265 | 2 +- tests/qemu-iotests/268 | 2 +- tests/qemu-iotests/272 | 2 +- tests/qemu-iotests/273 | 2 +- tests/qemu-iotests/279 | 2 +- tests/qemu-iotests/286 | 2 +- tests/qemu-iotests/287 | 2 +- tests/qemu-iotests/289 | 2 +- tests/qemu-iotests/290 | 2 +- tests/qemu-iotests/291 | 2 +- tests/qemu-iotests/292 | 2 +- tests/qemu-iotests/293 | 2 +- tests/qemu-iotests/294 | 2 +- tests/qemu-iotests/305 | 2 +- 75 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 index e05d833452..1569d912f4 100755 --- a/tests/qemu-iotests/025 +++ b/tests/qemu-iotests/025 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.pattern =20 _supported_fmt raw qcow2 qed luks -_supported_proto file sheepdog rbd nfs +_supported_proto file sheepdog rbd nfs fuse =20 echo "=3D=3D=3D Creating image" echo diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 index b9713eb591..9ecc5880b1 100755 --- a/tests/qemu-iotests/026 +++ b/tests/qemu-iotests/026 @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Currently only qcow2 supports rebasing _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _default_cache_mode writethrough _supported_cache_modes writethrough none # The refcount table tests expect a certain minimum width for refcount ent= ries diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 864dc4a4e2..57d34aae99 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -46,7 +46,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # Any format supporting backing files except vmdk and qcow which do not su= pport # smaller backing files. _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 # Choose a size that is not necessarily a cluster size multiple for image diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 index 646ecd593f..2bcbc5886e 100755 --- a/tests/qemu-iotests/031 +++ b/tests/qemu-iotests/031 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # We want to test compat=3D0.10, which does not support external data # files or refcount widths other than 16 _unsupported_imgopts data_file 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034 index ac2d687c71..08f7aea6d5 100755 --- a/tests/qemu-iotests/034 +++ b/tests/qemu-iotests/034 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow qcow2 vmdk qed -_supported_proto file +_supported_proto file fuse _supported_os Linux _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036 index cf522de7a1..6b82638080 100755 --- a/tests/qemu-iotests/036 +++ b/tests/qemu-iotests/036 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # Only qcow2v3 and later supports feature bits; # qcow2.py does not support external data files; # this test requires a cluster size large enough for the feature table diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037 index e1187ac24a..bb893c43dc 100755 --- a/tests/qemu-iotests/037 +++ b/tests/qemu-iotests/037 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow qcow2 vmdk qed -_supported_proto file +_supported_proto file fuse _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ "subformat=3DtwoGbMaxExtentSparse" \ diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038 index a253231f5b..30f1f73c25 100755 --- a/tests/qemu-iotests/038 +++ b/tests/qemu-iotests/038 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 CLUSTER_SIZE=3D2M diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 index 42f6503138..ad3867c3fc 100755 --- a/tests/qemu-iotests/039 +++ b/tests/qemu-iotests/039 @@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _default_cache_mode writethrough _supported_cache_modes writethrough diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 index 40a9f30087..ed6fae3529 100755 --- a/tests/qemu-iotests/046 +++ b/tests/qemu-iotests/046 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # data_file does not support compressed clusters _unsupported_imgopts data_file =20 diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050 index 4b0a390c43..741bdb610e 100755 --- a/tests/qemu-iotests/050 +++ b/tests/qemu-iotests/050 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse =20 echo echo "=3D=3D Creating images =3D=3D" diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054 index a8905b60d0..40922db2b1 100755 --- a/tests/qemu-iotests/054 +++ b/tests/qemu-iotests/054 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 echo echo "creating too large image (1 EB)" diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 94c0d5accc..4b81d1aa51 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -46,7 +46,7 @@ _filter_io_error() =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # These tests only work for compat=3D1.1 images without an external # data file with refcount_bits=3D16 diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 18fe9054b0..49faae6684 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _require_drivers blkdebug blkverify # blkdebug can only inject errors on bs->file, not on the data_file, # so thie test does not work with external data files diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079 index 3642b51feb..0f0d94a2ac 100755 --- a/tests/qemu-iotests/079 +++ b/tests/qemu-iotests/079 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file nfs +_supported_proto file nfs fuse =20 # Some containers (e.g. non-x86 on Travis) do not allow large files _require_large_file 4G diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080 index 7588c63b6c..bda8617c38 100755 --- a/tests/qemu-iotests/080 +++ b/tests/qemu-iotests/080 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # - Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089 index 03a2ccf1e8..f0929b64c0 100755 --- a/tests/qemu-iotests/089 +++ b/tests/qemu-iotests/089 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # Because anything other than 16 would change the output of qemu_io -c info _unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' =20 diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090 index 1246e4f910..87e872ebf4 100755 --- a/tests/qemu-iotests/090 +++ b/tests/qemu-iotests/090 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file nfs +_supported_proto file nfs fuse # External data files do not support compressed clusters _unsupported_imgopts data_file =20 diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 8a4ce5b7e2..8dee168bf6 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -44,7 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _supported_cache_modes writethrough none writeback _default_cache_mode none writeback diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095 index 77a5f0f3f5..7604ae6966 100755 --- a/tests/qemu-iotests/095 +++ b/tests/qemu-iotests/095 @@ -44,7 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 size_smaller=3D5M size_larger=3D100M diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097 index d910a8b107..1837d4e8e0 100755 --- a/tests/qemu-iotests/097 +++ b/tests/qemu-iotests/097 @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Any format supporting backing files and bdrv_make_empty _supported_fmt qcow qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 =20 diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098 index f2ccdd7909..a35ce7205e 100755 --- a/tests/qemu-iotests/098 +++ b/tests/qemu-iotests/098 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.pattern =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # The code path we want to test here only works for compat=3D1.1 images; # blkdebug can only inject errors on bs->file, so external data files # do not work with this test diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index b898df436f..2cc3efd1ed 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 IMG_SIZE=3D64K =20 diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103 index 8c1ebe0443..220481db4c 100755 --- a/tests/qemu-iotests/103 +++ b/tests/qemu-iotests/103 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file nfs +_supported_proto file nfs fuse # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106 index a20659d443..20ad7bd5a2 100755 --- a/tests/qemu-iotests/106 +++ b/tests/qemu-iotests/106 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt raw -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 # in kB diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107 index 268ba27688..d24829ccf9 100755 --- a/tests/qemu-iotests/107 +++ b/tests/qemu-iotests/107 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file nfs +_supported_proto file nfs fuse =20 =20 IMG_SIZE=3D64K diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108 index 5f7076fba4..ba67748bdf 100755 --- a/tests/qemu-iotests/108 +++ b/tests/qemu-iotests/108 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # This test directly modifies a refblock so it relies on refcount_bits bei= ng 16; # and the low-level modification it performs are not tuned for external da= ta diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111 index 3b43d1bd83..bd839a39f4 100755 --- a/tests/qemu-iotests/111 +++ b/tests/qemu-iotests/111 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qed qcow qcow2 vmdk -_supported_proto file +_supported_proto file fuse _unsupported_imgopts "subformat=3DmonolithicFlat" "subformat=3DtwoGbMaxExt= entFlat" =20 _make_test_img -b "$TEST_IMG.inexistent" diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112 index 20ff5c224a..6e413f5651 100755 --- a/tests/qemu-iotests/112 +++ b/tests/qemu-iotests/112 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # This test will set refcount_bits on its own which would conflict with the # manual setting; compat will be overridden as well; # and external data files do not work well with our refcount testing diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115 index d254b18342..7f53987d1b 100755 --- a/tests/qemu-iotests/115 +++ b/tests/qemu-iotests/115 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # This test relies on refcounts being 64 bits wide (which does not work wi= th # compat=3D0.10) _unsupported_imgopts 'refcount_bits=3D\([^6]\|.\([^4]\|$\)\)' 'compat=3D0.= 10' diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index f37b34f8b1..9039555ac4 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 _make_test_img 64k =20 diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index 2931a7550f..45c55c1c01 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt generic -_supported_proto file +_supported_proto file fuse _unsupported_fmt luks _require_drivers raw =20 diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121 index 90ea0db737..8357ce089a 100755 --- a/tests/qemu-iotests/121 +++ b/tests/qemu-iotests/121 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # Refcount structures are used much differently with external data # files diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 index e2ac2f5536..77fdfd0205 100755 --- a/tests/qemu-iotests/127 +++ b/tests/qemu-iotests/127 @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 _require_devices virtio-scsi scsi-hd =20 diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133 index 4070fd9457..bc82d8ebd7 100755 --- a/tests/qemu-iotests/133 +++ b/tests/qemu-iotests/133 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 TEST_IMG=3D"$TEST_IMG.base" _make_test_img 64M _make_test_img -b "$TEST_IMG.base" -F $IMGFMT diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 index 7ae86892f7..de555a91c9 100755 --- a/tests/qemu-iotests/137 +++ b/tests/qemu-iotests/137 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=3D0.10' diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138 index 1d5b0bed6d..e87a64eb89 100755 --- a/tests/qemu-iotests/138 +++ b/tests/qemu-iotests/138 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # With an external data file, data clusters are not refcounted # (so qemu-img check would not do much); diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 index 443751455e..97b6e55810 100755 --- a/tests/qemu-iotests/140 +++ b/tests/qemu-iotests/140 @@ -44,7 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt generic -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 _make_test_img 64k diff --git a/tests/qemu-iotests/154 b/tests/qemu-iotests/154 index 7f1c0d9bd9..34a1c051b6 100755 --- a/tests/qemu-iotests/154 +++ b/tests/qemu-iotests/154 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 CLUSTER_SIZE=3D4k diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161 index bbf7dbbc5c..4fb7d0cbf0 100755 --- a/tests/qemu-iotests/161 +++ b/tests/qemu-iotests/161 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Any format implementing BlockDriver.bdrv_change_backing_file _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 IMG_SIZE=3D1M diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171 index 341064a1c6..f3582edb10 100755 --- a/tests/qemu-iotests/171 +++ b/tests/qemu-iotests/171 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt raw -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 =20 diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 index c3c2aed653..21a77a2bf5 100755 --- a/tests/qemu-iotests/175 +++ b/tests/qemu-iotests/175 @@ -71,7 +71,7 @@ EOF . ./common.filter =20 _supported_fmt raw -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 _default_cache_mode none diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176 index 2565ff12ee..5ce3b27069 100755 --- a/tests/qemu-iotests/176 +++ b/tests/qemu-iotests/176 @@ -45,7 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This test is specific to qcow2 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # Persistent dirty bitmaps require compat=3D1.1; # Internal snapshots forbid using an external data file diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177 index 5d4a77a6ab..595bfd4236 100755 --- a/tests/qemu-iotests/177 +++ b/tests/qemu-iotests/177 @@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # tests specific to compat=3D1.1. =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 CLUSTER_SIZE=3D1M size=3D128M diff --git a/tests/qemu-iotests/179 b/tests/qemu-iotests/179 index 11a20cb1bf..7ada04c641 100755 --- a/tests/qemu-iotests/179 +++ b/tests/qemu-iotests/179 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 # v2 images can't mark clusters as zero diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183 index acdbefa310..d889a3b19c 100755 --- a/tests/qemu-iotests/183 +++ b/tests/qemu-iotests/183 @@ -44,7 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_os Linux FreeBSD NetBSD _supported_fmt qcow2 raw qed quorum -_supported_proto file +_supported_proto file fuse =20 size=3D64M _make_test_img $size diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index 3ea0442d44..0db25b0e68 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _require_drivers null-co =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187 index c6e1dc57a0..f262d83e3a 100755 --- a/tests/qemu-iotests/187 +++ b/tests/qemu-iotests/187 @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 size=3D64M _make_test_img $size diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191 index d17462e1e4..95a891350d 100755 --- a/tests/qemu-iotests/191 +++ b/tests/qemu-iotests/191 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # An external data file would change the query-named-block-nodes output _unsupported_imgopts data_file =20 diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195 index 2351d55fe1..967af5b7b5 100755 --- a/tests/qemu-iotests/195 +++ b/tests/qemu-iotests/195 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 do_run_qemu() { diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200 index a7aabbd032..046539154f 100755 --- a/tests/qemu-iotests/200 +++ b/tests/qemu-iotests/200 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse =20 BACKING_IMG=3D"$TEST_IMG.base" =20 diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204 index 6770fa9b96..536bb8b534 100755 --- a/tests/qemu-iotests/204 +++ b/tests/qemu-iotests/204 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # This test assumes that discard leaves zero clusters; see test 177 for # other tests that also work in older images _unsupported_imgopts 'compat=3D0.10' diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214 index af677d90b8..75ae7a14b5 100755 --- a/tests/qemu-iotests/214 +++ b/tests/qemu-iotests/214 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 # Repairing the corrupted image requires qemu-img check to store a # refcount up to 3, which requires at least two refcount bits. diff --git a/tests/qemu-iotests/217 b/tests/qemu-iotests/217 index d89116ccad..7385342498 100755 --- a/tests/qemu-iotests/217 +++ b/tests/qemu-iotests/217 @@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This test is specific to qcow2 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 # This test needs clusters with at least a refcount of 2 so that # OFLAG_COPIED is not set. refcount_bits=3D1 is therefore unsupported. diff --git a/tests/qemu-iotests/220 b/tests/qemu-iotests/220 index a9259b7127..9ba3b3fdcb 100755 --- a/tests/qemu-iotests/220 +++ b/tests/qemu-iotests/220 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.pattern =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # To use a different refcount width but 16 bits we need compat=3D1.1, # and external data files do not support compressed clusters. diff --git a/tests/qemu-iotests/221 b/tests/qemu-iotests/221 index 0e9096fec7..ca62b3baa1 100755 --- a/tests/qemu-iotests/221 +++ b/tests/qemu-iotests/221 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt raw -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 _default_cache_mode writeback diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229 index 5f759fa587..273ac2472d 100755 --- a/tests/qemu-iotests/229 +++ b/tests/qemu-iotests/229 @@ -44,7 +44,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Needs backing file and backing format support _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse _supported_os Linux # blkdebug can only inject errors on bs->file, so external data files # do not work with this test diff --git a/tests/qemu-iotests/247 b/tests/qemu-iotests/247 index 87e37b39e2..6cf2679750 100755 --- a/tests/qemu-iotests/247 +++ b/tests/qemu-iotests/247 @@ -41,7 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Requires backing files and .bdrv_change_backing_file support _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse =20 size=3D128M =20 diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index a9aa9303eb..29453b8c90 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Any format implementing BlockDriver.bdrv_change_backing_file _supported_fmt qcow2 qed -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 IMG_SIZE=3D1M diff --git a/tests/qemu-iotests/250 b/tests/qemu-iotests/250 index 9bb6b94d74..3df275c76b 100755 --- a/tests/qemu-iotests/250 +++ b/tests/qemu-iotests/250 @@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # This test does not make much sense with external data files _unsupported_imgopts data_file diff --git a/tests/qemu-iotests/252 b/tests/qemu-iotests/252 index 6662f4c9de..1d74afff99 100755 --- a/tests/qemu-iotests/252 +++ b/tests/qemu-iotests/252 @@ -42,7 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # zero cluster support _supported_fmt qcow2 _unsupported_imgopts 'compat=3D0.10' -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 CLUSTER_SIZE=3D65536 diff --git a/tests/qemu-iotests/265 b/tests/qemu-iotests/265 index 00f2ec769e..0e800fb524 100755 --- a/tests/qemu-iotests/265 +++ b/tests/qemu-iotests/265 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # qcow2-specific test _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux =20 echo '--- Writing to the image ---' diff --git a/tests/qemu-iotests/268 b/tests/qemu-iotests/268 index 78c3f4db3a..ddf4312284 100755 --- a/tests/qemu-iotests/268 +++ b/tests/qemu-iotests/268 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 echo echo "=3D=3D Required alignment larger than cluster size =3D=3D" diff --git a/tests/qemu-iotests/272 b/tests/qemu-iotests/272 index c2f782d47b..de475bf6f0 100755 --- a/tests/qemu-iotests/272 +++ b/tests/qemu-iotests/272 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This is a qcow2 regression test _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse =20 # External data files do not support compression; # We need an exact cluster size (2M) and refcount width (2) so we can diff --git a/tests/qemu-iotests/273 b/tests/qemu-iotests/273 index 41ffbf39c4..79b4ab4b05 100755 --- a/tests/qemu-iotests/273 +++ b/tests/qemu-iotests/273 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # This is a qcow2 regression test _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # External data files would add nodes to the block graph, so it would # not match the reference output diff --git a/tests/qemu-iotests/279 b/tests/qemu-iotests/279 index 5515d4ed01..2a6315cf17 100755 --- a/tests/qemu-iotests/279 +++ b/tests/qemu-iotests/279 @@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 # Backing files are required... _supported_fmt qcow qcow2 vmdk qed -_supported_proto file +_supported_proto file fuse _supported_os Linux _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286 index f14445ba4a..f64e0eccea 100755 --- a/tests/qemu-iotests/286 +++ b/tests/qemu-iotests/286 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.qemu =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file diff --git a/tests/qemu-iotests/287 b/tests/qemu-iotests/287 index 036cc09e82..3bb383fd4b 100755 --- a/tests/qemu-iotests/287 +++ b/tests/qemu-iotests/287 @@ -32,7 +32,7 @@ status=3D1 # failure is the default! =20 # This tests qocw2-specific low-level functionality _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _unsupported_imgopts 'compat=3D0.10' data_file =20 diff --git a/tests/qemu-iotests/289 b/tests/qemu-iotests/289 index 1c11d4030e..fe69bde1eb 100755 --- a/tests/qemu-iotests/289 +++ b/tests/qemu-iotests/289 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.pattern =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse # This is a v3-exclusive test; # As for data_file, error paths often very much depend on whether # there is an external data file or not; so we create one exactly when diff --git a/tests/qemu-iotests/290 b/tests/qemu-iotests/290 index 01ee14dcfb..35c38d4f80 100755 --- a/tests/qemu-iotests/290 +++ b/tests/qemu-iotests/290 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _unsupported_imgopts 'compat=3D0.10' refcount_bits data_file =20 diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291 index 1e0bb76959..34ad5f0c30 100755 --- a/tests/qemu-iotests/291 +++ b/tests/qemu-iotests/291 @@ -36,7 +36,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.nbd =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _require_command QEMU_NBD # compat=3D0.10 does not support bitmaps diff --git a/tests/qemu-iotests/292 b/tests/qemu-iotests/292 index 83ab19231d..3ae2772e3b 100755 --- a/tests/qemu-iotests/292 +++ b/tests/qemu-iotests/292 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux # We need qemu-img map to show the file where the data is allocated, # but with an external data file, it will show that instead of the diff --git a/tests/qemu-iotests/293 b/tests/qemu-iotests/293 index f86fe3b413..3363bf07f0 100755 --- a/tests/qemu-iotests/293 +++ b/tests/qemu-iotests/293 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 luks -_supported_proto file #TODO +_supported_proto file fuse #TODO _require_working_luks =20 QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT diff --git a/tests/qemu-iotests/294 b/tests/qemu-iotests/294 index 9c95ed8c9a..87da35db49 100755 --- a/tests/qemu-iotests/294 +++ b/tests/qemu-iotests/294 @@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt luks -_supported_proto file #TODO +_supported_proto file fuse #TODO =20 QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT =20 diff --git a/tests/qemu-iotests/305 b/tests/qemu-iotests/305 index 768818af4a..5a415eb2a4 100755 --- a/tests/qemu-iotests/305 +++ b/tests/qemu-iotests/305 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter =20 _supported_fmt qcow2 -_supported_proto file +_supported_proto file fuse _supported_os Linux _unsupported_imgopts cluster_size refcount_bits extended_l2 compat=3D0.10 = data_file =20 --=20 2.26.2 From nobody Sat May 4 19:07:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1600773371; cv=none; d=zohomail.com; s=zohoarc; b=RbhHaea72F5XKnbFXmdWwHzxKOGG5lzw/oI63awdHAftj6KqoyKTj78Wp9Hg3IktiauZfKup9SkXXwZWzOJiflMVm4kmWi5XzA63RU4sRDGM++oaeIgAZ97Xkf45uyrb3NroxGMwsd8326SWQCYRlAnzVuQkNxqoYXgapDNdWdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600773371; 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=XiW25rbxrpYxIaNxavx4/J5rBcY9ydVp59HrJEtOmRE=; b=TEYBP2rWzPo+vD8Ilb7aZ4TKeLbvzMOwTySht2cTY480xbfh1xDzMt96v5NsppSUSuiBTAH+BdrZmgXmuxbv/T1Mfc0QoPRPgKdjzHRxlghdgGKfNw8SsLC+YhwK0zm6rdXMNaRyon1Md6X9A/Tv3REY0qAt+Aej3Ti18EPYEMs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1600773371160856.7251511797241; Tue, 22 Sep 2020 04:16:11 -0700 (PDT) Received: from localhost ([::1]:54084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKgHJ-0005a9-Lm for importer@patchew.org; Tue, 22 Sep 2020 07:16:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKftJ-0002Hb-DA for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:21 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:31174 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKftE-0000qW-S4 for qemu-devel@nongnu.org; Tue, 22 Sep 2020 06:51:21 -0400 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-197-xtW2d66uP4evWNRQSaaaRQ-1; Tue, 22 Sep 2020 06:51:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D9FCD1084C86; Tue, 22 Sep 2020 10:51:12 +0000 (UTC) Received: from localhost (ovpn-114-26.ams2.redhat.com [10.36.114.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 574883782; Tue, 22 Sep 2020 10:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600771876; 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=XiW25rbxrpYxIaNxavx4/J5rBcY9ydVp59HrJEtOmRE=; b=RFuPJ18HHlATF/xQT8DIw66aSHHeauiO+yrwSJA/dZiunEOqhr6bxjHW1obW2xmr6YVbnF 0KTmkZjAo0wju6F6gwyJ5G9MtTLdeelj7+sYFQLWdSMSUlF8ozob63D84OyPWpRWJSkuxB qfIFfXdm8ArY1xuHlWglhyWqmcDvvIg= X-MC-Unique: xtW2d66uP4evWNRQSaaaRQ-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v2 20/20] iotests/308: Add test for FUSE exports Date: Tue, 22 Sep 2020 12:49:32 +0200 Message-Id: <20200922104932.46384-21-mreitz@redhat.com> In-Reply-To: <20200922104932.46384-1-mreitz@redhat.com> References: <20200922104932.46384-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 04:19:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz 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" We have good coverage of the normal I/O paths now, but what remains is a test that tests some more special cases: Exporting an image on itself (thus turning a formatted image into a raw one), some error cases, and non-writable and non-growable exports. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- tests/qemu-iotests/308 | 339 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/308.out | 97 +++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 437 insertions(+) create mode 100755 tests/qemu-iotests/308 create mode 100644 tests/qemu-iotests/308.out diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308 new file mode 100755 index 0000000000..b30f4400f6 --- /dev/null +++ b/tests/qemu-iotests/308 @@ -0,0 +1,339 @@ +#!/usr/bin/env bash +# +# Test FUSE exports (in ways that are not captured by the generic +# tests) +# +# Copyright (C) 2020 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 . +# + +seq=3D$(basename "$0") +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_qemu + _cleanup_test_img + rmdir "$EXT_MP" 2>/dev/null + rm -f "$EXT_MP" + rm -f "$COPIED_IMG" +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +# Generic format, but needs a plain filename +_supported_fmt generic +if [ "$IMGOPTSSYNTAX" =3D "true" ]; then + _unsupported_fmt $IMGFMT +fi +# We need the image to have exactly the specified size, and VPC does +# not allow that by default +_unsupported_fmt vpc + +_supported_proto file # We create the FUSE export manually +_supported_os Linux # We need /dev/urandom + +# $1: Export ID +# $2: Options (beyond the node-name and ID) +# $3: Expected return value (defaults to 'return') +# $4: Node to export (defaults to 'node-format') +fuse_export_add() +{ + _send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': '$1', + 'node-name': '${4:-node-format}', + $2 + } }" \ + "${3:-return}" \ + | _filter_imgfmt +} + +# $1: Export ID +fuse_export_del() +{ + _send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'block-export-del', + 'arguments': { + 'id': '$1' + } }" \ + 'return' + + _send_qemu_cmd $QEMU_HANDLE \ + '' \ + 'BLOCK_EXPORT_DELETED' +} + +# Return the length of the protocol file +# $1: Protocol node export mount point +# $2: Original file (to compare) +get_proto_len() +{ + len1=3D$(stat -c '%s' "$1") + len2=3D$(stat -c '%s' "$2") + + if [ "$len1" !=3D "$len2" ]; then + echo 'ERROR: Length of export and original differ:' >&2 + echo "$len1 !=3D $len2" >&2 + else + echo '(OK: Lengths of export and original are the same)' >&2 + fi + + echo "$len1" +} + +COPIED_IMG=3D"$TEST_IMG.copy" +EXT_MP=3D"$TEST_IMG.fuse" + +echo '=3D=3D=3D Set up =3D=3D=3D' + +# Create image with random data +_make_test_img 64M +$QEMU_IO -c 'write -s /dev/urandom 0 64M' "$TEST_IMG" | _filter_qemu_io + +_launch_qemu +_send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'qmp_capabilities'}" \ + 'return' + +# Separate blockdev-add calls for format and protocol so we can remove +# the format layer later on +_send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'blockdev-add', + 'arguments': { + 'driver': 'file', + 'node-name': 'node-protocol', + 'filename': '$TEST_IMG' + } }" \ + 'return' + +_send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'blockdev-add', + 'arguments': { + 'driver': '$IMGFMT', + 'node-name': 'node-format', + 'file': 'node-protocol' + } }" \ + 'return' + +echo +echo '=3D=3D=3D Mountpoint not present =3D=3D=3D' + +rmdir "$EXT_MP" 2>/dev/null +rm -f "$EXT_MP" +output=3D$(fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error) + +if echo "$output" | grep -q "Invalid parameter 'fuse'"; then + _notrun 'No FUSE support' +fi + +echo "$output" + +echo +echo '=3D=3D=3D Mountpoint is a directory =3D=3D=3D' + +mkdir "$EXT_MP" +fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error +rmdir "$EXT_MP" + +echo +echo '=3D=3D=3D Mountpoint is a regular file =3D=3D=3D' + +touch "$EXT_MP" +fuse_export_add 'export-mp' "'mountpoint': '$EXT_MP'" + +# Check that the export presents the same data as the original image +$QEMU_IMG compare -f raw -F $IMGFMT -U "$EXT_MP" "$TEST_IMG" + +echo +echo '=3D=3D=3D Mount over existing file =3D=3D=3D' + +# This is the coolest feature of FUSE exports: You can transparently +# make images in any format appear as raw images +fuse_export_add 'export-img' "'mountpoint': '$TEST_IMG'" + +# Accesses both exports at the same time, so we get a concurrency test +$QEMU_IMG compare -f raw -F raw -U "$EXT_MP" "$TEST_IMG" + +# Just to be sure, we later want to compare the data offline. Also, +# this allows us to see that cp works without complaining. +# (This is not a given, because cp will expect a short read at EOF. +# Internally, qemu does not allow short reads, so we have to check +# whether the FUSE export driver lets them work.) +cp "$TEST_IMG" "$COPIED_IMG" + +# $TEST_IMG will be in mode 0400 because it is read-only; we are going +# to write to the copy, so make it writable +chmod 0600 "$COPIED_IMG" + +echo +echo '=3D=3D=3D Double export =3D=3D=3D' + +# We have already seen that exporting a node twice works fine, but you +# cannot export anything twice on the same mount point. The reason is +# that qemu has to stat the given mount point, and this would have to +# be answered by the same qemu instance if it already has an export +# there. However, it cannot answer the stat because it is itself +# caught up in that same stat. +fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error + +echo +echo '=3D=3D=3D Remove export =3D=3D=3D' + +# Double-check that $EXT_MP appears as a non-empty file (the raw image) +$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' + +fuse_export_del 'export-mp' + +# See that the file appears empty again +$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' + +echo +echo '=3D=3D=3D Writable export =3D=3D=3D' + +fuse_export_add 'export-mp' "'mountpoint': '$EXT_MP', 'writable': true" + +# Check that writing to the read-only export fails +$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$TEST_IMG" | _filter_qemu_io + +# But here it should work +$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$EXT_MP" | _filter_qemu_io + +# (Adjust the copy, too) +$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$COPIED_IMG" | _filter_qemu_io + +echo +echo '=3D=3D=3D Resizing exports =3D=3D=3D' + +# Here, we need to export the protocol node -- the format layer may +# not be growable, simply because the format does not support it. + +# Remove all exports and the format node first so permissions will not +# get in the way +fuse_export_del 'export-mp' +fuse_export_del 'export-img' + +_send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'blockdev-del', + 'arguments': { + 'node-name': 'node-format' + } }" \ + 'return' + +# Now export the protocol node +fuse_export_add \ + 'export-mp' \ + "'mountpoint': '$EXT_MP', 'writable': true" \ + 'return' \ + 'node-protocol' + +echo +echo '--- Try growing non-growable export ---' + +# Get the current size so we can write beyond the EOF +orig_len=3D$(get_proto_len "$EXT_MP" "$TEST_IMG") +orig_disk_usage=3D$(stat -c '%b' "$TEST_IMG") + +# Should fail (exports are non-growable by default) +# (Note that qemu-io can never write beyond the EOF, so we have to use +# dd here) +dd if=3D/dev/zero of=3D"$EXT_MP" bs=3D1 count=3D64k seek=3D$orig_len 2>&1 \ + | _filter_testdir | _filter_imgfmt + +echo +echo '--- Resize export ---' + +# But we can truncate it explicitly; even with fallocate +fallocate -o "$orig_len" -l 64k "$EXT_MP" + +new_len=3D$(get_proto_len "$EXT_MP" "$TEST_IMG") +if [ "$new_len" !=3D "$((orig_len + 65536))" ]; then + echo 'ERROR: Unexpected post-truncate image size:' + echo "$new_len !=3D $((orig_len + 65536))" +else + echo 'OK: Post-truncate image size is as expected' +fi + +new_disk_usage=3D$(stat -c '%b' "$TEST_IMG") +if [ "$new_disk_usage" -gt "$orig_disk_usage" ]; then + echo 'OK: Disk usage grew with fallocate' +else + echo 'ERROR: Disk usage did not grow despite fallocate:' + echo "$orig_disk_usage =3D> $new_disk_usage" +fi + +echo +echo '--- Try growing growable export ---' + +# Now export as growable +fuse_export_del 'export-mp' +fuse_export_add \ + 'export-mp' \ + "'mountpoint': '$EXT_MP', 'writable': true, 'growable': true" \ + 'return' \ + 'node-protocol' + +# Now we should be able to write beyond the EOF +dd if=3D/dev/zero of=3D"$EXT_MP" bs=3D1 count=3D64k seek=3D$new_len 2>&1 \ + | _filter_testdir | _filter_imgfmt + +new_len=3D$(get_proto_len "$EXT_MP" "$TEST_IMG") +if [ "$new_len" !=3D "$((orig_len + 131072))" ]; then + echo 'ERROR: Unexpected post-grow image size:' + echo "$new_len !=3D $((orig_len + 131072))" +else + echo 'OK: Post-grow image size is as expected' +fi + +echo +echo '--- Shrink export ---' + +# Now go back to the original size +truncate -s "$orig_len" "$EXT_MP" + +new_len=3D$(get_proto_len "$EXT_MP" "$TEST_IMG") +if [ "$new_len" !=3D "$orig_len" ]; then + echo 'ERROR: Unexpected post-truncate image size:' + echo "$new_len !=3D $orig_len" +else + echo 'OK: Post-truncate image size is as expected' +fi + +echo +echo '=3D=3D=3D Tear down =3D=3D=3D' + +_send_qemu_cmd $QEMU_HANDLE \ + "{'execute': 'quit'}" \ + 'return' + +wait=3Dyes _cleanup_qemu + +echo +echo '=3D=3D=3D Compare copy with original =3D=3D=3D' + +$QEMU_IMG compare -f raw -F $IMGFMT "$COPIED_IMG" "$TEST_IMG" + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/308.out b/tests/qemu-iotests/308.out new file mode 100644 index 0000000000..b93aceed2e --- /dev/null +++ b/tests/qemu-iotests/308.out @@ -0,0 +1,97 @@ +QA output created by 308 +=3D=3D=3D Set up =3D=3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 +wrote 67108864/67108864 bytes at offset 0 +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{'execute': 'qmp_capabilities'} +{"return": {}} +{'execute': 'blockdev-add', 'arguments': { 'driver': 'file', 'node-name': = 'node-protocol', 'filename': 'TEST_DIR/t.IMGFMT' } } +{"return": {}} +{'execute': 'blockdev-add', 'arguments': { 'driver': 'IMGFMT', 'node-name'= : 'node-format', 'file': 'node-protocol' } } +{"return": {}} + +=3D=3D=3D Mountpoint not present =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse'= } } +{"error": {"class": "GenericError", "desc": "Failed to stat 'TEST_DIR/t.IM= GFMT.fuse': No such file or directory"}} + +=3D=3D=3D Mountpoint is a directory =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse'= } } +{"error": {"class": "GenericError", "desc": "'TEST_DIR/t.IMGFMT.fuse' is n= ot a regular file"}} + +=3D=3D=3D Mountpoint is a regular file =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-mp', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' = } } +{"return": {}} +Images are identical. + +=3D=3D=3D Mount over existing file =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-img', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT' } } +{"return": {}} +Images are identical. + +=3D=3D=3D Double export =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse'= } } +{"error": {"class": "GenericError", "desc": "There already is a FUSE expor= t on 'TEST_DIR/t.IMGFMT.fuse'"}} + +=3D=3D=3D Remove export =3D=3D=3D +virtual size: 64 MiB (67108864 bytes) +{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} +virtual size: 0 B (0 bytes) + +=3D=3D=3D Writable export =3D=3D=3D +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-mp', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse',= 'writable': true } } +{"return": {}} +write failed: Permission denied +wrote 65536/65536 bytes at offset 1048576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 1048576 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D=3D Resizing exports =3D=3D=3D +{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} +{'execute': 'block-export-del', 'arguments': { 'id': 'export-img' } } +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "export-img"}} +{'execute': 'blockdev-del', 'arguments': { 'node-name': 'node-format' } } +{"return": {}} +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-mp', 'node-name': 'node-protocol', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse= ', 'writable': true } } +{"return": {}} + +--- Try growing non-growable export --- +(OK: Lengths of export and original are the same) +dd: error writing 'TEST_DIR/t.IMGFMT.fuse': Input/output error +1+0 records in +0+0 records out + +--- Resize export --- +(OK: Lengths of export and original are the same) +OK: Post-truncate image size is as expected +OK: Disk usage grew with fallocate + +--- Try growing growable export --- +{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} +{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'expo= rt-mp', 'node-name': 'node-protocol', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse= ', 'writable': true, 'growable': true } } +{"return": {}} +65536+0 records in +65536+0 records out +(OK: Lengths of export and original are the same) +OK: Post-grow image size is as expected + +--- Shrink export --- +(OK: Lengths of export and original are the same) +OK: Post-truncate image size is as expected + +=3D=3D=3D Tear down =3D=3D=3D +{'execute': 'quit'} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} + +=3D=3D=3D Compare copy with original =3D=3D=3D +Images are identical. +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 9e4f7c0153..8c5f622393 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -315,3 +315,4 @@ 304 rw quick 305 rw quick 307 rw quick export +308 rw --=20 2.26.2