From nobody Thu May 2 13:45:09 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 1527515655237936.9404316318111; Mon, 28 May 2018 06:54:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CC7C30B8400; Mon, 28 May 2018 13:54:13 +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 8AFFF5D6B5; Mon, 28 May 2018 13:54:12 +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 745684CA81; Mon, 28 May 2018 13:54:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4SDs9rB012995 for ; Mon, 28 May 2018 09:54:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E4992166BB6; Mon, 28 May 2018 13:54:09 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E71002166BB2 for ; Mon, 28 May 2018 13:54:08 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 28 May 2018 15:54:02 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] vmx: add VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 28 May 2018 13:54:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Further patches will introduce validation and a default setting of def->os.bootDevs in postParse. Introduce a feature flag to opt out of this and set it in the vmx driver. Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.h | 1 + src/vmx/vmx.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b7e52a1e03..e10206b358 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2557,6 +2557,7 @@ typedef enum { VIR_DOMAIN_DEF_FEATURE_NAME_SLASH =3D (1 << 3), VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS =3D (1 << 4), VIR_DOMAIN_DEF_FEATURE_USER_ALIAS =3D (1 << 5), + VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER =3D (1 << 6), } virDomainDefFeatures; =20 =20 diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index df6a58a474..bdc27b15b0 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -550,7 +550,8 @@ static virDomainDefParserConfig virVMXDomainDefParserCo= nfig =3D { .devicesPostParseCallback =3D virVMXDomainDevicesDefPostParse, .domainPostParseCallback =3D virVMXDomainDefPostParse, .features =3D (VIR_DOMAIN_DEF_FEATURE_WIDE_SCSI | - VIR_DOMAIN_DEF_FEATURE_NAME_SLASH), + VIR_DOMAIN_DEF_FEATURE_NAME_SLASH | + VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER), }; =20 struct virVMXDomainDefNamespaceData { --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 13:45:09 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 152751565627941.14308733922792; Mon, 28 May 2018 06:54:16 -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 7E49B30D17C1; Mon, 28 May 2018 13:54:14 +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 44662100190D; Mon, 28 May 2018 13:54:14 +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 EB8021800C99; Mon, 28 May 2018 13:54:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4SDsAa1013000 for ; Mon, 28 May 2018 09:54:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id E5A832166BB6; Mon, 28 May 2018 13:54:09 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8949B2166BB2 for ; Mon, 28 May 2018 13:54:09 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 28 May 2018 15:54:03 +0200 Message-Id: <57c3ea8374d0dbd979c246700b95a2f39643df98.1527515594.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] conf: introduce virDomainDefCheckBootOrder 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.42]); Mon, 28 May 2018 13:54:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Move the check for boot elements into a separate function and remove its dependency on the parser-supplied bootHash table. Reconstructing the hash table from the domain definition effectively duplicates the check for duplicate boot order values, also present in virDomainDeviceBootParseXML. Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 89 +++++++++++++++++++++++-= ---- tests/qemuargv2xmldata/nomachine-aarch64.xml | 1 + tests/qemuargv2xmldata/nomachine-ppc64.xml | 1 + tests/qemuargv2xmldata/nomachine-x86_64.xml | 1 + tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 1 + 5 files changed, 78 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d6ac47c629..f087a3680f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4939,10 +4939,79 @@ virDomainDefPostParseCPU(virDomainDefPtr def) } =20 =20 +static int +virDomainDefCollectBootOrder(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED, + virDomainDeviceInfoPtr info, + void *data) +{ + virHashTablePtr bootHash =3D data; + char *order =3D NULL; + int ret =3D -1; + + if (info->bootIndex =3D=3D 0) + return 0; + + if (virAsprintf(&order, "%u", info->bootIndex) < 0) + goto cleanup; + + if (virHashLookup(bootHash, order)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("boot order '%s' used for more than one device"), + order); + goto cleanup; + } + + if (virHashAddEntry(bootHash, order, (void *) 1) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + VIR_FREE(order); + return ret; +} + + +static int +virDomainDefCheckBootOrder(virDomainDefPtr def) +{ + virHashTablePtr bootHash =3D NULL; + int ret =3D -1; + + if (def->os.type !=3D VIR_DOMAIN_OSTYPE_HVM) + return 0; + + if (!(bootHash =3D virHashCreate(5, NULL))) + goto cleanup; + + if (virDomainDeviceInfoIterate(def, virDomainDefCollectBootOrder, boot= Hash) < 0) + goto cleanup; + + if (def->os.nBootDevs > 0 && virHashSize(bootHash) > 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("per-device boot elements cannot be used" + " together with os/boot elements")); + goto cleanup; + } + + if (def->os.nBootDevs =3D=3D 0 && virHashSize(bootHash) =3D=3D 0) { + def->os.nBootDevs =3D 1; + def->os.bootDevs[0] =3D VIR_DOMAIN_BOOT_DISK; + } + + ret =3D 0; + + cleanup: + virHashFree(bootHash); + return ret; +} + + static int virDomainDefPostParseCommon(virDomainDefPtr def, struct virDomainDefPostParseDeviceIteratorData= *data, - virHashTablePtr bootHash) + virHashTablePtr bootHash ATTRIBUTE_UNUSED) { size_t i; =20 @@ -4953,20 +5022,6 @@ virDomainDefPostParseCommon(virDomainDefPtr def, return -1; } =20 - if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && bootHash) { - if (def->os.nBootDevs > 0 && virHashSize(bootHash) > 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("per-device boot elements cannot be used" - " together with os/boot elements")); - return -1; - } - - if (def->os.nBootDevs =3D=3D 0 && virHashSize(bootHash) =3D=3D 0) { - def->os.nBootDevs =3D 1; - def->os.bootDevs[0] =3D VIR_DOMAIN_BOOT_DISK; - } - } - if (virDomainVcpuDefPostParse(def) < 0) return -1; =20 @@ -4979,6 +5034,10 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefRejectDuplicatePanics(def) < 0) return -1; =20 + if (!(data->xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_NO_BOOT_O= RDER) && + virDomainDefCheckBootOrder(def) < 0) + return -1; + if (virDomainDefPostParseTimer(def) < 0) return -1; =20 diff --git a/tests/qemuargv2xmldata/nomachine-aarch64.xml b/tests/qemuargv2= xmldata/nomachine-aarch64.xml index eb8f9db803..9492423389 100644 --- a/tests/qemuargv2xmldata/nomachine-aarch64.xml +++ b/tests/qemuargv2xmldata/nomachine-aarch64.xml @@ -6,6 +6,7 @@ 1 hvm + diff --git a/tests/qemuargv2xmldata/nomachine-ppc64.xml b/tests/qemuargv2xm= ldata/nomachine-ppc64.xml index 439f9e9ac6..1f15a950e3 100644 --- a/tests/qemuargv2xmldata/nomachine-ppc64.xml +++ b/tests/qemuargv2xmldata/nomachine-ppc64.xml @@ -6,6 +6,7 @@ 1 hvm + destroy diff --git a/tests/qemuargv2xmldata/nomachine-x86_64.xml b/tests/qemuargv2x= mldata/nomachine-x86_64.xml index 71a36f0833..33cde4c55a 100644 --- a/tests/qemuargv2xmldata/nomachine-x86_64.xml +++ b/tests/qemuargv2xmldata/nomachine-x86_64.xml @@ -6,6 +6,7 @@ 1 hvm + diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml b/tests/sexpr2xmld= ata/sexpr2xml-fv-kernel.xml index afb9030681..a3d54ae3c1 100644 --- a/tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml +++ b/tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml @@ -10,6 +10,7 @@ /var/lib/xen/vmlinuz.2Dn2YT /var/lib/xen/initrd.img.0u-Vhq method=3Dhttp://download.fedora.devel.redhat.com/pub/fedora/= linux/core/test/5.91/x86_64/os + destroy --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 13:45:09 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 1527515668946213.4080800743859; Mon, 28 May 2018 06:54:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A71930BC70D; Mon, 28 May 2018 13:54:27 +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 ABB695D6B5; Mon, 28 May 2018 13:54:26 +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 42F334CA87; Mon, 28 May 2018 13:54:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4SDsAYo013008 for ; Mon, 28 May 2018 09:54:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 875B92166BB6; Mon, 28 May 2018 13:54:10 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C6992166BB2 for ; Mon, 28 May 2018 13:54:10 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 28 May 2018 15:54:04 +0200 Message-Id: <4bf8bef4380b7dcea987cfbd3d0d45f087fee9f7.1527515594.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] conf: remove 'bootHash' from the post-parse infrastructure 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 28 May 2018 13:54:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Peter Krempa As the function signature of virDomainDefPostParseInternal does not differ from virDomainDefPostParse now, the wrapper can be dropped. Signed-off-by: Peter Krempa Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f087a3680f..6076424bc6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5010,8 +5010,7 @@ virDomainDefCheckBootOrder(virDomainDefPtr def) =20 static int virDomainDefPostParseCommon(virDomainDefPtr def, - struct virDomainDefPostParseDeviceIteratorData= *data, - virHashTablePtr bootHash ATTRIBUTE_UNUSED) + struct virDomainDefPostParseDeviceIteratorData= *data) { size_t i; =20 @@ -5118,13 +5117,12 @@ virDomainDefPostParseCheckFailure(virDomainDefPtr d= ef, } =20 =20 -static int -virDomainDefPostParseInternal(virDomainDefPtr def, - virCapsPtr caps, - unsigned int parseFlags, - virDomainXMLOptionPtr xmlopt, - void *parseOpaque, - virHashTablePtr bootHash) +int +virDomainDefPostParse(virDomainDefPtr def, + virCapsPtr caps, + unsigned int parseFlags, + virDomainXMLOptionPtr xmlopt, + void *parseOpaque) { int ret =3D -1; bool localParseOpaque =3D false; @@ -5180,7 +5178,7 @@ virDomainDefPostParseInternal(virDomainDefPtr def, if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0) goto cleanup; =20 - if ((ret =3D virDomainDefPostParseCommon(def, &data, bootHash)) < 0) + if ((ret =3D virDomainDefPostParseCommon(def, &data)) < 0) goto cleanup; =20 if (xmlopt->config.assignAddressesCallback) { @@ -5207,18 +5205,6 @@ virDomainDefPostParseInternal(virDomainDefPtr def, } =20 =20 -int -virDomainDefPostParse(virDomainDefPtr def, - virCapsPtr caps, - unsigned int parseFlags, - virDomainXMLOptionPtr xmlopt, - void *parseOpaque) -{ - return virDomainDefPostParseInternal(def, caps, parseFlags, xmlopt, - parseOpaque, NULL); -} - - /** * virDomainDiskAddressDiskBusCompatibility: * @bus: disk bus type @@ -20562,8 +20548,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; =20 /* callback to fill driver specific domain aspects */ - if (virDomainDefPostParseInternal(def, caps, flags, xmlopt, parseOpaqu= e, - bootHash) < 0) + if (virDomainDefPostParse(def, caps, flags, xmlopt, parseOpaque) < 0) goto error; =20 /* valdiate configuration */ --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 13:45:09 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 1527515667947820.7418939831742; Mon, 28 May 2018 06:54:27 -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 C55B6C0AD420; Mon, 28 May 2018 13:54:25 +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 79F041001951; Mon, 28 May 2018 13:54:25 +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 11B2C4CA87; Mon, 28 May 2018 13:54:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4SDsBCX013013 for ; Mon, 28 May 2018 09:54:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 46A392166BB6; Mon, 28 May 2018 13:54:11 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C27922166BB2 for ; Mon, 28 May 2018 13:54:10 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 28 May 2018 15:54:05 +0200 Message-Id: <9c988a510051d8638620ba6292fad60cea4f2275.1527515594.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] conf: remove 'bootHash' completely 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.31]); Mon, 28 May 2018 13:54:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Its only use is now to check for duplicate boot order values, which is now also done in virDomainDefPostParseCommon. Remove it completely. Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 89 ++++++++++++++++++----------------------------= ---- 1 file changed, 31 insertions(+), 58 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6076424bc6..c150b7d7d4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6587,8 +6587,7 @@ virDomainDeviceUSBMasterParseXML(xmlNodePtr node, =20 static int virDomainDeviceBootParseXML(xmlNodePtr node, - virDomainDeviceInfoPtr info, - virHashTablePtr bootHash) + virDomainDeviceInfoPtr info) { char *order; char *loadparm =3D NULL; @@ -6608,18 +6607,6 @@ virDomainDeviceBootParseXML(xmlNodePtr node, goto cleanup; } =20 - if (bootHash) { - if (virHashLookup(bootHash, order)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("boot order '%s' used for more than one devic= e"), - order); - goto cleanup; - } - - if (virHashAddEntry(bootHash, order, (void *) 1) < 0) - goto cleanup; - } - loadparm =3D virXMLPropString(node, "loadparm"); if (loadparm) { if (virStringToUpper(&info->loadparm, loadparm) !=3D 1) { @@ -6817,7 +6804,6 @@ virDomainDeviceAliasIsUserAlias(const char *aliasStr) static int virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED, xmlNodePtr node, - virHashTablePtr bootHash, virDomainDeviceInfoPtr info, unsigned int flags) { @@ -6877,7 +6863,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xml= opt ATTRIBUTE_UNUSED, } =20 if (boot) { - if (virDomainDeviceBootParseXML(boot, info, bootHash)) + if (virDomainDeviceBootParseXML(boot, info)) goto cleanup; } =20 @@ -9402,7 +9388,6 @@ static virDomainDiskDefPtr virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr node, xmlXPathContextPtr ctxt, - virHashTablePtr bootHash, virSecurityLabelDefPtr* vmSeclabels, int nvmSeclabels, unsigned int flags) @@ -9769,7 +9754,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, } def->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; } else { - if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info, + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW= _BOOT) < 0) goto error; } @@ -10260,7 +10245,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPt= r xmlopt, if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB && def->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { VIR_DEBUG("Ignoring device address for none model usb controller"); - } else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, + } else if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) { goto error; } @@ -10648,7 +10633,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, def->dst =3D target; target =3D NULL; =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 cleanup: @@ -10938,7 +10923,6 @@ static virDomainNetDefPtr virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr node, xmlXPathContextPtr ctxt, - virHashTablePtr bootHash, char *prefix, unsigned int flags) { @@ -11226,7 +11210,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, } def->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; } else { - if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info, + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW= _BOOT | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) = < 0) goto error; @@ -12525,7 +12509,7 @@ virDomainChrDefParseXML(virDomainXMLOptionPtr xmlop= t, if (def->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && def->targetType =3D=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD= ) { VIR_DEBUG("Ignoring device address for gustfwd channel"); - } else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, + } else if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) { goto error; } @@ -12663,7 +12647,7 @@ virDomainSmartcardDefParseXML(virDomainXMLOptionPtr= xmlopt, goto error; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; if (def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) { @@ -12764,7 +12748,7 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlop= t, goto error; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 cleanup: @@ -12793,7 +12777,7 @@ virDomainPanicDefParseXML(virDomainXMLOptionPtr xml= opt, if (VIR_ALLOC(panic) < 0) return NULL; =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, + if (virDomainDeviceInfoParseXML(xmlopt, node, &panic->info, flags) < 0) goto error; =20 @@ -12929,7 +12913,7 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xml= opt, } } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 if (def->bus =3D=3D VIR_DOMAIN_INPUT_BUS_USB && @@ -12993,7 +12977,7 @@ virDomainHubDefParseXML(virDomainXMLOptionPtr xmlop= t, goto error; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 cleanup: @@ -14150,7 +14134,7 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xml= opt, } } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 cleanup: @@ -14204,7 +14188,7 @@ virDomainWatchdogDefParseXML(virDomainXMLOptionPtr = xmlopt, } } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 cleanup: @@ -14316,7 +14300,7 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlop= t, break; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt), @@ -14386,7 +14370,7 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPt= r xmlopt, =20 if (def->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_NONE) VIR_DEBUG("Ignoring device address for none model Memballoon"); - else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, + else if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 @@ -14417,7 +14401,7 @@ virDomainNVRAMDefParseXML(virDomainXMLOptionPtr xml= opt, if (VIR_ALLOC(def) < 0) return NULL; =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 return def; @@ -14513,7 +14497,7 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xml= opt, goto cleanup; } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto cleanup; =20 =20 @@ -15167,7 +15151,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xml= opt, } } =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)= < 0) + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 def->driver =3D virDomainVideoDriverDefParseXML(node); @@ -15194,7 +15178,6 @@ static virDomainHostdevDefPtr virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr node, xmlXPathContextPtr ctxt, - virHashTablePtr bootHash, unsigned int flags) { virDomainHostdevDefPtr def; @@ -15235,7 +15218,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr x= mlopt, } =20 if (def->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { - if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, def->info, + if (virDomainDeviceInfoParseXML(xmlopt, node, def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLO= W_BOOT | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) = < 0) goto error; @@ -15275,7 +15258,6 @@ static virDomainRedirdevDefPtr virDomainRedirdevDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr node, xmlXPathContextPtr ctxt, - virHashTablePtr bootHash, unsigned int flags) { xmlNodePtr cur; @@ -15322,7 +15304,7 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr = xmlopt, if (def->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_SPICEVMC) def->source->data.spicevmc =3D VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; =20 - if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info, + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOO= T) < 0) goto error; =20 @@ -15801,7 +15783,7 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr xm= lopt, goto error; =20 if (virDomainDeviceInfoParseXML(xmlopt, memdevNode, - NULL, &def->info, flags) < 0) + &def->info, flags) < 0) goto error; =20 ctxt->node =3D save; @@ -15931,7 +15913,7 @@ virDomainDeviceDefParse(const char *xmlStr, switch ((virDomainDeviceType) dev->type) { case VIR_DOMAIN_DEVICE_DISK: if (!(dev->data.disk =3D virDomainDiskDefParseXML(xmlopt, node, ct= xt, - NULL, def->seclabe= ls, + def->seclabels, def->nseclabels, flags))) goto error; @@ -15947,7 +15929,7 @@ virDomainDeviceDefParse(const char *xmlStr, case VIR_DOMAIN_DEVICE_NET: netprefix =3D caps->host.netprefix; if (!(dev->data.net =3D virDomainNetDefParseXML(xmlopt, node, ctxt, - NULL, netprefix, fla= gs))) + netprefix, flags))) goto error; break; case VIR_DOMAIN_DEVICE_INPUT: @@ -15972,7 +15954,7 @@ virDomainDeviceDefParse(const char *xmlStr, break; case VIR_DOMAIN_DEVICE_HOSTDEV: if (!(dev->data.hostdev =3D virDomainHostdevDefParseXML(xmlopt, no= de, - ctxt, NULL, + ctxt, flags))) goto error; break; @@ -15991,7 +15973,7 @@ virDomainDeviceDefParse(const char *xmlStr, break; case VIR_DOMAIN_DEVICE_REDIRDEV: if (!(dev->data.redirdev =3D virDomainRedirdevDefParseXML(xmlopt, = node, - ctxt, NULL= , flags))) + ctxt, flag= s))) goto error; break; case VIR_DOMAIN_DEVICE_RNG: @@ -16098,7 +16080,7 @@ virDomainDiskDefParse(const char *xmlStr, } =20 disk =3D virDomainDiskDefParseXML(xmlopt, ctxt->node, ctxt, - NULL, seclabels, nseclabels, flags); + seclabels, nseclabels, flags); =20 cleanup: xmlFreeDoc(xml); @@ -18478,8 +18460,7 @@ virDomainVcpuParse(virDomainDefPtr def, =20 static int virDomainDefParseBootOptions(virDomainDefPtr def, - xmlXPathContextPtr ctxt, - virHashTablePtr *bootHash) + xmlXPathContextPtr ctxt) { xmlNodePtr *nodes =3D NULL; char *tmp =3D NULL; @@ -18611,8 +18592,6 @@ virDomainDefParseBootOptions(virDomainDefPtr def, =20 if (virDomainDefParseBootXML(ctxt, def) < 0) goto error; - if (!(*bootHash =3D virHashCreate(5, NULL))) - goto error; } =20 ret =3D 0; @@ -18829,7 +18808,6 @@ virDomainDefParseXML(xmlDocPtr xml, long id =3D -1; virDomainDefPtr def; bool uuid_generated =3D false; - virHashTablePtr bootHash =3D NULL; bool usb_none =3D false; bool usb_other =3D false; bool usb_master =3D false; @@ -19874,7 +19852,7 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); =20 - if (virDomainDefParseBootOptions(def, ctxt, &bootHash) < 0) + if (virDomainDefParseBootOptions(def, ctxt) < 0) goto error; =20 /* analysis of the disk devices */ @@ -19888,7 +19866,6 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainDiskDefPtr disk =3D virDomainDiskDefParseXML(xmlopt, nodes[i], ctxt, - bootHash, def->seclabels, def->nseclabel= s, flags); @@ -19995,7 +19972,6 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainNetDefPtr net =3D virDomainNetDefParseXML(xmlopt, nodes[i], ctxt, - bootHash, netprefix, flags); if (!net) @@ -20237,7 +20213,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainHostdevDefPtr hostdev; =20 hostdev =3D virDomainHostdevDefParseXML(xmlopt, nodes[i], ctxt, - bootHash, flags); + flags); if (!hostdev) goto error; =20 @@ -20381,7 +20357,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; for (i =3D 0; i < n; i++) { virDomainRedirdevDefPtr redirdev =3D - virDomainRedirdevDefParseXML(xmlopt, nodes[i], ctxt, bootHash,= flags); + virDomainRedirdevDefParseXML(xmlopt, nodes[i], ctxt, flags); if (!redirdev) goto error; =20 @@ -20555,14 +20531,11 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainDefValidate(def, caps, flags, xmlopt) < 0) goto error; =20 - virHashFree(bootHash); - return def; =20 error: VIR_FREE(tmp); VIR_FREE(nodes); - virHashFree(bootHash); virDomainDefFree(def); return NULL; } --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list