From nobody Fri Apr 26 23:37:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543260905019643.9911515796007; Mon, 26 Nov 2018 11:35:05 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5242C80F93; Mon, 26 Nov 2018 19:35:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C881419744; Mon, 26 Nov 2018 19:35:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C2ED4181B9E4; Mon, 26 Nov 2018 19:35:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAQJYxkq019349 for ; Mon, 26 Nov 2018 14:34:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA3CB604CE; Mon, 26 Nov 2018 19:34:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B12016019C for ; Mon, 26 Nov 2018 19:34:57 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA40F88E4A for ; Mon, 26 Nov 2018 19:34:56 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 34A9422136; Mon, 26 Nov 2018 14:34:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 26 Nov 2018 14:34:55 -0500 Received: from localhost.localdomain (ip5b40a57c.dynamic.kabel-deutschland.de [91.64.165.124]) by mail.messagingengine.com (Postfix) with ESMTPA id EE35CE4899; Mon, 26 Nov 2018 14:34:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cDVJwn/EG4YSOnwxc ybtwGrBER2i2N/9crgN0u4aZ9M=; b=RIKgHQhylw8wlpkFQHPeoUfc1pTxO6f93 ZlxTkcFZPxMfpNi56bI6voHhlvRUK25f/tE2SMdXlMBLPL9ISxJbjDDj3tQIyfSE tm68uTuDq8eypcfIZfHs8BeUYjnFNGhqfse5opdNpcwYOWStYGigtV4vvrgeZAay Kyi9wtF51ecoXQGj0Xvji45Vh+S7ay7sdjhghEscr8HxM3BbGdaGI8MwVNdmURoh EYqBGywN0DFZ+5xYcuGAiv9QGDeL0TAKc2qpaWWuZWDc8srAX9h1XcgfrGUG/h7P zftypBxhW1FLimaY17C4YB5IGh/921qXbZoWWab/vQiuxcy/CYcPQ== X-ME-Sender: X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 26 Nov 2018 20:34:36 +0100 Message-Id: <2111199d5fc32ef30d7bceb7cdb4c8b7fb33fdf2.1543260847.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 26 Nov 2018 19:34:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 26 Nov 2018 19:34:56 +0000 (UTC) for IP:'66.111.4.28' DOMAIN:'out4-smtp.messagingengine.com' HELO:'out4-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.28 out4-smtp.messagingengine.com 66.111.4.28 out4-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 1/6] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 26 Nov 2018 19:35:03 +0000 (UTC) Make it easier to share HVM and PVH code where relevant. No functional change. Signed-off-by: Marek Marczykowski-G=C3=B3recki --- src/libxl/libxl_conf.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index e2bfa2f..f3da0ed 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, b_info->max_memkb =3D virDomainDefGetMemoryInitial(def); b_info->target_memkb =3D def->mem.cur_balloon; if (hvm) { - char bootorder[VIR_DOMAIN_BOOT_LAST + 1]; - - libxl_defbool_set(&b_info->u.hvm.pae, - def->features[VIR_DOMAIN_FEATURE_PAE] =3D=3D - VIR_TRISTATE_SWITCH_ON); - libxl_defbool_set(&b_info->u.hvm.apic, - def->features[VIR_DOMAIN_FEATURE_APIC] =3D=3D - VIR_TRISTATE_SWITCH_ON); - libxl_defbool_set(&b_info->u.hvm.acpi, - def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D - VIR_TRISTATE_SWITCH_ON); - if (caps && def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { bool hasHwVirt =3D false; @@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, "mode=3Dhost-passthrough to avoid risk of changed gue= st " "semantics when mode=3Dcustom is supported in the fut= ure"); } + } + + if (hvm) { + char bootorder[VIR_DOMAIN_BOOT_LAST + 1]; + + libxl_defbool_set(&b_info->u.hvm.pae, + def->features[VIR_DOMAIN_FEATURE_PAE] =3D=3D + VIR_TRISTATE_SWITCH_ON); + libxl_defbool_set(&b_info->u.hvm.apic, + def->features[VIR_DOMAIN_FEATURE_APIC] =3D=3D + VIR_TRISTATE_SWITCH_ON); + libxl_defbool_set(&b_info->u.hvm.acpi, + def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D + VIR_TRISTATE_SWITCH_ON); =20 if (def->nsounds > 0) { /* --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 23:37:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543260904896737.222313300101; Mon, 26 Nov 2018 11:35:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F1C2D2164; Mon, 26 Nov 2018 19:35:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA51D1054FBA; Mon, 26 Nov 2018 19:35:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CDBCF3F602; Mon, 26 Nov 2018 19:35:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAQJZ0na019356 for ; Mon, 26 Nov 2018 14:35:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F9F5608F3; Mon, 26 Nov 2018 19:35:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 544C2608E2 for ; Mon, 26 Nov 2018 19:34:58 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCBF680464 for ; Mon, 26 Nov 2018 19:34:56 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D534322219; Mon, 26 Nov 2018 14:34:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 26 Nov 2018 14:34:55 -0500 Received: from localhost.localdomain (ip5b40a57c.dynamic.kabel-deutschland.de [91.64.165.124]) by mail.messagingengine.com (Postfix) with ESMTPA id CF62DE49DF; Mon, 26 Nov 2018 14:34:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=/DUQOh99LLnk1msM2 f/DLFAJ/VAOF8rQnpE4/bwpX7k=; b=ZGTPof7iBRaKw7CAUrtRH63SiFoqUKO4F FtEBus2z1xs7PWRS+7gH7QaF7w8cxFIw14nfyD+EHG82q/jauwYZdRF800WmqoV6 Olo+VjGrUPryjTd70ABbQuDCPCu64QFeHFDsvjDHEfyM/fAhWuSrFAtCAeIghr76 N201o1vkTsv+MHX+XEAIy3CSQX2DaO7UZZnmzK9PCEa+xnpi+K3F3Gpfzj9B+ger yUa5ksa/tCWr0LJvXtxeiK4jf9OexN22S8JasGAxN8pYao/zpWV92M7xX+5u+qes 7bQVs8VwFXPP9z53BtLdO6Mv7WTxG0x7UlJg6aURxaVWtmOMf/C7A== X-ME-Sender: X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 26 Nov 2018 20:34:37 +0100 Message-Id: <77a81f99ed5f925b661d0f8beddeefac842aee83.1543260847.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 26 Nov 2018 19:34:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 26 Nov 2018 19:34:57 +0000 (UTC) for IP:'66.111.4.28' DOMAIN:'out4-smtp.messagingengine.com' HELO:'out4-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.28 out4-smtp.messagingengine.com 66.111.4.28 out4-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 2/6] libxl: add support for PVH X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 26 Nov 2018 19:35:03 +0000 (UTC) Since this is something between PV and HVM, it makes sense to put the setting in place where domain type is specified. To enable it, use .... It is also included in capabilities.xml, for every supported HVM guest type - it doesn't seems to be any other requirement (besides new enough Xen). Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes in v2 proposed by Jim: - use new_arch_added var instead of i =3D=3D nr_guest_archs for clarity - improve comment - adjust for now required Xen >=3D 4.6 (remove part for Xen < 4.5) Changes in v3: - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to Xen PV only - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH - fix reported capabilities for PVH - remove hostdev passthrough and video/graphics - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to check for PVH support - compile fix for Xen < 4.9 Changes in v4: - revert to "i =3D=3D nr_guest_archs-1" check - let configure check for LIBXL_DOMAIN_TYPE_PVH and use #ifdef HAVE_XEN_PVH then - fix comment about Xen version Changes in v5: - use 'xenpvh' os type --- docs/formatcaps.html.in | 9 ++++-- docs/schemas/domaincommon.rng | 2 +- m4/virt-driver-libxl.m4 | 3 ++- src/conf/domain_conf.c | 10 ++++--- src/conf/domain_conf.h | 1 +- src/libxl/libxl_capabilities.c | 38 +++++++++++++++++++++++--- src/libxl/libxl_conf.c | 52 ++++++++++++++++++++++++++++++----- src/libxl/libxl_driver.c | 6 ++-- 8 files changed, 102 insertions(+), 19 deletions(-) diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in index 0d9c53d..86534b2 100644 --- a/docs/formatcaps.html.in +++ b/docs/formatcaps.html.in @@ -74,11 +74,14 @@ is able to run. Possible values are:
xen
-
for XEN
+
for XEN PV
=20
linux
legacy alias for xen
=20 +
xenpvh
+
for XEN PVH
+
hvm
Unmodified operating system
=20 @@ -104,8 +107,8 @@
machine
Machine type, for use in machine= attribute of os/type element in domain XML. For example Xen - supports xenfv for HVM or xenpv for - PV.
+ supports xenfv for HVM, xenpv for + PV, or xenpvh for PVH.
domain
The type attribut= e of this element specifies the type of hypervisor required to ru= n the domain. Use in type diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5ee727e..9b5ffa3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -341,12 +341,14 @@ xenpv xenfv + xenpvh xen linux + xenpvh diff --git a/m4/virt-driver-libxl.m4 b/m4/virt-driver-libxl.m4 index 479d911..2cd97cc 100644 --- a/m4/virt-driver-libxl.m4 +++ b/m4/virt-driver-libxl.m4 @@ -75,6 +75,9 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [ ]) fi =20 + dnl Check if Xen has support for PVH + AC_CHECK_DECL(LIBXL_DOMAIN_TYPE_PVH, [AC_DEFINE([HAVE_XEN_PVH], [1], [De= fine to 1 if Xen has PVH support.])], [], [#include ]) + AC_SUBST([LIBXL_CFLAGS]) AC_SUBST([LIBXL_LIBS]) ]) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1387483..10bf933 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -126,7 +126,8 @@ VIR_ENUM_IMPL(virDomainOS, VIR_DOMAIN_OSTYPE_LAST, "xen", "linux", "exe", - "uml") + "uml", + "xenpvh") =20 VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST, "fd", @@ -12932,7 +12933,8 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xml= opt, bus); goto error; } - } else if (dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN) { + } else if (dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || + dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH) { if (def->bus !=3D VIR_DOMAIN_INPUT_BUS_XEN) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported input bus %s"), @@ -12981,7 +12983,8 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xml= opt, } else { def->bus =3D VIR_DOMAIN_INPUT_BUS_USB; } - } else if (dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN) { + } else if (dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || + dom->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH) { def->bus =3D VIR_DOMAIN_INPUT_BUS_XEN; } else { if ((dom->virtType =3D=3D VIR_DOMAIN_VIRT_VZ || @@ -18770,6 +18773,7 @@ virDomainDefParseBootOptions(virDomainDefPtr def, } =20 if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || + def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH || def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM || def->os.type =3D=3D VIR_DOMAIN_OSTYPE_UML) { xmlNodePtr loader_node; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 467785c..cb56b6f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -255,6 +255,7 @@ typedef enum { VIR_DOMAIN_OSTYPE_LINUX, VIR_DOMAIN_OSTYPE_EXE, VIR_DOMAIN_OSTYPE_UML, + VIR_DOMAIN_OSTYPE_XENPVH, =20 VIR_DOMAIN_OSTYPE_LAST } virDomainOSType; diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 18596c7..58ec13f 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -57,6 +57,7 @@ struct guest_arch { virArch arch; int bits; int hvm; + int pvh; int pae; int nonpae; int ia64_be; @@ -491,20 +492,44 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) guest_archs[i].nonpae =3D nonpae; if (ia64_be) guest_archs[i].ia64_be =3D ia64_be; + + /* + * Xen 4.10 introduced support for the PVH guest type, which + * requires hardware virtualization support similar to the + * HVM guest type. Add a PVH guest type for each new HVM + * guest type. + */ +#ifdef HAVE_XEN_PVH + if (hvm && i =3D=3D nr_guest_archs-1) { + /* Ensure we have not exhausted the guest_archs array */ + if (nr_guest_archs >=3D ARRAY_CARDINALITY(guest_archs)) + continue; + i =3D nr_guest_archs; + nr_guest_archs++; + + guest_archs[i].arch =3D arch; + guest_archs[i].hvm =3D 0; + guest_archs[i].pvh =3D 1; + } +#endif } } regfree(®ex); =20 for (i =3D 0; i < nr_guest_archs; ++i) { virCapsGuestPtr guest; - char const *const xen_machines[] =3D {guest_archs[i].hvm ? "xenfv"= : "xenpv"}; + char const *const xen_machines[] =3D { + guest_archs[i].hvm ? "xenfv" : + (guest_archs[i].pvh ? "xenpvh" : "xenpv")}; virCapsGuestMachinePtr *machines; =20 if ((machines =3D virCapabilitiesAllocMachines(xen_machines, 1)) = =3D=3D NULL) return -1; =20 if ((guest =3D virCapabilitiesAddGuest(caps, - guest_archs[i].hvm ? VIR_DOMA= IN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN, + guest_archs[i].hvm ? VIR_DOMA= IN_OSTYPE_HVM : + (guest_archs[i].pvh ? VIR_= DOMAIN_OSTYPE_XENPVH : + VIR_DOMAIN_OSTYPE_XEN), guest_archs[i].arch, LIBXL_EXECBIN_DIR "/qemu-syst= em-i386", (guest_archs[i].hvm ? @@ -557,7 +582,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) 1, 0) =3D=3D NULL) return -1; + } =20 + if (guest_archs[i].hvm || guest_archs[i].pvh) { if (virCapabilitiesAddGuestFeature(guest, "hap", 1, @@ -580,7 +607,7 @@ libxlMakeDomainOSCaps(const char *machine, =20 os->supported =3D true; =20 - if (STREQ(machine, "xenpv")) + if (STREQ(machine, "xenpv") || STREQ(machine, "xenpvh")) return 0; =20 capsLoader->supported =3D true; @@ -734,9 +761,12 @@ libxlMakeDomainCapabilities(virDomainCapsPtr domCaps, if (libxlMakeDomainOSCaps(domCaps->machine, os, firmwares, nfirmwares)= < 0 || libxlMakeDomainDeviceDiskCaps(disk) < 0 || libxlMakeDomainDeviceGraphicsCaps(graphics) < 0 || - libxlMakeDomainDeviceVideoCaps(video) < 0 || + libxlMakeDomainDeviceVideoCaps(video) < 0) + return -1; + if (STRNEQ(domCaps->machine, "xenpvh") && libxlMakeDomainDeviceHostdevCaps(hostdev) < 0) return -1; + return 0; } =20 diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index f3da0ed..ea88032 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -133,8 +133,19 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx, =20 libxl_domain_create_info_init(c_info); =20 - if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM || + def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH) { +#ifdef HAVE_XEN_PVH + c_info->type =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM ? + LIBXL_DOMAIN_TYPE_HVM : LIBXL_DOMAIN_TYPE_PVH; +#else + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("PVH guest os type not supported")); + return -1; + } c_info->type =3D LIBXL_DOMAIN_TYPE_HVM; +#endif switch ((virTristateSwitch) def->features[VIR_DOMAIN_FEATURE_HAP])= { case VIR_TRISTATE_SWITCH_OFF: libxl_defbool_set(&c_info->hap, false); @@ -276,16 +287,26 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, virDomainClockDef clock =3D def->clock; libxl_ctx *ctx =3D cfg->ctx; libxl_domain_build_info *b_info =3D &d_config->b_info; - int hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; + bool hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; + bool pvh =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH; size_t i; size_t nusbdevice =3D 0; =20 libxl_domain_build_info_init(b_info); =20 - if (hvm) + if (hvm) { libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_HVM); - else + } else if (pvh) { +#ifdef HAVE_XEN_PVH + libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH); +#else + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("PVH guest os type not supported")); + return -1; +#endif + } else { libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PV); + } =20 b_info->max_vcpus =3D virDomainDefGetVcpusMax(def); if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, b_info->max_vcpu= s)) @@ -375,7 +396,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->mem.cur_balloon =3D VIR_ROUND_UP(def->mem.cur_balloon, 1024); b_info->max_memkb =3D virDomainDefGetMemoryInitial(def); b_info->target_memkb =3D def->mem.cur_balloon; - if (hvm) { + if (hvm || pvh) { if (caps && def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { bool hasHwVirt =3D false; @@ -647,6 +668,22 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, return -1; } #endif + } else if (pvh) { + if (VIR_STRDUP(b_info->cmdline, def->os.cmdline) < 0) + return -1; + if (VIR_STRDUP(b_info->kernel, def->os.kernel) < 0) + return -1; + if (VIR_STRDUP(b_info->ramdisk, def->os.initrd) < 0) + return -1; +#ifdef LIBXL_HAVE_BUILDINFO_BOOTLOADER + if (VIR_STRDUP(b_info->bootloader, def->os.bootloader) < 0) + return -1; + if (def->os.bootloaderArgs) { + if (!(b_info->bootloader_args =3D + virStringSplit(def->os.bootloaderArgs, " \t\n", 0))) + return -1; + } +#endif } else { /* * For compatibility with the legacy xen toolstack, default to pyg= rub @@ -1226,11 +1263,12 @@ libxlMakeNic(virDomainDefPtr def, * hvm guest"). */ if (l_nic->model) { - if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN && + if ((def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XEN || + def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH) && STRNEQ(l_nic->model, "netfront")) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("only model 'netfront' is supported for " - "Xen PV domains")); + "Xen PV(H) domains")); return -1; } if (VIR_STRDUP(x_nic->model, l_nic->model) < 0) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index efd47a3..5aa68a7 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6398,9 +6398,11 @@ libxlConnectGetDomainCapabilities(virConnectPtr conn, emulatorbin =3D "/usr/bin/qemu-system-x86_64"; =20 if (machine) { - if (STRNEQ(machine, "xenpv") && STRNEQ(machine, "xenfv")) { + if (STRNEQ(machine, "xenpv") && + STRNEQ(machine, "xenpvh") && + STRNEQ(machine, "xenfv")) { virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Xen only supports 'xenpv' and 'xenfv' machin= es")); + _("Xen only supports 'xenpv', 'xenpvh' and 'xen= fv' machines")); goto cleanup; } } else { --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 23:37:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543260912834139.40206935332242; Mon, 26 Nov 2018 11:35:12 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A065A3167E40; Mon, 26 Nov 2018 19:35:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 561FF608C6; Mon, 26 Nov 2018 19:35:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F2031181B9E9; Mon, 26 Nov 2018 19:35:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAQJZ0CM019354 for ; Mon, 26 Nov 2018 14:35:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5830A6019C; Mon, 26 Nov 2018 19:35:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B13B660469 for ; Mon, 26 Nov 2018 19:34:58 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56F89BE010 for ; Mon, 26 Nov 2018 19:34:57 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 698FA22209; Mon, 26 Nov 2018 14:34:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 26 Nov 2018 14:34:56 -0500 Received: from localhost.localdomain (ip5b40a57c.dynamic.kabel-deutschland.de [91.64.165.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 9A152E4A3B; Mon, 26 Nov 2018 14:34:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Ta1e0Hg8KfLWPNhkr AJojFsHaLcxhwcUE40SfKtOFhI=; b=Xb8RbsSu62Ph6n75RLs1164ORexZPQ55f 5vPaxnqVjFq5ErigxQlx5RCmh7byRXjEO3AzVvqk0VOoRyLGLVZ69ClS9ABtM33w uxBTwX9/NxAM3VDoN7r1/9+gMlIuS+ZUKhlEfh7bQ64yoDImFLOB/u7ZFMwx+gka ceWWt02pb4PnBD76bIwVdTxLbHKYw6pZ8/s3rqVhwxWTXL4Iiaq+LNTOlrYMKIfx sKmjW4KYIHUX+2RbWlC+e6dcdzycqroEBUmQyRw9oqfRftQuzFnIUdUXFcH6AQbe KjvbzhpSLQkJyycrDcSbjvtiVrebLYuUiANwLyjltqqkicAW3zWaQ== X-ME-Sender: X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Mon, 26 Nov 2018 20:34:38 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 26 Nov 2018 19:34:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 26 Nov 2018 19:34:57 +0000 (UTC) for IP:'66.111.4.28' DOMAIN:'out4-smtp.messagingengine.com' HELO:'out4-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.28 out4-smtp.messagingengine.com 66.111.4.28 out4-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 3/6] tests: add basic Xen PVH test X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 26 Nov 2018 19:35:11 +0000 (UTC) Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes in v3: - update for modified "libxl: add support for PVH" - skip PVH test on too old Xen Changes in v5: - adjust for xenpvh os type --- tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++++++++++++++++++++++- tests/libxlxml2domconfigdata/basic-pvh.xml | 28 +++++++++++++- tests/libxlxml2domconfigtest.c | 3 +- 3 files changed, 80 insertions(+) create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json b/tests/libxlxml2d= omconfigdata/basic-pvh.json new file mode 100644 index 0000000..48365c9 --- /dev/null +++ b/tests/libxlxml2domconfigdata/basic-pvh.json @@ -0,0 +1,49 @@ +{ + "c_info": { + "type": "pvh", + "name": "test-pvh", + "uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656" + }, + "b_info": { + "max_vcpus": 4, + "avail_vcpus": [ + 0, + 1, + 2, + 3 + ], + "max_memkb": 524288, + "target_memkb": 524288, + "shadow_memkb": 8192, + "sched_params": { + + }, + "kernel": "/boot/vmlinuz", + "ramdisk": "/boot/initrd.img", + "type.pvh": { + }, + "arch_arm": { + + } + }, + "disks": [ + { + "pdev_path": "/var/lib/xen/images/test-pv.img", + "vdev": "xvda", + "backend": "qdisk", + "format": "raw", + "removable": 1, + "readwrite": 1 + } + ], + "nics": [ + { + "devid": 0, + "mac": "00:16:3e:3e:86:60", + "bridge": "br0", + "script": "/etc/xen/scripts/vif-bridge", + "nictype": "vif" + } + ], + "on_reboot": "restart" +} diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml b/tests/libxlxml2do= mconfigdata/basic-pvh.xml new file mode 100644 index 0000000..fa9ff7c --- /dev/null +++ b/tests/libxlxml2domconfigdata/basic-pvh.xml @@ -0,0 +1,28 @@ + + test-pvh + 039e9ee6-4a84-3055-4c81-8ba426ae2656 + 524288 + 524288 + 4 + + xenpvh + /boot/vmlinuz + /boot/initrd.img + + + destroy + restart + destroy + + + + + + + + + +