From nobody Sun Feb 8 18:44:08 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=1644491643; cv=none; d=zohomail.com; s=zohoarc; b=S4D6iBV+5+bhV1/k4uWaLQugtrnNCKhHUCoLW474qJbIcEviCpXgzMHZFHSQ1GYgWdTeA7BenplAqiCxifuXq0crH9uvoR3By/7AKNGF2gvWX99Dx3s7L2mEtu7IHzXQTfWNz5kh15j0IW4BiInYmk/VTps8Ok+eUkSV7wZ6Pj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644491643; 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=auoGXS/QpcP+QMr6WrmW8UNuMbWz6a8cuMIsfbUMZ3o=; b=IRKxmg24zhHH6ug0r9cGjdtH6cwubjmDCHHFVoFHj5P86QW0gDMyFVqM3P+U7LpwX1X4X0RYO4YKVQotjTc1gWhmq3CoWeXqpZN7v2JBSjxkZSoDoGBZqaeU28WFBZ5RyAzoEx/ijkINhW8Nc8bKwkoRaXVpcUaS4HAmis70F0Y= 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 1644491643498110.20357333622758; Thu, 10 Feb 2022 03:14:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-Vxnnt3HTPVacaahs1j6sZA-1; Thu, 10 Feb 2022 06:13:59 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62751343CC; Thu, 10 Feb 2022 11:13:53 +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 80C7A60C5A; Thu, 10 Feb 2022 11:13:51 +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 02B564BB7C; Thu, 10 Feb 2022 11:13:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ABDk8I018770 for ; Thu, 10 Feb 2022 06:13:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7B8410589DD; Thu, 10 Feb 2022 11:13:46 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 327B310589DA for ; Thu, 10 Feb 2022 11:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644491642; 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=auoGXS/QpcP+QMr6WrmW8UNuMbWz6a8cuMIsfbUMZ3o=; b=DNJL1XQn7k3VshWr+OtT1keeKqs8yn2ajNNynf0Td68WF4yz0L5HKw0+SZYnA56GlpeeAn 6YfMEb2szfNMBeKK0jNOEUkRda5BgNC2MZcU8cNqQTj/cnc7lCMlNNXSv16k6zBqF5GeRG 0kyHAi6Atl/Vcu+ZIZ9IAkIYf2vcfG4= X-MC-Unique: Vxnnt3HTPVacaahs1j6sZA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/5] qemuFirmwareFillDomain: Use FW descriptors to lookup template when resetting NVRAM Date: Thu, 10 Feb 2022 12:13:23 +0100 Message-Id: <697a6a9e90ff75f531f9197c1d0f6a2001aa3fcc.1644491535.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1644491644224100003 Content-Type: text/plain; charset="utf-8" If VIR_QEMU_PROCESS_START_RESET_NVRAM flag is passed when starting a domain, then user requested to overwrite the domain specific NVRAM with the one from template. But it is very likely that the path to the template is not stored in the domain definition, which in turn makes the copy function (qemuPrepareNVRAM()) fail. The solution is simple - when preparing domain, specifically when deciding whether the path to the template should be autofilled, ignore any existing NVRAM file. Signed-off-by: Michal Privoznik --- src/qemu/qemu_firmware.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 84c80eaacb..ff364996b8 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1297,6 +1297,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, ssize_t nfirmwares =3D 0; const qemuFirmware *theone =3D NULL; bool needResult =3D true; + const bool reset_nvram =3D flags & VIR_QEMU_PROCESS_START_RESET_NVRAM; size_t i; int ret =3D -1; =20 @@ -1309,7 +1310,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, * specified and the varstore doesn't exist ... */ if (!virDomainDefHasOldStyleROUEFI(def) || def->os.loader->templt || - virFileExists(def->os.loader->nvram)) + (!reset_nvram && virFileExists(def->os.loader->nvram))) return 0; =20 /* ... then we want to consult JSON FW descriptors first, --=20 2.34.1