From patchwork Tue Feb 21 15:40:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 9585125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF0E0600CA for ; Tue, 21 Feb 2017 16:34:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE2F527D0E for ; Tue, 21 Feb 2017 16:34:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D301328608; Tue, 21 Feb 2017 16:34:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5FE1927D0E for ; Tue, 21 Feb 2017 16:34:13 +0000 (UTC) Received: from localhost ([::1]:46756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgDOG-0006Fu-EL for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Feb 2017 11:34:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgCYu-0005tB-Ao for qemu-devel@nongnu.org; Tue, 21 Feb 2017 10:41:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgCYt-0004MP-Fr for qemu-devel@nongnu.org; Tue, 21 Feb 2017 10:41:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49766) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgCYq-0004KY-N5; Tue, 21 Feb 2017 10:41:04 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBC8942BA3; Tue, 21 Feb 2017 15:41:04 +0000 (UTC) Received: from localhost (ovpn-116-19.phx2.redhat.com [10.3.116.19]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFf4BJ018525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Feb 2017 10:41:04 -0500 From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 21 Feb 2017 10:40:53 -0500 Message-Id: <20170221154057.20313-6-jcody@redhat.com> In-Reply-To: <20170221154057.20313-1-jcody@redhat.com> References: <20170221154057.20313-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Feb 2017 15:41:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/9] iscsi: Add timeout option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Wolf This was previously only available with -iscsi. Again, after this patch, the -iscsi option only takes effect if an URL is given. New users are supposed to use the new driver-specific option. All -iscsi options have a corresponding driver-specific option for the iscsi block driver now. Reviewed-by: Daniel P. Berrange Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf Signed-off-by: Jeff Cody --- block/iscsi.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 11bbb93..3adb9b1 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1327,29 +1327,6 @@ static char *get_initiator_name(QemuOpts *opts) return iscsi_name; } -static int parse_timeout(const char *target) -{ - QemuOptsList *list; - QemuOpts *opts; - const char *timeout; - - list = qemu_find_opts("iscsi"); - if (list) { - opts = qemu_opts_find(list, target); - if (!opts) { - opts = QTAILQ_FIRST(&list->head); - } - if (opts) { - timeout = qemu_opt_get(opts, "timeout"); - if (timeout) { - return atoi(timeout); - } - } - } - - return 0; -} - static void iscsi_nop_timed_event(void *opaque) { IscsiLun *iscsilun = opaque; @@ -1562,7 +1539,7 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) QemuOptsList *list; QemuOpts *opts; const char *user, *password, *password_secret, *initiator_name, - *header_digest; + *header_digest, *timeout; list = qemu_find_opts("iscsi"); if (!list) { @@ -1601,6 +1578,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options) if (header_digest) { qdict_set_default_str(options, "header-digest", header_digest); } + + timeout = qemu_opt_get(opts, "timeout"); + if (timeout) { + qdict_set_default_str(options, "timeout", timeout); + } } /* @@ -1656,7 +1638,6 @@ static void iscsi_parse_filename(const char *filename, QDict *options, iscsi_destroy_url(iscsi_url); } -/* TODO Add -iscsi options */ static QemuOptsList runtime_opts = { .name = "iscsi", .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), @@ -1697,6 +1678,10 @@ static QemuOptsList runtime_opts = { .name = "header-digest", .type = QEMU_OPT_STRING, }, + { + .name = "timeout", + .type = QEMU_OPT_NUMBER, + }, { /* end of list */ } }, }; @@ -1797,7 +1782,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, } /* timeout handling is broken in libiscsi before 1.15.0 */ - timeout = parse_timeout(target); + timeout = qemu_opt_get_number(opts, "timeout", 0); #if LIBISCSI_API_VERSION >= 20150621 iscsi_set_timeout(iscsi, timeout); #else