From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqeKp-00028N-Bb for qemu-devel@nongnu.org; Fri, 08 May 2015 05:12:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqeKn-0004bo-JO for qemu-devel@nongnu.org; Fri, 08 May 2015 05:12:43 -0400 From: Wen Congyang Date: Fri, 8 May 2015 17:16:01 +0800 Message-ID: <1431076567-30371-10-git-send-email-wency@cn.fujitsu.com> In-Reply-To: <1431076567-30371-1-git-send-email-wency@cn.fujitsu.com> References: <1431076567-30371-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH COLO v4 09/15] Introduce a new -drive option to control whether to connect to remote target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu devel , Fam Zheng , Max Reitz , Paolo Bonzini Cc: Kevin Wolf , qemu block , Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Stefan Hajnoczi , Yang Hongyang , zhanghailiang 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 5eaf77e..6839c8f 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 = @@ -3197,6 +3201,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 -- 2.1.0