From nobody Mon Feb 9 23:00:03 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=1656000943; cv=none; d=zohomail.com; s=zohoarc; b=mjUUUSm/4DqEcOEvV7JTTuzaH+w6HZg44oeOedWErQwfhjbgoQIcKlkHcASLf5N7knqJxxa4lpPwjUAD2DPFwNFToQb4pDKSnURQ8EWEraANTjWSFCUBXqA4qJPKp1YLsD3W6ru2DKoPbPPaRfMLsR4++ekkuJPUxZN9MUMcJgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656000943; 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=Vpaf+WC9utKYBpobSAPLMGt+S5sUFqInJx7ikCC4eQA=; b=I+Y+5Znv1mzJv7mRpoLcnWRCaGUO8IPFcKBu1Pf2vfw1TseWZglWYlDNOkjKho2fs+DnZdk0Lg2e7AECR7L5XTdhEEbE4jxJakEg2hqlbVsz9XeZoCoga0TcpezTLt/tFcjWJwrBYxV1YRzul7vzob1R07Kx4fssTgJYW2NZ764= 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 1656000943012141.89747293595815; Thu, 23 Jun 2022 09:15:43 -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-92-2lFELPPsN22Z1mGCBC28CA-1; Thu, 23 Jun 2022 12:15:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C3233C163FF; Thu, 23 Jun 2022 16:14:58 +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 EB1D51415113; Thu, 23 Jun 2022 16:14:57 +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 A276C194B960; Thu, 23 Jun 2022 16:14:57 +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 5A57D194B95A for ; Thu, 23 Jun 2022 16:14:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4AABB1121315; Thu, 23 Jun 2022 16:14:55 +0000 (UTC) Received: from harajuku.homenet.telecomitalia.it (unknown [10.40.194.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCC031121314 for ; Thu, 23 Jun 2022 16:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656000942; 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=Vpaf+WC9utKYBpobSAPLMGt+S5sUFqInJx7ikCC4eQA=; b=HNijTKyeQHcVrIXa6/gLbKkZd1iuqvBqCxDDxIekIM7Yb0ZfVWKN7rwHGtUMIRMenoRwZ6 RoAc3OjVVJcx7kHtqyhLLocQmCdaDeSV5BBUZ860I5GhIa/8sTMCPfVddM7opkQx3CuMR4 36X1WNFqVTsHQ2xXbwZWoAVc1Rz8sdw= X-MC-Unique: 2lFELPPsN22Z1mGCBC28CA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 16/28] conf: Always parse NVRAM path if present Date: Thu, 23 Jun 2022 18:14:28 +0200 Message-Id: <20220623161440.61653-17-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.85 on 10.11.54.7 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: 1656000943803100010 Content-Type: text/plain; charset="utf-8" Currently, the lack of a element results in the element being completely ignored, but this is unnecessarily limiting: even when firmware autoselection is in use, it should be possible for the user to specify a custom path for the NVRAM file. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 17 ++++++++++------- .../firmware-auto-efi-nvram.x86_64-latest.args | 2 +- .../firmware-auto-efi-nvram.x86_64-latest.xml | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 858242b3ae..9b82f391c4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18053,6 +18053,15 @@ virDomainLoaderDefParseXML(virDomainLoaderDef *loa= der, unsigned int flags, bool fwAutoSelect) { + if (virDomainLoaderDefParseXMLNvram(loader, + nvramNode, nvramSourceNode, + ctxt, xmlopt, flags, + fwAutoSelect) < 0) + return -1; + + if (!loaderNode) + return 0; + if (!fwAutoSelect) { if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NO= NE, &loader->readonly) < 0) @@ -18073,12 +18082,6 @@ virDomainLoaderDefParseXML(virDomainLoaderDef *loa= der, &loader->secure) < 0) return -1; =20 - if (virDomainLoaderDefParseXMLNvram(loader, - nvramNode, nvramSourceNode, - ctxt, xmlopt, flags, - fwAutoSelect) < 0) - return -1; - return 0; } =20 @@ -18477,7 +18480,7 @@ virDomainDefParseBootLoaderOptions(virDomainDef *de= f, 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) + if (!loaderNode && !nvramNode) return 0; =20 def->os.loader =3D g_new0(virDomainLoaderDef, 1); diff --git a/tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.a= rgs b/tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.args index 885c83445d..e37521b0a3 100644 --- a/tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.args +++ b/tests/qemuxml2argvdata/firmware-auto-efi-nvram.x86_64-latest.args @@ -12,7 +12,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-fedora/.config \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-fedora/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.secboot.= fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"= unmap"}' \ -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver"= :"raw","file":"libvirt-pflash0-storage"}' \ --blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/fedora= _VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"disc= ard":"unmap"}' \ +-blockdev '{"driver":"file","filename":"/path/to/fedora_VARS.fd","node-nam= e":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash1-storage"}' \ -machine pc-q35-4.0,usb=3Doff,smm=3Don,dump-guest-core=3Doff,pflash0=3Dlib= virt-pflash0-format,pflash1=3Dlibvirt-pflash1-format,memory-backend=3Dpc.ra= m \ -accel kvm \ diff --git a/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest.xml index 7e2e40036e..abd6ec079d 100644 --- a/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/firmware-auto-efi-nvram.x86_64-latest.xml @@ -6,6 +6,7 @@ 1 hvm + /path/to/fedora_VARS.fd --=20 2.35.3