From nobody Thu Dec 18 02:26:19 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; 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 1527500246974350.7271248262325; Mon, 28 May 2018 02:37:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F300130C4CD6; Mon, 28 May 2018 09:37:24 +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 E0D52308BDA0; Mon, 28 May 2018 09:37:23 +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 308F04CA84; Mon, 28 May 2018 09:37:23 +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 w4S9b5A7008268 for ; Mon, 28 May 2018 05:37:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 122BC2026993; Mon, 28 May 2018 09:37:05 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DFAC202698A; Mon, 28 May 2018 09:37:04 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 28 May 2018 11:36:44 +0200 Message-Id: <8b4627fedd199117af1ab46f5562e3838679357e.1527500017.git.pkrempa@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 Cc: Peter Krempa Subject: [libvirt] [PATCH 1/4] conf: domain: Remove code accessing 'bootHash' from the post-parse infrestructure 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 28 May 2018 09:37:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There is only one block accessing it. Removing it is necessary so that post parse callbacks can later be invoked after the hypervisor private data callback so that e.g. qemuCaps are properly filled for the postparse callbacks. As the function signature of virDomainDefPostParseInternal does not differ from virDomainDefPostParse now, the wrapper can be dropped. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 62 +++++++++++++++++++---------------------------= ---- 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d6ac47c629..eead28f5fb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4941,8 +4941,7 @@ virDomainDefPostParseCPU(virDomainDefPtr def) static int virDomainDefPostParseCommon(virDomainDefPtr def, - struct virDomainDefPostParseDeviceIteratorData= *data, - virHashTablePtr bootHash) + struct virDomainDefPostParseDeviceIteratorData= *data) { size_t i; @@ -4953,20 +4952,6 @@ virDomainDefPostParseCommon(virDomainDefPtr def, return -1; } - 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; @@ -5059,13 +5044,12 @@ virDomainDefPostParseCheckFailure(virDomainDefPtr d= ef, } -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; @@ -5121,7 +5105,7 @@ virDomainDefPostParseInternal(virDomainDefPtr def, if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0) goto cleanup; - if ((ret =3D virDomainDefPostParseCommon(def, &data, bootHash)) < 0) + if ((ret =3D virDomainDefPostParseCommon(def, &data)) < 0) goto cleanup; if (xmlopt->config.assignAddressesCallback) { @@ -5148,18 +5132,6 @@ virDomainDefPostParseInternal(virDomainDefPtr def, } -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 @@ -20502,9 +20474,23 @@ virDomainDefParseXML(xmlDocPtr xml, (def->ns.parse)(xml, root, ctxt, &def->namespaceData) < 0) goto error; + /* Fill in default boot device if none was present */ + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { + 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 error; + } + + 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; + } + } + /* 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; /* valdiate configuration */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list