]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Read back the profile name after creation of a TPM instance
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 13 Nov 2024 17:39:51 +0000 (12:39 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Nov 2024 07:46:49 +0000 (08:46 +0100)
commitd79542eec669eb9c449bb8228179e7a87e768017
tree965c427ba90c6cdeb5b9f1ba2086c6979ad3fbbe
parent957bda01c867a538dfbd720415bc600b681e7cbf
qemu: Read back the profile name after creation of a TPM instance

Get the JSON profile that the swtpm instance was created with from the
output of 'swtpm socket --tpm2 --print-info 0x20 --tpmstate ...'. Get the
name of the profile from the JSON and set it in the current and persistent
emulator descriptions as 'name' attribute and have the persistent
description stored with this update. The user should avoid setting this
'name' attribute since it is meant to be read-only. The following is
an example of how the XML could look like:

  <profile source='local:restricted' name='custom:restricted'/>

If the user provided no profile node, and therefore swtpm_setup picked its
default profile, the XML may now shows the 'name' attribute with the name
of the profile. This makes the 'source' attribute now optional.

  <profile name='default-v1'/>

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/formatdomain.rst
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/schemas/domaincommon.rng
src/qemu/qemu_extdevice.c
src/qemu/qemu_tpm.c
src/qemu/qemu_tpm.h
src/util/virtpm.c
src/util/virtpm.h
tests/qemuxmlconfdata/tpm-emulator-crb-profile.xml