From nobody Thu Jul 3 16:36:24 2025 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 1533505815149884.2168051895546; Sun, 5 Aug 2018 14:50:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6924F3164987; Sun, 5 Aug 2018 21:50:13 +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 2BBBD7ED99; Sun, 5 Aug 2018 21:50:13 +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 CDA6C18037FB; Sun, 5 Aug 2018 21:50:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w75LnXpD006498 for ; Sun, 5 Aug 2018 17:49:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E8607A011; Sun, 5 Aug 2018 21:49:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56BA662463 for ; Sun, 5 Aug 2018 21:49:30 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF3223DE44 for ; Sun, 5 Aug 2018 21:49:28 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 1AF86219EB; Sun, 5 Aug 2018 17:49:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 05 Aug 2018 17:49:28 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 7092B10261; Sun, 5 Aug 2018 17:49:27 -0400 (EDT) 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-sender:x-me-sender :x-sasl-enc; s=fm3; bh=zd0sQwMXdNer8Om+F1K+F6C/dkFBPgmGuTB9dvxWY I0=; b=C5j9KzbM/pAomkT02JB8G289Ndmkkk1RTDcMEd5yCoRnoA4x24UAEgYUg 94dnExeB95VkJnCOV2gV+18j3ir88ksVp7WbshhocmCbh/yRFXmeGVfHNKcoWdnk xVbfqt23xB6Sr3wetq2EMQWItSHFaU1+ycz7aEygje/Ooia81w2jIq7IMDoTM8lj l8WPOfzKy3JkpXjsotgGBQu6/x792HrjoS4pMkDx0bD1boEJ/ar0zayNLR15xVNA gq43/jN6iBO5mpaDOrq4UBXIjan/IPysy76GzHwP9dKmR1ojCneD37eksVw0u8my ubFY1TRm8YBo7LfGbhykZ5kYAnTyA== X-ME-Proxy: X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Sun, 5 Aug 2018 23:48:52 +0200 Message-Id: <913fab02ca2bd717a2fbd9df3e6b8bc44d2d894a.1533505662.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 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 05 Aug 2018 21:49:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 05 Aug 2018 21:49:28 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-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.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] xenconfig: add support for type="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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 05 Aug 2018 21:50:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl). And add a test for it. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig --- Does domain_conf.c (virDomainDefFormatInternal) still need to silently convert VIR_DOMAIN_OSTYPE_XEN to VIR_DOMAIN_OSTYPE_LINUX? In case of PVH, VIR_DOMAIN_OSTYPE_LINUX was never reported as a valid option... --- src/xenconfig/xen_common.c | 17 ++++++++++++----- src/xenconfig/xen_xl.c | 5 +++++ tests/testutilsxen.c | 3 ++- tests/xlconfigdata/test-pvh-type.cfg | 13 +++++++++++++ tests/xlconfigdata/test-pvh-type.xml | 25 +++++++++++++++++++++++++ tests/xlconfigtest.c | 1 + 6 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 tests/xlconfigdata/test-pvh-type.cfg create mode 100644 tests/xlconfigdata/test-pvh-type.xml diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index c5d81d1..3c120a0 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1081,6 +1081,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr = def, virCapsPtr caps) virCapsDomainDataPtr capsdata =3D NULL; const char *str; int hvm =3D 0, ret =3D -1; + const char *machine =3D "xenpv"; =20 if (xenConfigCopyString(conf, "name", &def->name) < 0) goto out; @@ -1089,25 +1090,31 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPt= r def, virCapsPtr caps) goto out; =20 if (xenConfigGetString(conf, "type", &str, NULL) =3D=3D 0 && str) { - if (STREQ(str, "pv")) + if (STREQ(str, "pv")) { hvm =3D 0; - else if (STREQ(str, "hvm")) + } else if (STREQ(str, "pvh")) { + hvm =3D 0; + machine =3D "xenpvh"; + } else if (STREQ(str, "hvm")) { hvm =3D 1; - else { + machine =3D "xenfv"; + } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("type %s is not supported"), str); return -1; } } else { if ((xenConfigGetString(conf, "builder", &str, "linux") =3D=3D 0) = && - STREQ(str, "hvm")) + STREQ(str, "hvm")) { hvm =3D 1; + machine =3D "xenfv"; + } } =20 def->os.type =3D (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN); =20 if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, def->os.type, - VIR_ARCH_NONE, def->virtType, NULL, NULL))) + VIR_ARCH_NONE, def->virtType, NULL, machine))) goto out; =20 def->os.arch =3D capsdata->arch; diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 19b6604..f1853bd 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -1285,6 +1285,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def) =20 /* XXX floppy disks */ } else { + if (STREQ(def->os.machine, "xenpvh")) { + if (xenConfigSetString(conf, "type", "pvh") < 0) + return -1; + } + if (def->os.bootloader && xenConfigSetString(conf, "bootloader", def->os.bootloader) < = 0) return -1; diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index c08ec4a..04f8920 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -18,7 +18,8 @@ testXLInitCaps(void) "xenfv" }; static const char *const xen_machines[] =3D { - "xenpv" + "xenpv", + "xenpvh" }; =20 if ((caps =3D virCapabilitiesNew(virArchFromHost(), diff --git a/tests/xlconfigdata/test-pvh-type.cfg b/tests/xlconfigdata/test= -pvh-type.cfg new file mode 100644 index 0000000..2493535 --- /dev/null +++ b/tests/xlconfigdata/test-pvh-type.cfg @@ -0,0 +1,13 @@ +name =3D "XenGuest2" +uuid =3D "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem =3D 579 +memory =3D 394 +vcpus =3D 1 +localtime =3D 0 +on_poweroff =3D "destroy" +on_reboot =3D "restart" +on_crash =3D "restart" +type =3D "pvh" +kernel =3D "/tmp/vmlinuz" +ramdisk =3D "/tmp/initrd" +cmdline =3D "root=3D/dev/xvda1 console=3Dhvc0" diff --git a/tests/xlconfigdata/test-pvh-type.xml b/tests/xlconfigdata/test= -pvh-type.xml new file mode 100644 index 0000000..96b0e7a --- /dev/null +++ b/tests/xlconfigdata/test-pvh-type.xml @@ -0,0 +1,25 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + linux + /tmp/vmlinuz + /tmp/initrd + root=3D/dev/xvda1 console=3Dhvc0 + + + destroy + restart + restart + + + + + + + + + diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index ad6a964..b9cf939 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -283,6 +283,7 @@ mymain(void) DO_TEST("rbd-multihost-noauth"); DO_TEST_FORMAT("paravirt-type", false); DO_TEST_FORMAT("fullvirt-type", false); + DO_TEST("pvh-type"); =20 #ifdef LIBXL_HAVE_DEVICE_CHANNEL DO_TEST("channel-pty"); --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list