From nobody Mon Feb 9 01:48:51 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=1689930063; cv=none; d=zohomail.com; s=zohoarc; b=gfS3XkmEGA01GzfrEFxj/bETV2Q7gDsg+3xKDj4BtTIVoJE7pKrN+Zwua/7o4Thvv633pILndDEwe8M/ppFROXlQdtLqXHWE6x5itSSoaNXB7i6rlrhg8O0zR/C/S3adKVkk/EDU/VGwwGWizOe4nOUPQHYwGjO6a9k18YCNa4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689930063; 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=1PSa6TtzTNtw7zWjmc/cyDc2x2gFYLVKZAasIfLukGA=; b=gthKOVZf+yzOG+T8GUoKmW8ogHlhdwSig8dfTR2ACO74Inw9oVaaKC5d4DvRoNZCyqatYVvSqV+DydkXYtogFNQIGW+7rVn7fKuYL0mrQSo4z9mF+6G7KJDHcQtdd3ZSki2zJ97S4NhjyndWfviFLJQUWW7LHbvhc3nO3mpeHA4= 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 1689930063294265.64451534848433; Fri, 21 Jul 2023 02:01:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-659-s1Bpr1ThMvy3Y1STCyDcow-1; Fri, 21 Jul 2023 05:00:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 766573801BCC; Fri, 21 Jul 2023 09:00:38 +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 5CEEAC2C859; Fri, 21 Jul 2023 09:00:38 +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 0BC4D1946A45; Fri, 21 Jul 2023 09:00:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9056D1946A43 for ; Fri, 21 Jul 2023 09:00:35 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 822F64CD0E6; Fri, 21 Jul 2023 09:00:35 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29505492C13 for ; Fri, 21 Jul 2023 09:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689930062; 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=1PSa6TtzTNtw7zWjmc/cyDc2x2gFYLVKZAasIfLukGA=; b=ZKmLqclDoqEm6/dL8JYet2HR5q9waRBFni8biFpIvyeydkPL6YrutByhQpxd7cuUgRbtZm GS3Ybf6euHqC22nNyBCMQscbKaJvkGUHlBZXcu5k9CYZ6W+ZyKtfQ1HOeIae13B8b7UfMv bASmASpkp9mpwKzkWcR1U9DvdYNybfM= X-MC-Unique: s1Bpr1ThMvy3Y1STCyDcow-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu_tpm: Try harder to create emulator state Date: Fri, 21 Jul 2023 11:00:32 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 3.1 on 10.11.54.8 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: 1689930065379100001 Content-Type: text/plain; charset="utf-8"; x-default="true" If a per-domain SWTPM state directory exists but is empty our code still considers it a valid state and skips running 'swtpm_setup' (handled in qemuTPMEmulatorRunSetup()). While we should not try to inspect individual files created by swtpm, we can still consider empty folder as non-existent state. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/320 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_tpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 0b77ce2bc7..121f98174c 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -186,7 +186,8 @@ qemuTPMEmulatorCreateStorage(virDomainTPMDef *tpm, =20 *created =3D false; =20 - if (!virFileExists(storagepath)) + if (!virFileExists(storagepath) || + virDirIsEmpty(storagepath, false) > 0) *created =3D true; =20 if (virDirCreate(storagepath, 0700, swtpm_user, swtpm_group, --=20 2.41.0