From nobody Fri Oct 11 22:01: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 1538926787022150.04662123047933; Sun, 7 Oct 2018 08:39:47 -0700 (PDT) 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 DFC2F3082A2E; Sun, 7 Oct 2018 15:39:44 +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 8B15310021B2; Sun, 7 Oct 2018 15:39:44 +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 429F94CA95; Sun, 7 Oct 2018 15:39:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w97Fdcak000596 for ; Sun, 7 Oct 2018 11:39:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BFD6103BAB4; Sun, 7 Oct 2018 15:39:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8311810021B2 for ; Sun, 7 Oct 2018 15:39:35 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79DB330820C0 for ; Sun, 7 Oct 2018 15:39:34 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E440221BCA; Sun, 7 Oct 2018 11:39:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 07 Oct 2018 11:39:33 -0400 Received: from localhost.localdomain (ip5b409b0b.dynamic.kabel-deutschland.de [91.64.155.11]) by mail.messagingengine.com (Postfix) with ESMTPA id 2634C102A0; Sun, 7 Oct 2018 11:39:33 -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-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=hpHXdheqNstdl28tD ucNv3PqejYGfDWsRSlJD95ko/k=; b=EuImdjhfkfODMmhUxTPNveIr3OrVfGgP+ c3WEt2Z4XNIK4Owa3OkYBD0TJF0+KnprmXL2KYDMEg3Ww1Vpik9zsEY27sLZnee5 kYGf7mjP+q9axKxzSCQdJD249VAc3oKddSW1E/0T5SNI6YNZ5ze+lvVs0opmCLG5 hYOTyRq0kjrfnZiII0Zx8rSgE8nRfZJGfFSyRP923Jxf4Ba5iDR5/Fwj2UjZss0/ ZG9B09RxRaUFpsG59ZXXw9EeMC9R/PqPci6tjA1ZOrkCufBRPpA/SHeYyP0NenNL 9KrQzV7LTpMKwuFH25sgZM24XPoOuQTDjfbxyK10kfezy+kWrlo2w== X-ME-Sender: X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Sun, 7 Oct 2018 17:39:17 +0200 Message-Id: <3f75e4f55ba680c5628b4d88a30da8abcc6e7294.1538926535.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 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Sun, 07 Oct 2018 15:39:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Sun, 07 Oct 2018 15:39:34 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-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.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 4/5] xenconfig: add support for parsing type= xl config entry 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.45]); Sun, 07 Oct 2018 15:39:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 builder=3D"hvm" is deprecated since Xen 4.10, new syntax is type=3D"hvm" (or type=3D"pv", which is default). Since the old one is still supported, still use it when writing native config, so the config will work on older Xen too (and will also not complicate tests). Signed-off-by: Marek Marczykowski-G=C3=B3recki --- "type" option is the only syntax for specifying PVH guest, coming in next patch. Changes in v2: - fix code style --- src/xenconfig/xen_common.c | 18 +++++++++++++--- tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++++++++++++++++++- tests/xlconfigdata/test-fullvirt-type.xml | 27 ++++++++++++++++++++++++- tests/xlconfigdata/test-paravirt-type.cfg | 13 ++++++++++++- tests/xlconfigdata/test-paravirt-type.xml | 25 ++++++++++++++++++++++- tests/xlconfigtest.c | 2 ++- 6 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg create mode 100644 tests/xlconfigdata/test-paravirt-type.xml diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 0a99587..6c27936 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1098,9 +1098,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr= def, virCapsPtr caps) if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0) goto out; =20 - if ((xenConfigGetString(conf, "builder", &str, "linux") =3D=3D 0) && - STREQ(str, "hvm")) - hvm =3D 1; + if (xenConfigGetString(conf, "type", &str, NULL) =3D=3D 0 && str) { + if (STREQ(str, "pv")) { + hvm =3D 0; + } else if (STREQ(str, "hvm")) { + hvm =3D 1; + } 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")) + hvm =3D 1; + } =20 def->os.type =3D (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN); =20 diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg b/tests/xlconfigdata= /test-fullvirt-type.cfg new file mode 100644 index 0000000..f8ecc2e --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-type.cfg @@ -0,0 +1,21 @@ +name =3D "XenGuest2" +uuid =3D "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem =3D 579 +memory =3D 394 +vcpus =3D 1 +pae =3D 1 +acpi =3D 1 +apic =3D 1 +viridian =3D 0 +rtc_timeoffset =3D 0 +localtime =3D 0 +on_poweroff =3D "destroy" +on_reboot =3D "restart" +on_crash =3D "restart" +device_model =3D "/usr/lib/xen/bin/qemu-system-i386" +sdl =3D 0 +vnc =3D 0 +parallel =3D "none" +serial =3D "none" +type =3D "hvm" +boot =3D "d" diff --git a/tests/xlconfigdata/test-fullvirt-type.xml b/tests/xlconfigdata= /test-fullvirt-type.xml new file mode 100644 index 0000000..da8e360 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-type.xml @@ -0,0 +1,27 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + hvm + /usr/lib/xen/boot/hvmloader + + + + + + + + + destroy + restart + restart + + /usr/lib/xen/bin/qemu-system-i386 + + + + + diff --git a/tests/xlconfigdata/test-paravirt-type.cfg b/tests/xlconfigdata= /test-paravirt-type.cfg new file mode 100644 index 0000000..078db99 --- /dev/null +++ b/tests/xlconfigdata/test-paravirt-type.cfg @@ -0,0 +1,13 @@ +name =3D "XenGuest2" +uuid =3D "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +type =3D "pv" +maxmem =3D 579 +memory =3D 394 +vcpus =3D 1 +localtime =3D 0 +on_poweroff =3D "destroy" +on_reboot =3D "restart" +on_crash =3D "restart" +kernel =3D "/tmp/vmlinuz" +ramdisk =3D "/tmp/initrd" +cmdline =3D "root=3D/dev/xvda1 console=3Dhvc0" diff --git a/tests/xlconfigdata/test-paravirt-type.xml b/tests/xlconfigdata= /test-paravirt-type.xml new file mode 100644 index 0000000..4357640 --- /dev/null +++ b/tests/xlconfigdata/test-paravirt-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 b2e4591..6e3267e 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -279,6 +279,8 @@ mymain(void) DO_TEST_FORMAT("paravirt-cmdline-extra-root", false); DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false); DO_TEST("rbd-multihost-noauth"); + DO_TEST_FORMAT("paravirt-type", false); + DO_TEST_FORMAT("fullvirt-type", false); =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