From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5VSO-0004sI-BR for qemu-devel@nongnu.org; Thu, 18 Jun 2015 04:45:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5VSJ-00049c-OW for qemu-devel@nongnu.org; Thu, 18 Jun 2015 04:45:56 -0400 From: Wen Congyang Date: Thu, 18 Jun 2015 16:49:14 +0800 Message-ID: <1434617361-17778-10-git-send-email-wency@cn.fujitsu.com> In-Reply-To: <1434617361-17778-1-git-send-email-wency@cn.fujitsu.com> References: <1434617361-17778-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH COLO-Block v6 09/16] 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 1cd1b79..07b0477 100644 --- a/blockdev.c +++ b/blockdev.c @@ -431,6 +431,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 = @@ -3214,6 +3218,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 2c2a0cc..4b3a2b9 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -88,6 +88,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 5438f98..7bdd7b7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -469,6 +469,7 @@ DEF("drive", HAS_ARG, QEMU_OPTION_drive, " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n" " [[,iops_size=is]]\n" " [[,group=g]]\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}[,...]]] @@ -530,6 +531,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.4.3