From nobody Mon Feb 9 13:21:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656001031; cv=none; d=zohomail.com; s=zohoarc; b=Bf37qy4SJEd/L8F2ClmPb9cRUs2YtmR0SdHDHgzdntQUbT7HuXgG6WKBVyiO7+YMVDRuGUZ2crIV/aPf3lE2qhd6TT50liMeQT4PPDbexU6rEyB/FP54WNQIUfSAgSgRAxYMLs4m1ZHn7VIH/ncCJSPSCn5Q3UnUd/rseAtKJCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656001031; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W3crt6Yj0nHQ9yDQHHj8UH08M2E5QIPCimQ3CsAokao=; b=IqT1cvY0vfZ0kfg4ioEC8q1fIxaldbW8ItHqcJI3fPLY7uXgyFUDxHDiT9689uOpQCKxCemENGJ7Pw8mTJ0Een+pi9UOw0ImSlZLfDip/MFVZzmxQ+wvDVRT3MSxbM/sXT9FP+3zCPpBRs7SLksR7G1EKF/xv+CALN2J9lCZ7Qc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1656001031574933.0177176702921; Thu, 23 Jun 2022 09:17:11 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-367-Sis23KuSOuKQkR3ld_0hdg-1; Thu, 23 Jun 2022 12:15:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4BD3A1C18280; Thu, 23 Jun 2022 16:15:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1737040D0166; Thu, 23 Jun 2022 16:15:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E545B194B95B; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9443D194B959 for ; Thu, 23 Jun 2022 16:14:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 677781121315; Thu, 23 Jun 2022 16:14:58 +0000 (UTC) Received: from harajuku.homenet.telecomitalia.it (unknown [10.40.194.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E930F1121314 for ; Thu, 23 Jun 2022 16:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656001030; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=W3crt6Yj0nHQ9yDQHHj8UH08M2E5QIPCimQ3CsAokao=; b=YaK/EFl8OW2fI0kI258Pvwyn48bKRemo8vbVh5rqBsGgfY1PMxGAftwtWF/9UySP19ZMEG X6s+/VtveVwIbDpyIDgbuPcGVGQVi2pLvDUYrikEZ/Z5bdA+7tfx4pDxZRQARRtUvJvkSH QV+dNIjxOxZtJJfFDCFjoTxUCDdrVaE= X-MC-Unique: Sis23KuSOuKQkR3ld_0hdg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 20/28] conf: Always parse all firmware information Date: Thu, 23 Jun 2022 18:14:32 +0200 Message-Id: <20220623161440.61653-21-abologna@redhat.com> In-Reply-To: <20220623161440.61653-1-abologna@redhat.com> References: <20220623161440.61653-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656001032323100001 Content-Type: text/plain; charset="utf-8" Currently we're simply ignoring some elements and attributes, such as the loader path, when firmware autoselection is enabled because we know we're not going to use them. This makes sense, but has the unfortunate consequence of confusing users who experience part of their configuration simply going away for no apparent reason. A more user-friendly approach is to produce meaningful error messages in those scenarios. As a first step towards that goal, stop conditionally parsing information. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0c6504348c..7947b1f5e6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18018,8 +18018,7 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef = *loader, xmlNodePtr nvramSourceNode, xmlXPathContextPtr ctxt, virDomainXMLOption *xmlopt, - unsigned int flags, - bool fwAutoSelect) + unsigned int flags) { g_autoptr(virStorageSource) src =3D virStorageSourceNew(); int typePresent; @@ -18027,8 +18026,7 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef = *loader, if (!nvramNode) return 0; =20 - if (!fwAutoSelect) - loader->nvramTemplate =3D virXMLPropString(nvramNode, "template"); + loader->nvramTemplate =3D virXMLPropString(nvramNode, "template"); =20 src->format =3D VIR_STORAGE_FILE_RAW; =20 @@ -18070,33 +18068,29 @@ virDomainLoaderDefParseXML(virDomainLoaderDef *lo= ader, xmlNodePtr nvramSourceNode, xmlXPathContextPtr ctxt, virDomainXMLOption *xmlopt, - unsigned int flags, - bool fwAutoSelect) + unsigned int flags) { if (virDomainLoaderDefParseXMLNvram(loader, nvramNode, nvramSourceNode, - ctxt, xmlopt, flags, - fwAutoSelect) < 0) + ctxt, xmlopt, flags) < 0) return -1; =20 if (!loaderNode) return 0; =20 - if (!fwAutoSelect) { - if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NO= NE, - &loader->readonly) < 0) - return -1; + if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NONE, + &loader->readonly) < 0) + return -1; =20 - if (virXMLPropEnum(loaderNode, "type", virDomainLoaderTypeFromStri= ng, - VIR_XML_PROP_NONZERO, &loader->type) < 0) - return -1; + if (virXMLPropEnum(loaderNode, "type", virDomainLoaderTypeFromString, + VIR_XML_PROP_NONZERO, &loader->type) < 0) + return -1; =20 - if (!(loader->path =3D virXMLNodeContentString(loaderNode))) - return -1; + if (!(loader->path =3D virXMLNodeContentString(loaderNode))) + return -1; =20 - if (STREQ(loader->path, "")) - VIR_FREE(loader->path); - } + if (STREQ(loader->path, "")) + VIR_FREE(loader->path); =20 if (virXMLPropTristateBool(loaderNode, "secure", VIR_XML_PROP_NONE, &loader->secure) < 0) @@ -18498,7 +18492,6 @@ virDomainDefParseBootLoaderOptions(virDomainDef *de= f, xmlNodePtr loaderNode =3D virXPathNode("./os/loader[1]", ctxt); xmlNodePtr nvramNode =3D virXPathNode("./os/nvram[1]", ctxt); xmlNodePtr nvramSourceNode =3D virXPathNode("./os/nvram/source[1]", ct= xt); - const bool fwAutoSelect =3D def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FI= RMWARE_NONE; =20 if (!loaderNode && !nvramNode) return 0; @@ -18507,8 +18500,7 @@ virDomainDefParseBootLoaderOptions(virDomainDef *de= f, =20 if (virDomainLoaderDefParseXML(def->os.loader, loaderNode, nvramNode, nvramSourceNode, - ctxt, xmlopt, flags, - fwAutoSelect) < 0) + ctxt, xmlopt, flags) < 0) return -1; =20 return 0; --=20 2.35.3