From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153246743636533.1773328978187; Tue, 24 Jul 2018 14:23:56 -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 CF3053084036; Tue, 24 Jul 2018 21:23:54 +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 6B5895DA60; Tue, 24 Jul 2018 21:23:54 +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 CE5404A460; Tue, 24 Jul 2018 21:23:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNpVC018717 for ; Tue, 24 Jul 2018 17:23:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 626D62026E0E; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48AAF2026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:42 -0400 Message-Id: <005b16b12e4cda51ddc497fa4962a1b794d723d9.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/7] conf: Break out virDomainDefParseCaps 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: , MIME-Version: 1.0 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.40]); Tue, 24 Jul 2018 21:23:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Handles parse virtType, os.type, bootloader bits, arch, machine, emulator Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 96 +++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 178c6d2711..7eb5ffc718 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19114,46 +19114,15 @@ virDomainCachetuneDefParse(virDomainDefPtr def, } =20 =20 -static virDomainDefPtr -virDomainDefParseXML(xmlDocPtr xml, - xmlNodePtr root, - xmlXPathContextPtr ctxt, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - unsigned int flags) +static int +virDomainDefParseCaps(virDomainDefPtr def, + xmlXPathContextPtr ctxt, + virCapsPtr caps, + unsigned int flags) { - xmlNodePtr *nodes =3D NULL, node =3D NULL; + int ret =3D -1; + int virtType; char *tmp =3D NULL; - size_t i, j; - int n, virtType, gic_version; - long id =3D -1; - virDomainDefPtr def; - bool uuid_generated =3D false; - bool usb_none =3D false; - bool usb_other =3D false; - bool usb_master =3D false; - char *netprefix =3D NULL; - - if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { - char *schema =3D virFileFindResource("domain.rng", - abs_topsrcdir "/docs/schemas", - PKGDATADIR "/schemas"); - if (!schema) - return NULL; - if (virXMLValidateAgainstSchema(schema, xml) < 0) { - VIR_FREE(schema); - return NULL; - } - VIR_FREE(schema); - } - - if (!(def =3D virDomainDefNew())) - return NULL; - - if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) - if (virXPathLong("string(./@id)", ctxt, &id) < 0) - id =3D -1; - def->id =3D (int)id; =20 /* Find out what type of virtualization to use */ if (!(tmp =3D virXMLPropString(ctxt->node, "type"))) { @@ -19239,6 +19208,57 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(capsdata); } =20 + ret =3D 0; + error: + VIR_FREE(tmp); + return ret; +} + + +static virDomainDefPtr +virDomainDefParseXML(xmlDocPtr xml, + xmlNodePtr root, + xmlXPathContextPtr ctxt, + virCapsPtr caps, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + xmlNodePtr *nodes =3D NULL, node =3D NULL; + char *tmp =3D NULL; + size_t i, j; + int n, gic_version; + long id =3D -1; + virDomainDefPtr def; + bool uuid_generated =3D false; + bool usb_none =3D false; + bool usb_other =3D false; + bool usb_master =3D false; + char *netprefix =3D NULL; + + if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { + char *schema =3D virFileFindResource("domain.rng", + abs_topsrcdir "/docs/schemas", + PKGDATADIR "/schemas"); + if (!schema) + return NULL; + if (virXMLValidateAgainstSchema(schema, xml) < 0) { + VIR_FREE(schema); + return NULL; + } + VIR_FREE(schema); + } + + if (!(def =3D virDomainDefNew())) + return NULL; + + if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) + if (virXPathLong("string(./@id)", ctxt, &id) < 0) + id =3D -1; + def->id =3D (int)id; + + if (virDomainDefParseCaps(def, ctxt, caps, flags) < 0) + goto error; + /* Extract domain name */ if (!(def->name =3D virXPathString("string(./name[1])", ctxt))) { virReportError(VIR_ERR_NO_NAME, NULL); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532467446671870.2986136313589; Tue, 24 Jul 2018 14:24:06 -0700 (PDT) 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 EA36FC0587F8; Tue, 24 Jul 2018 21:24:04 +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 A000816E27; Tue, 24 Jul 2018 21:24:04 +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 38F524A469; Tue, 24 Jul 2018 21:24:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNpmw018726 for ; Tue, 24 Jul 2018 17:23:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 894F92026E18; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DC602026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:43 -0400 Message-Id: <1a4c1a045146524152f4d06fe8740504cef38d8b.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/7] conf: Clean up virDomainDefParseCaps 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: , MIME-Version: 1.0 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.32]); Tue, 24 Jul 2018 21:24:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" - Convert to 'cleanup' label naming - Use more than one 'tmp' string and do all freeing at the end - Make the code easier to follow Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 76 ++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7eb5ffc718..5a90429cd6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19121,43 +19121,45 @@ virDomainDefParseCaps(virDomainDefPtr def, unsigned int flags) { int ret =3D -1; - int virtType; - char *tmp =3D NULL; + char *virttype =3D NULL; + char *arch =3D NULL; + char *ostype =3D NULL; + virCapsDomainDataPtr capsdata =3D NULL; =20 - /* Find out what type of virtualization to use */ - if (!(tmp =3D virXMLPropString(ctxt->node, "type"))) { + virttype =3D virXPathString("string(./@type)", ctxt); + ostype =3D virXPathString("string(./os/type[1])", ctxt); + arch =3D virXPathString("string(./os/type[1]/@arch)", ctxt); + + def->os.bootloader =3D virXPathString("string(./bootloader)", ctxt); + def->os.bootloaderArgs =3D virXPathString("string(./bootloader_args)",= ctxt); + def->os.machine =3D virXPathString("string(./os/type[1]/@machine)", ct= xt); + def->emulator =3D virXPathString("string(./devices/emulator[1])", ctxt= ); + + if (!virttype) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain type attribute")); - goto error; + goto cleanup; } - - if ((virtType =3D virDomainVirtTypeFromString(tmp)) < 0) { + if ((def->virtType =3D virDomainVirtTypeFromString(virttype)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid domain type %s"), tmp); - goto error; + _("invalid domain type %s"), virttype); + goto cleanup; } - def->virtType =3D virtType; - VIR_FREE(tmp); - - def->os.bootloader =3D virXPathString("string(./bootloader)", ctxt); - def->os.bootloaderArgs =3D virXPathString("string(./bootloader_args)",= ctxt); =20 - tmp =3D virXPathString("string(./os/type[1])", ctxt); - if (!tmp) { + if (!ostype) { if (def->os.bootloader) { def->os.type =3D VIR_DOMAIN_OSTYPE_XEN; } else { virReportError(VIR_ERR_XML_ERROR, "%s", _("an os must be specified")); - goto error; + goto cleanup; } } else { - if ((def->os.type =3D virDomainOSTypeFromString(tmp)) < 0) { + if ((def->os.type =3D virDomainOSTypeFromString(ostype)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown OS type '%s'"), tmp); - goto error; + _("unknown OS type '%s'"), ostype); + goto cleanup; } - VIR_FREE(tmp); } =20 /* @@ -19170,17 +19172,11 @@ virDomainDefParseCaps(virDomainDefPtr def, def->os.type =3D VIR_DOMAIN_OSTYPE_XEN; } =20 - tmp =3D virXPathString("string(./os/type[1]/@arch)", ctxt); - if (tmp && !(def->os.arch =3D virArchFromString(tmp))) { + if (arch && !(def->os.arch =3D virArchFromString(arch))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown architecture %s"), - tmp); - goto error; + _("Unknown architecture %s"), arch); + goto cleanup; } - VIR_FREE(tmp); - - def->os.machine =3D virXPathString("string(./os/type[1]/@machine)", ct= xt); - def->emulator =3D virXPathString("string(./devices/emulator[1])", ctxt= ); =20 if ((!def->os.arch || !def->os.machine) && !(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { @@ -19191,26 +19187,28 @@ virDomainDefParseCaps(virDomainDefPtr def, * in numerous minor ways. */ bool use_virttype =3D ((def->os.arch =3D=3D VIR_ARCH_NONE) || !def->os.machine); - virCapsDomainDataPtr capsdata =3D NULL; =20 - if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, def->os.t= ype, - def->os.arch, use_virttype ? def->virtType : VIR_DOMAIN_VI= RT_NONE, + if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, + def->os.type, + def->os.arch, + use_virttype ? def->virtType : VIR_DOMAIN_VIRT_NONE, NULL, NULL))) - goto error; + goto cleanup; =20 if (!def->os.arch) def->os.arch =3D capsdata->arch; if ((!def->os.machine && VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) { - VIR_FREE(capsdata); - goto error; + goto cleanup; } - VIR_FREE(capsdata); } =20 ret =3D 0; - error: - VIR_FREE(tmp); + cleanup: + VIR_FREE(virttype); + VIR_FREE(ostype); + VIR_FREE(arch); + VIR_FREE(capsdata); return ret; } =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532467447758737.6068992068442; Tue, 24 Jul 2018 14:24:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDCFC300177C; Tue, 24 Jul 2018 21:24:05 +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 A1DAB6017D; Tue, 24 Jul 2018 21:24:05 +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 143314BB78; Tue, 24 Jul 2018 21:24:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNpE8018727 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE16D2026E1A; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93CA82026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:44 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/7] tests: qemuhotplug: Fix segfault when XML loading fails 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: , MIME-Version: 1.0 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 24 Jul 2018 21:24:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some tests use the same VM state multiple times in a row. But if we failed loading the VM XML, subsequent tests crash on the NULL def pointer Signed-off-by: Cole Robinson --- I hit this with failing tests while writing this series tests/qemuhotplugtest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 674ba92b27..4f9e127f88 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -268,6 +268,8 @@ testQemuHotplug(const void *data) =20 if (test->vm) { vm =3D test->vm; + if (!vm->def) + goto cleanup; } else { if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml, test->deviceDeletedEvent) < 0) --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153246745420360.93817219499749; Tue, 24 Jul 2018 14:24:14 -0700 (PDT) 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 97488300271A; Tue, 24 Jul 2018 21:24:11 +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 3DCB760910; Tue, 24 Jul 2018 21:24:11 +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 C614B4A464; Tue, 24 Jul 2018 21:24:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNqKT018728 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id D50722026E0E; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id B95462026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:45 -0400 Message-Id: <2622a099eb9fc903cddc3c99e18876b671338f58.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/7] conf: Drop unneccessary caps parsing logic 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: , MIME-Version: 1.0 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.46]); Tue, 24 Jul 2018 21:24:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The comment says: /* If the logic here seems fairly arbitrary, that's because it is :) * This is duplicating how the code worked before * CapabilitiesDomainDataLookup was added. We can simplify this, * but it would take a bit of work because the test suite fails * in numerous minor ways. */ Nowadays the test suite changes appear quite simple, just extending test capabilities data a bit so that we aren't trying to define invalid arch/os/virtType/machine combos Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 15 ++------------- tests/testutils.c | 13 ++++++++++++- tests/testutilsqemu.c | 18 ++++++++++++++++++ tests/vircapstest.c | 2 -- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5a90429cd6..b7f6a22e20 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19178,20 +19178,9 @@ virDomainDefParseCaps(virDomainDefPtr def, goto cleanup; } =20 - if ((!def->os.arch || !def->os.machine) && - !(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { - /* If the logic here seems fairly arbitrary, that's because it is = :) - * This is duplicating how the code worked before - * CapabilitiesDomainDataLookup was added. We can simplify this, - * but it would take a bit of work because the test suite fails - * in numerous minor ways. */ - bool use_virttype =3D ((def->os.arch =3D=3D VIR_ARCH_NONE) || - !def->os.machine); - + if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, - def->os.type, - def->os.arch, - use_virttype ? def->virtType : VIR_DOMAIN_VIRT_NONE, + def->os.type, def->os.arch, def->virtType, NULL, NULL))) goto cleanup; =20 diff --git a/tests/testutils.c b/tests/testutils.c index 423f4bfdff..ab938c12fc 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1196,7 +1196,12 @@ virCapsPtr virTestGenericCapsInit(void) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, = NULL, 0, NULL)) goto error; - + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, + NULL, NULL, 0, NULL)) + goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 if ((guest =3D virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VI= R_ARCH_X86_64, "/usr/bin/acme-virt", NULL, @@ -1205,6 +1210,12 @@ virCapsPtr virTestGenericCapsInit(void) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, + NULL, NULL, 0, NULL)) + goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 =20 if (virTestGetDebug() > 1) { diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index dc7e90b952..cc2f8a7b64 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -219,6 +219,9 @@ static int testQemuAddPPC64Guest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 @@ -246,6 +249,9 @@ static int testQemuAddPPC64LEGuest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 @@ -276,6 +282,9 @@ static int testQemuAddPPCGuest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 @@ -307,6 +316,9 @@ static int testQemuAddS390Guest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 @@ -338,6 +350,9 @@ static int testQemuAddArmGuest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 @@ -367,6 +382,9 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps) =20 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, = NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; =20 return 0; =20 diff --git a/tests/vircapstest.c b/tests/vircapstest.c index 1df3fa091f..19e3c79302 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -195,8 +195,6 @@ test_virCapsDomainDataLookupQEMU(const void *data ATTRI= BUTE_UNUSED) CAPS_EXPECT_ERR(VIR_DOMAIN_OSTYPE_LINUX, VIR_ARCH_NONE, VIR_DOMAIN_VIR= T_NONE, NULL, NULL); CAPS_EXPECT_ERR(-1, VIR_ARCH_PPC64LE, VIR_DOMAIN_VIRT_NONE, NULL, "pc"= ); CAPS_EXPECT_ERR(-1, VIR_ARCH_MIPS, VIR_DOMAIN_VIRT_NONE, NULL, NULL); - CAPS_EXPECT_ERR(-1, VIR_ARCH_AARCH64, VIR_DOMAIN_VIRT_KVM, - "/usr/bin/qemu-system-aarch64", NULL); CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, "/usr/bin/qemu-system-aarch64", "pc"); CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_VMWARE, NULL, "pc"); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532467460238836.5909542036605; Tue, 24 Jul 2018 14:24:20 -0700 (PDT) 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 4693681108; Tue, 24 Jul 2018 21:24:17 +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 0972316BF5; Tue, 24 Jul 2018 21:24:17 +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 9710D1800B6B; Tue, 24 Jul 2018 21:24:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNqGf018734 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09C3C2027047; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id E185E2026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:46 -0400 Message-Id: <09f9dd272a34ce25dd6f18a25c46645df24740d8.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/7] conf: Sync caps data even when SKIP_OSTYPE_CHECKS 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: , MIME-Version: 1.0 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.28]); Tue, 24 Jul 2018 21:24:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We should still make an effort to fill in data, just not raise an error if say an ostype/virttype combo disappeared from caps. Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 13 ++++++------- tests/qemuxml2argvdata/missing-machine.xml | 2 +- tests/qemuxml2argvtest.c | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b7f6a22e20..78ee000857 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19178,18 +19178,17 @@ virDomainDefParseCaps(virDomainDefPtr def, goto cleanup; } =20 - if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { - if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, - def->os.type, def->os.arch, def->virtType, - NULL, NULL))) + if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, def->os.type, + def->os.arch, def->virtType, NULL, NULL))) { + if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)) goto cleanup; - + virResetLastError(); + } else { if (!def->os.arch) def->os.arch =3D capsdata->arch; if ((!def->os.machine && - VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) { + VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) goto cleanup; - } } =20 ret =3D 0; diff --git a/tests/qemuxml2argvdata/missing-machine.xml b/tests/qemuxml2arg= vdata/missing-machine.xml index 4ce7b377a5..2900baec90 100644 --- a/tests/qemuxml2argvdata/missing-machine.xml +++ b/tests/qemuxml2argvdata/missing-machine.xml @@ -6,7 +6,7 @@ 219100 1 - hvm + hvm diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1a936faef1..03b6d92912 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2773,6 +2773,9 @@ mymain(void) QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_NEC_USB_XHCI); =20 + /* VM XML has invalid arch/ostype/virttype combo, but the SKIP flag + * will avoid the error. Still, we expect qemu driver to complain about + * missing machine error, and not crash */ DO_TEST_PARSE_FLAGS_ERROR("missing-machine", VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS, NONE); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15324674547231012.5389266870864; Tue, 24 Jul 2018 14:24:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C19E307D875; Tue, 24 Jul 2018 21:24:12 +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 D8400CD481; Tue, 24 Jul 2018 21:24:11 +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 896FF4A46E; Tue, 24 Jul 2018 21:24:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNpn0018726 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30857202704E; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16B1A2026D68; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:47 -0400 Message-Id: <5cac0b104fec38c5ef2fe0884b0707234cc76665.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/7] tests: Remove redundant lxc 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: , MIME-Version: 1.0 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 24 Jul 2018 21:24:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This test was added in 2d40e2da7ba to ensure LXC domains could be defined correctly when caps probing was skipped due to SKIP_OSTYPE. However we do caps probing unconditionally now, so this test case is redundant Signed-off-by: Cole Robinson --- tests/lxcxml2xmltest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c index 3b96862c62..5dbeb0b2eb 100644 --- a/tests/lxcxml2xmltest.c +++ b/tests/lxcxml2xmltest.c @@ -96,8 +96,6 @@ mymain(void) DO_TEST("sharenet"); DO_TEST("ethernet"); DO_TEST("ethernet-hostip"); - DO_TEST_FULL("filesystem-root", 0, false, - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS); DO_TEST("initenv"); DO_TEST("initdir"); DO_TEST("inituser"); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 08:57:30 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532467436695973.2836536707018; Tue, 24 Jul 2018 14:23:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5157308FB9A; Tue, 24 Jul 2018 21:23:54 +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 6F1412016208; Tue, 24 Jul 2018 21:23:54 +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 F2A751800B69; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNpEA018727 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 55008202704B; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B8112026D68; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:48 -0400 Message-Id: <41c968ac8374fcc8bc515e766062c5b7ca213448.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/7] conf: Replace SKIP_OSTYPE_CHECKS with SKIP_VALIDATE 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: , MIME-Version: 1.0 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 24 Jul 2018 21:23:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" SKIP_OSTYPE_CHECKS only hides some error reporting at this point, so it can be foled into SKIP_VALIDATE Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 3 +-- src/conf/domain_conf.h | 13 +++++-------- src/conf/snapshot_conf.c | 2 -- src/conf/virdomainobjlist.c | 2 -- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 1 - 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 78ee000857..41baac08c0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28780,8 +28780,7 @@ virDomainDefCopy(virDomainDefPtr src, virDomainDefPtr ret; unsigned int format_flags =3D VIR_DOMAIN_DEF_FORMAT_SECURE; unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS; + VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; =20 if (migratable) format_flags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_= FORMAT_MIGRATABLE; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5e2f21dea3..a804e86f6c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2981,24 +2981,21 @@ typedef enum { VIR_DOMAIN_DEF_PARSE_DISK_SOURCE =3D 1 << 6, /* perform RNG schema validation on the passed XML document */ VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA =3D 1 << 7, - /* don't validate os.type and arch against capabilities. Prevents - * VMs from disappearing when qemu is removed and libvirtd is restarte= d */ - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS =3D 1 << 8, /* allow updates in post parse callback that would break ABI otherwise= */ - VIR_DOMAIN_DEF_PARSE_ABI_UPDATE =3D 1 << 9, + VIR_DOMAIN_DEF_PARSE_ABI_UPDATE =3D 1 << 8, /* skip definition validation checks meant to be executed on define ti= me only */ - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE =3D 1 << 10, + VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE =3D 1 << 9, /* skip parsing of security labels */ - VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL =3D 1 << 11, + VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL =3D 1 << 10, /* Allows updates in post parse callback for incoming persistent migra= tion * that would break ABI otherwise. This should be used only if it's s= afe * to do such change. */ - VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION =3D 1 << 12, + VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION =3D 1 << 11, /* Allows to ignore certain failures in the post parse callbacks, which * may happen due to missing packages and can be fixed by re-running t= he * post parse callbacks before starting. Failure of the post parse cal= lback * is recorded as def->postParseFail */ - VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL =3D 1 << 13, + VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL =3D 1 << 12, } virDomainDefParseFlags; =20 typedef enum { diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 9c537ac7d1..adba149241 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -273,8 +273,6 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, if ((tmp =3D virXPathString("string(./domain/@type)", ctxt))) { int domainflags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; - if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) - domainflags |=3D VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS; xmlNodePtr domainNode =3D virXPathNode("./domain", ctxt); =20 VIR_FREE(tmp); diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 72064d7c66..52171594f3 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -492,7 +492,6 @@ virDomainObjListLoadConfig(virDomainObjListPtr doms, goto error; if (!(def =3D virDomainDefParseFile(configFile, caps, xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHE= CKS | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARS= E_FAIL))) goto error; @@ -544,7 +543,6 @@ virDomainObjListLoadStatus(virDomainObjListPtr doms, VIR_DOMAIN_DEF_PARSE_STATUS | VIR_DOMAIN_DEF_PARSE_ACTUAL_NET | VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES= | - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHE= CKS | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARS= E_FAIL))) goto error; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 03b6d92912..84117a3e63 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2777,7 +2777,7 @@ mymain(void) * will avoid the error. Still, we expect qemu driver to complain about * missing machine error, and not crash */ DO_TEST_PARSE_FLAGS_ERROR("missing-machine", - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS, + VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE, NONE); =20 DO_TEST("name-escape", diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 795ddc7003..c6cb2dda0c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -76,7 +76,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) VIR_DOMAIN_DEF_PARSE_STATUS | VIR_DOMAIN_DEF_PARSE_ACTUAL_NET | VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES= | - VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHE= CKS | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARS= E_FAIL))) goto cleanup; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list