]> git.proxmox.com Git - qemu-server.git/commitdiff
swtpm: enable logging
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 18 Jan 2023 12:21:08 +0000 (13:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 Feb 2023 11:53:25 +0000 (12:53 +0100)
AFAICT, previously, errors from swtpm would not show up in any logs,
because they were just printed to the stderr of the daemonized
invocation here.

The 'truncate' option is not used, so that the log is not immediately
lost when a new instance is started. This increases the chance that
the relevant errors are still present when requesting the log from a
user.

Log level 1 contains the most relevant errors and seems to be quiet
for working-as-expected invocations. Log level 2 already includes
logging full TPM commands, some of which are 1024 bytes long. Thus,
log level 1 was chosen.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index ff1e3c722d32ed45de5f7c0ba2628b8793c69874..5560168801d55213283506bec897fb94b082cd80 100644 (file)
@@ -3275,6 +3275,8 @@ sub start_swtpm {
        "file=$paths->{pid}",
        "--terminate", # terminate on QEMU disconnect
        "--daemon",
+       "--log",
+       "file=/run/qemu-server/$vmid-swtpm.log,level=1",
     ];
     push @$emulator_cmd, "--tpm2" if $tpm->{version} eq 'v2.0';
     run_command($emulator_cmd, outfunc => sub { print $1; });