qemu_tpm: Only warn about missing locking feature on shared filesystems

The warning pollutes the logs and might give a bad impression on someone
reading them even though the locking is not always needed.  This way we
at least limit the logging in unnecessary cases.

Resolves: https://issues.redhat.com/browse/RHEL-80155
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Martin Kletzander committed 2025-07-17 14:04:52 +02:00
1 parent 6c6b6b2b41
commit 3451987fca
1 file changed
+8 -4
+8 -4
View File
@@ -660,12 +660,16 @@ qemuTPMVirCommandSwtpmAddEncryption(virCommand *cmd,
static void static void
qemuTPMVirCommandSwtpmAddTPMState(virCommand *cmd, qemuTPMVirCommandSwtpmAddTPMState(virCommand *cmd,
const virDomainTPMEmulatorDef *emulator) const virDomainTPMEmulatorDef *emulator,
const virDomainTPMDef *tpmDef,
const virQEMUDriverConfig *cfg)
{ {
const char *lock = ",lock"; const char *lock = ",lock";
if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_TPMSTATE_OPT_LOCK)) { if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_TPMSTATE_OPT_LOCK)) {
VIR_WARN("This swtpm version doesn't support explicit locking"); if (qemuTPMHasSharedStorage(cfg, tpmDef))
VIR_WARN("This swtpm version doesn't support explicit locking");
lock = ""; lock = "";
} }
@@ -721,7 +725,7 @@ qemuTPMEmulatorUpdateProfileName(virDomainTPMEmulatorDef *emulator,
virCommandAddArgList(cmd, "socket", "--print-info", "0x20", "--tpm2", NULL); virCommandAddArgList(cmd, "socket", "--print-info", "0x20", "--tpm2", NULL);
qemuTPMVirCommandSwtpmAddTPMState(cmd, emulator); qemuTPMVirCommandSwtpmAddTPMState(cmd, emulator, persistentTPMDef, cfg);
if (qemuTPMVirCommandSwtpmAddEncryption(cmd, emulator, swtpm) < 0) if (qemuTPMVirCommandSwtpmAddEncryption(cmd, emulator, swtpm) < 0)
return -1; return -1;
@@ -848,7 +852,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
virCommandAddArgFormat(cmd, "type=unixio,path=%s,mode=0600", virCommandAddArgFormat(cmd, "type=unixio,path=%s,mode=0600",
tpm->data.emulator.source->data.nix.path); tpm->data.emulator.source->data.nix.path);
qemuTPMVirCommandSwtpmAddTPMState(cmd, &tpm->data.emulator); qemuTPMVirCommandSwtpmAddTPMState(cmd, &tpm->data.emulator, persistentTPMDef, cfg);
virCommandAddArg(cmd, "--log"); virCommandAddArg(cmd, "--log");
if (tpm->data.emulator.debug != 0) if (tpm->data.emulator.debug != 0)