From nobody Sun Feb 8 18:33:17 2026 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 1551950995926456.07773316972714; Thu, 7 Mar 2019 01:29:55 -0800 (PST) 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 1CB5180461; Thu, 7 Mar 2019 09:29: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 EF6A55ED53; Thu, 7 Mar 2019 09:29:53 +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 A624F181A135; Thu, 7 Mar 2019 09:29:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x279TYh2009325 for ; Thu, 7 Mar 2019 04:29:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 50B085C646; Thu, 7 Mar 2019 09:29:34 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A01605C5FD; Thu, 7 Mar 2019 09:29:33 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 7 Mar 2019 10:29:14 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: lersek@redhat.com Subject: [libvirt] [PATCH v2 04/15] virDomainLoaderDefParseXML: Allow loader path to be NULL 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-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.28]); Thu, 07 Mar 2019 09:29:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Except not really. At least for now. In the future, the firmware will be selected automagically. Therefore, it makes no sense to require the pathname of a specific firmware binary in the domain XML. But since it is not implemented do not really allow the path to be NULL. Only move code around to prepare it for further expansion. Signed-off-by: Michal Privoznik Reviewed-by: Laszlo Ersek Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/schemas/domaincommon.rng | 4 +++- src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 80f9f84f70..c8d63c4912 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,7 +283,9 @@ - + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eb660f5764..053b2cb210 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6590,6 +6590,22 @@ virDomainDefMemtuneValidate(const virDomainDef *def) } =20 =20 +static int +virDomainDefOSValidate(const virDomainDef *def) +{ + if (!def->os.loader) + return 0; + + if (!def->os.loader->path) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("no loader path specified")); + return -1; + } + + return 0; +} + + static int virDomainDefValidateInternal(const virDomainDef *def) { @@ -6628,6 +6644,9 @@ virDomainDefValidateInternal(const virDomainDef *def) if (virDomainDefMemtuneValidate(def) < 0) return -1; =20 + if (virDomainDefOSValidate(def) < 0) + return -1; + return 0; } =20 @@ -18246,6 +18265,9 @@ virDomainLoaderDefParseXML(xmlNodePtr node, type_str =3D virXMLPropString(node, "type"); loader->path =3D (char *) xmlNodeGetContent(node); =20 + if (STREQ_NULLABLE(loader->path, "")) + VIR_FREE(loader->path); + if (readonly_str && (loader->readonly =3D virTristateBoolTypeFromString(readonly_str))= <=3D 0) { virReportError(VIR_ERR_XML_DETAIL, @@ -26989,9 +27011,12 @@ virDomainLoaderDefFormat(virBufferPtr buf, if (loader->secure) virBufferAsprintf(buf, " secure=3D'%s'", secure); =20 - virBufferAsprintf(buf, " type=3D'%s'>", type); + virBufferAsprintf(buf, " type=3D'%s'", type); =20 - virBufferEscapeString(buf, "%s\n", loader->path); + if (loader->path) + virBufferEscapeString(buf, ">%s\n", loader->path); + else + virBufferAddLit(buf, "/>\n"); if (loader->nvram || loader->templt) { virBufferAddLit(buf, "templt); --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list