From patchwork Mon Sep 25 10:51:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9969685 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 8A26B602D8 for ; Mon, 25 Sep 2017 10:55:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8045228BAA for ; Mon, 25 Sep 2017 10:55:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 752B828C4B; Mon, 25 Sep 2017 10:55:36 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D8C4228BAA for ; Mon, 25 Sep 2017 10:55:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwR0h-0007XF-1n; Mon, 25 Sep 2017 10:53:11 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwR0g-0007Wf-0C for xen-devel@lists.xenproject.org; Mon, 25 Sep 2017 10:53:10 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id 87/5A-03616-510E8C95; Mon, 25 Sep 2017 10:53:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsXitHRDpK7AgxO RBju361p83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnrjkkXfFWoWHi5g7mB8ZV4FyMnh4SAv8Tl becYQWw2AR2Ji3N3snUxcnCICKhI3N5r0MXIxcEscJBR4tiTvawgNcICNhL7mw6zgNgsAqoSe 7/dBKvnFbCUmN7MBWJKCOhJ/NhuCGJyClhJfF6aBFIsBFRw4HsvG4jNKyAocXLmE7AhzAKaEq 3bf7ND2PISzVtnM0PUK0r0z3vANoGRbxaSlllIWmYhaVnAyLyKUaM4tagstUjX0EwvqSgzPaM kNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwyBiAYAfj/Y0BhxglOZiURHnv8p2IFOJLyk+p zEgszogvKs1JLT7EKMPBoSTBa3YfKCdYlJqeWpGWmQMMd5i0BAePkgivEEiat7ggMbc4Mx0id YrRmOPYpst/mDg6bt79wyTEkpeflyolzusPUioAUppRmgc3CBaHlxhlpYR5GYFOE+IpSC3KzS xBlX/FKM7BqCTMGwgyhSczrwRu3yugU5iATumdCnZKSSJCSqqBUSt6gyffsmVL5SvmBGw7m7h OO0eCb5rXcYd3PWlhD76Ham6IX5iin8l5wVfN67TBAzZD5aZjydeilNOt9t9JL1obvji31vxf KcP5V7pSX2b9vp5/OXVSiN/Mq2rps+SexCcluHOu9fyzpbQhwWniB43I05o/6xQFrjBxSqpP7 r+5qv6m+N9HSizFGYmGWsxFxYkAZqjEUb4CAAA= X-Env-Sender: prvs=43456bc54=roger.pau@citrix.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1506336772!112893408!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32992 invoked from network); 25 Sep 2017 10:53:04 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Sep 2017 10:53:04 -0000 X-IronPort-AV: E=Sophos;i="5.42,435,1500940800"; d="scan'208";a="441052402" From: Roger Pau Monne To: Date: Mon, 25 Sep 2017 11:51:49 +0100 Message-ID: <20170925105206.66507-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) In-Reply-To: <20170925105206.66507-1-roger.pau@citrix.com> References: <20170925105206.66507-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: wei.liu2@citrix.com, boris.ostrovsky@oracle.com, Roger Pau Monne , Ian Jackson Subject: [Xen-devel] [PATCH v3 05/22] xl: introduce a domain type option X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Introduce a new type option to xl configuration files in order to specify the domain type. This supersedes the current builder option. The new option is documented in the xl.cfg man page, and the previous builder option is marked as deprecated. Signed-off-by: Roger Pau Monné Acked-by: Ian Jackson --- Cc: Ian Jackson Cc: Wei Liu --- Changes since v2: - Left shift error message. - Detect wrong combination of 'builder' and 'type' options. - Do not complain if both type and builder and set to the same value. - Drop Wei's Ack (patch changed substantially). --- docs/man/xl.cfg.pod.5.in | 23 +++++++++++++++++++++-- tools/xl/xl_parse.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index 247ae99ca7..df889ea7e4 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -54,9 +54,9 @@ Pairs may be separated either by a newline or a semicolon. Both of the following are valid: name="h0" - builder="hvm" + type="hvm" - name="h0"; builder="hvm" + name="h0"; type="hvm" =head1 OPTIONS @@ -77,6 +77,25 @@ single host must be unique. =over 4 +=item B + +Specifies that this is to be a PV domain, suitable for hosting Xen-aware +guest operating systems. This is the default. + +=item B + +Specifies that this is to be an HVM domain. That is, a fully virtualised +computer with emulated BIOS, disk and network peripherals, etc. + +=back + +=head3 Deprecated guest type selection + +Note that the builder option is being deprecated in favor of the type +option. + +=over 4 + =item B Specifies that this is to be a PV domain, suitable for hosting Xen-aware guest diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index f672161541..f9afa9ad35 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -900,10 +900,47 @@ void parse_config_data(const char *config_source, } libxl_defbool_set(&c_info->run_hotplug_scripts, run_hotplug_scripts); - c_info->type = LIBXL_DOMAIN_TYPE_PV; - if (!xlu_cfg_get_string (config, "builder", &buf, 0) && - !strncmp(buf, "hvm", strlen(buf))) - c_info->type = LIBXL_DOMAIN_TYPE_HVM; + + if (!xlu_cfg_get_string(config, "type", &buf, 0)) { + if (!strncmp(buf, "hvm", strlen(buf))) + c_info->type = LIBXL_DOMAIN_TYPE_HVM; + else if (!strncmp(buf, "pv", strlen(buf))) + c_info->type = LIBXL_DOMAIN_TYPE_PV; + else { + fprintf(stderr, "Invalid domain type %s.\n", buf); + exit(1); + } + } + +#define CHECK_AND_SET_TYPE(type, new) \ +({ \ + if (((type) != LIBXL_DOMAIN_TYPE_INVALID) && \ + ((type) != (new))) { \ + fprintf(stderr, \ + "Contradicting \"builder\" and \"type\" options specified.\n");\ + exit(1); \ + } \ + (type) = (new); \ +}) + + /* Deprecated since Xen 4.10. */ + if (!xlu_cfg_get_string(config, "builder", &buf, 0)) { + if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID) + fprintf(stderr, +"The \"builder\" option is being deprecated, please use \"type\" instead.\n"); + if (!strncmp(buf, "hvm", strlen(buf))) + CHECK_AND_SET_TYPE(c_info->type, LIBXL_DOMAIN_TYPE_HVM); + else if (!strncmp(buf, "generic", strlen(buf))) + CHECK_AND_SET_TYPE(c_info->type, LIBXL_DOMAIN_TYPE_PV); + else { + fprintf(stderr, "Invalid domain type %s.\n", buf); + exit(1); + } + } +#undef CHECK_AND_SET_TYPE + + if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID) + c_info->type = LIBXL_DOMAIN_TYPE_PV; xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);