From nobody Fri Dec 19 17:36:05 2025 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=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1661169986; cv=none; d=zohomail.com; s=zohoarc; b=LJ+jaHkS85mwhFLV5lfVfA5GdpHDMcpfvsQwx6TAF4mzzJvQrSTUH6VVXvkG9D4QX3gz1ey7VoNfHAaTdsaLe6Oqm4tNsRP9tULRhZaLilN52PcbAG4DIF8E+kzC/pWUfavB0tf2KdPVBFtcKnswcxaJzXQNIswioPEH8dtfz+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661169986; h=Content-Type:Content-Transfer-Encoding:Cc: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=PDKNZmuRHLEK69EuEC6fY+ziJLEbis5p6EWsiwOmtN8=; b=BCGAzD6cR3FHpdCrYknlCBFYdscehOICvN/lU/fSf6zFRvVyE5UgpB/7jtBYwF5fzPZtOsTfrBE7vmDm4tnJxB8x9Dh3KbwFUWw31JJ/tiHkIR6oCVQZzFgi7PZWcKPrlEVyStFvkKXb0CYJ4ditQ1OrPpK0KpxbbIJhb24K0iE= 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=fail 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 1661169986249795.7739599923566; Mon, 22 Aug 2022 05:06:26 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-5ijnAQ9wOEex_3pfTTG2ZA-1; Mon, 22 Aug 2022 08:06:18 -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 193C2185A7A4; Mon, 22 Aug 2022 12:06:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49E5DC15BB3; Mon, 22 Aug 2022 12:06:14 +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 366C81946A6B; Mon, 22 Aug 2022 12:06:13 +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 247611946A44 for ; Mon, 22 Aug 2022 12:06:12 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 047B1492C3B; Mon, 22 Aug 2022 12:06:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00642403348 for ; Mon, 22 Aug 2022 12:06:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 942DE858EEE for ; Mon, 22 Aug 2022 12:06:11 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-99-CyjydcFaNqK1Yo22SJWboQ-1; Mon, 22 Aug 2022 08:06:09 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27MBwtIH020703 for ; Mon, 22 Aug 2022 12:06:09 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j49df08rg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Aug 2022 12:06:08 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27MBoU3B016773 for ; Mon, 22 Aug 2022 12:06:08 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01dal.us.ibm.com with ESMTP id 3j2q89qn3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Aug 2022 12:06:08 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27MC67Sd50069880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Aug 2022 12:06:07 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4F80AC05F; Mon, 22 Aug 2022 12:06:06 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDA07AC05B; Mon, 22 Aug 2022 12:06:06 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 22 Aug 2022 12:06:06 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661169985; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=PDKNZmuRHLEK69EuEC6fY+ziJLEbis5p6EWsiwOmtN8=; b=IxlUqMVqMCvR3wL8SwY/3Q1ujtgEir9znDS0gisH8C7X2QpF5AwSBmOAD8nwrfY44EJf4y gP0Il2B77/C5+IqiGt0xYWLPvVMnNmMs9jk66mF7gpz0fe0TL7pVWDHUSJNMmZnjUxciQr tvZDBHHYYLRqu8mKIOl97OnhXR4rGng= X-MC-Unique: 5ijnAQ9wOEex_3pfTTG2ZA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: CyjydcFaNqK1Yo22SJWboQ-1 From: Stefan Berger To: libvir-list@redhat.com Subject: [PATCH 3/7] qemu: tpm: Conditionally create storage on incoming migration Date: Mon, 22 Aug 2022 08:05:50 -0400 Message-Id: <20220822120554.3529999-4-stefanb@linux.ibm.com> In-Reply-To: <20220822120554.3529999-1-stefanb@linux.ibm.com> References: <20220822120554.3529999-1-stefanb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0OiNZeOCklZg0jZaq0r0uVOYdhe8qy40 X-Proofpoint-ORIG-GUID: 0OiNZeOCklZg0jZaq0r0uVOYdhe8qy40 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-22_06,2022-08-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 spamscore=0 mlxlogscore=750 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208220051 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 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: , Cc: Stefan Berger Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 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: 1661169988527100006 Content-Type: text/plain; charset="utf-8"; x-default="true" Add a shared_storage field to the emulator part of the virDomainTPMDef used for indicating whether shared storage for TPM state is setup between hosts. Do not create storage if shared_storage flag is set and there's an incoming migration since the storage directory in this case must already exist. As a consequence also do not run swtpm_setup in this case. Signed-off-by: Stefan Berger --- src/conf/domain_conf.h | 1 + src/qemu/qemu_tpm.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a1f6cf7a6f..29dc17a299 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1459,6 +1459,7 @@ struct _virDomainTPMDef { unsigned char secretuuid[VIR_UUID_BUFLEN]; bool hassecretuuid; bool persistent_state; + bool shared_storage; virBitmap *activePcrBanks; } emulator; } data; diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index d2ae3b9824..280307a14e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -562,11 +562,19 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm, int pwdfile_fd =3D -1; int migpwdfile_fd =3D -1; const unsigned char *secretuuid =3D NULL; + bool create_storage =3D true; =20 if (!swtpm) return NULL; =20 - if (qemuTPMEmulatorCreateStorage(tpm, &created, swtpm_user, swtpm_grou= p) < 0) + /* Do not create storage and run swtpm_setup on incoming migration over + * shared storage + */ + if (incomingMigration && tpm->data.emulator.shared_storage) + create_storage =3D false; + + if (create_storage && + qemuTPMEmulatorCreateStorage(tpm, &created, swtpm_user, swtpm_grou= p) < 0) return NULL; =20 if (tpm->data.emulator.hassecretuuid) --=20 2.37.1