From patchwork Thu May 21 04:53:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 474780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9EBC814075F for ; Thu, 21 May 2015 14:53:47 +1000 (AEST) Received: from localhost ([::1]:54902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvIUL-0001hV-S7 for incoming@patchwork.ozlabs.org; Thu, 21 May 2015 00:53:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvIQb-0002k2-BH for qemu-devel@nongnu.org; Thu, 21 May 2015 00:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvIQZ-0003LZ-PP for qemu-devel@nongnu.org; Thu, 21 May 2015 00:49:53 -0400 Received: from [59.151.112.132] (port=32859 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvIQZ-00038n-5x; Thu, 21 May 2015 00:49:51 -0400 X-IronPort-AV: E=Sophos;i="5.01,1,1399996800"; d="scan'208";a="93599135" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 21 May 2015 12:53:51 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t4L4lrVK015056; Thu, 21 May 2015 12:47:53 +0800 Received: from G08FNSTD140052.g08.fujitsu.local (10.167.226.52) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 21 May 2015 12:49:17 +0800 From: Wen Congyang To: qemu devel , Fam Zheng , Max Reitz , Paolo Bonzini Date: Thu, 21 May 2015 12:53:02 +0800 Message-ID: <1432183988-5857-10-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1432183988-5857-1-git-send-email-wency@cn.fujitsu.com> References: <1432183988-5857-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: Kevin Wolf , qemu block , Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Stefan Hajnoczi , Yang Hongyang , zhanghailiang Subject: [Qemu-devel] [PATCH COLO-Block v5 09/15] Introduce a new -drive option to control whether to connect to remote target X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Wen Congyang Signed-off-by: zhanghailiang Signed-off-by: Gonglei --- blockdev.c | 8 ++++++++ include/block/block.h | 1 + qemu-options.hx | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/blockdev.c b/blockdev.c index 95a0c6a..0c457ee 100644 --- a/blockdev.c +++ b/blockdev.c @@ -429,6 +429,10 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, qdict_put(bs_opts, "driver", qstring_from_str(buf)); } + if (qemu_opt_get_bool(opts, "no-connect", false)) { + bdrv_flags |= BDRV_O_NO_CONNECT; + } + /* disk I/O throttling */ memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = @@ -3195,6 +3199,10 @@ QemuOptsList qemu_common_drive_opts = { .name = "detect-zeroes", .type = QEMU_OPT_STRING, .help = "try to optimize zero writes (off, on, unmap)", + },{ + .name = "no-connect", + .type = QEMU_OPT_BOOL, + .help = "enable whether to connect remote target" }, { /* end of list */ } }, diff --git a/include/block/block.h b/include/block/block.h index e479a34..ed5b8e5 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -87,6 +87,7 @@ typedef struct HDGeometry { #define BDRV_O_PROTOCOL 0x8000 /* if no block driver is explicitly given: select an appropriate protocol driver, ignoring the format layer */ +#define BDRV_O_NO_CONNECT 0x10000 /* do not connect to remote target */ #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH) diff --git a/qemu-options.hx b/qemu-options.hx index ec356f6..c41e3e3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -464,6 +464,7 @@ DEF("drive", HAS_ARG, QEMU_OPTION_drive, " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n" " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n" " [[,iops_size=is]]\n" + " [,no-connect=on|off]\n" " use 'file' as a drive image\n", QEMU_ARCH_ALL) STEXI @item -drive @var{option}[,@var{option}[,@var{option}[,...]]] @@ -525,6 +526,9 @@ file sectors into the image file. conversion of plain zero writes by the OS to driver specific optimized zero write commands. You may even choose "unmap" if @var{discard} is set to "unmap" to allow a zero write to be converted to an UNMAP operation. +@item no-connect=@var{no-connect} +@var{no-connect} is "on" or "off", and enables whether to connect to remote +target when open the drive. The default value is "off". @end table By default, the @option{cache=writeback} mode is used. It will report data