From nobody Fri Apr 26 02:38:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1599586104; cv=none; d=zohomail.com; s=zohoarc; b=IUS3oZvuyM/fOVJ0ZnayNd4dEji8PRp2mzOc8sKZjE8VgNXymYtL70IM+SvZE1wQhmtSol4InkLTK+pJsWZzrJ08oBw4jWMgXwnJ5YurG7Ulcyg7lPnJ08jVY07LXESBaIr5+cFTP8jc2ly0hqv5523SVSqwmyD1sUlFYTNok6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599586104; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=1vnWKcTaQp5JXwHykznk/MsE2jzLaVC1INwAnHSC/Ro=; b=X4ZP0dmSCPRat9T4rl6gs+d5ftVuF9gMCWxPOqPMHexvgYi3Tooe7aWWgfo4PPh9VJmo14qvU+QYCutexpHMasujlbfoe4pJSjpPFkgYCQkYJG9rBhDj9VaHgkM/E54qga6NvAgScAJl4luXRSKgC/i/pyJZoJ64e5R7lR9SPek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1599586104143250.21285488532828; Tue, 8 Sep 2020 10:28:24 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575-7Gj5ybKJNuy-n20kJWwpsw-1; Tue, 08 Sep 2020 13:28:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A369891418; Tue, 8 Sep 2020 17:28:09 +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 9CC3D7ED9C; Tue, 8 Sep 2020 17:28:08 +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 C12EC79FFE; Tue, 8 Sep 2020 17:28:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 088HS7Zk019750 for ; Tue, 8 Sep 2020 13:28:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id D628F4F9EA; Tue, 8 Sep 2020 17:28:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 040827A4D1 for ; Tue, 8 Sep 2020 17:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599586102; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1vnWKcTaQp5JXwHykznk/MsE2jzLaVC1INwAnHSC/Ro=; b=RY0yXJP3ukHz+B/x+KelwqEkq3CS0QhLrBrb95jT7DdDpHJdMwkBotRkqwGlewl9LSo+8Y CziJt3p73HOICy/QycMGzlcuKgBw5nqUiw4KfFQ2dEdQ8DIFWOm/pmS4pHVFDvDYfClqNe LUv4/tTNTD5YuyvGq0F7RNBX9afWIFE= X-MC-Unique: 7Gj5ybKJNuy-n20kJWwpsw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemuFirmwareFillDomain: Fill NVRAM template on migration too Date: Tue, 8 Sep 2020 19:28:03 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In 8e1804f9f66 I've tried to fix the following use case: domain is started with path to UEFI only and relies on libvirt to figure out corresponding NVRAM template to create a per-domain copy from. The fix consisted of having a check tailored exactly for this use case and if it's hit then using FW autoselection to figure it out. Unfortunately, the NVRAM template is not saved in the inactive XML (well, the domain might be transient anyway). Then, as a part of that check we see whether the per-domain copy doesn't exist already and if it does then no template is looked up hence no template will appear in the live XML. This works, until the domain is migrated. At the destination, the per-domain copy will not exist so we need to know the template to create the per-domain copy from. But we don't even get to the check because we are not starting a fresh new domain and thus the qemuFirmwareFillDomain() function quits early. The solution is to switch order of these two checks. That is evaluate the check for the old style before checking flags. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1852910 Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- src/qemu/qemu_firmware.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 2edc0efabb..ffe2df20aa 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1228,9 +1228,6 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, size_t i; int ret =3D -1; =20 - if (!(flags & VIR_QEMU_PROCESS_START_NEW)) - return 0; - /* Fill in FW paths if either os.firmware is enabled, or * loader path was provided with no nvram varstore. */ if (def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { @@ -1246,6 +1243,11 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, /* ... then we want to consult JSON FW descriptors first, * but we don't want to fail if we haven't found a match. */ needResult =3D false; + } else { + /* Domain has FW autoselection enabled =3D> do nothing if + * we are not starting it from scratch. */ + if (!(flags & VIR_QEMU_PROCESS_START_NEW)) + return 0; } =20 if ((nfirmwares =3D qemuFirmwareFetchParsedConfigs(driver->privileged, --=20 2.26.2