1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

conf: add support for 'debug' parameter on TPM emulator

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-07-04 12:08:55 +01:00
parent 9559130693
commit 5c77ecd5f3
5 changed files with 18 additions and 3 deletions

View File

@ -8097,7 +8097,7 @@ Example: usage of the TPM Emulator
...
<devices>
<tpm model='tpm-tis'>
<backend type='emulator' version='2.0'>
<backend type='emulator' version='2.0' debug='5'>
<encryption secret='6dd3e4a5-1d76-44ce-961f-f119f5aad935'/>
<active_pcr_banks>
<sha256/>
@ -8141,7 +8141,9 @@ Example: usage of the TPM Emulator
``emulator``
For this backend type the 'swtpm' TPM Emulator must be installed on the
host. Libvirt will automatically start an independent TPM emulator for
each QEMU guest requesting access to it.
each QEMU guest requesting access to it. :since:`10.6.0`, the ``debug``
parameter can be used to enable logging in the emulator backend, and
accepts non-zero integer values.
``version``
The ``version`` attribute indicates the version of the TPM. This attribute

View File

@ -10800,6 +10800,10 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt,
&def->data.emulator.version) < 0)
goto error;
if (virXMLPropUInt(backends[0], "debug", 10, VIR_XML_PROP_NONE,
&def->data.emulator.debug) < 0)
goto error;
if (!(def->data.emulator.source = virDomainChrSourceDefNew(xmlopt)))
goto error;
secretuuid = virXPathString("string(./backend/encryption/@secret)", ctxt);
@ -24882,6 +24886,9 @@ virDomainTPMDefFormat(virBuffer *buf,
}
if (def->data.emulator.persistent_state)
virBufferAddLit(&backendAttrBuf, " persistent_state='yes'");
if (def->data.emulator.debug != 0)
virBufferAsprintf(&backendAttrBuf, " debug='%u'",
def->data.emulator.debug);
if (def->data.emulator.hassecretuuid) {
char uuidstr[VIR_UUID_STRING_BUFLEN];

View File

@ -1476,6 +1476,7 @@ struct _virDomainTPMDef {
virDomainChrSourceDef *source;
char *storagepath;
char *logfile;
unsigned int debug;
unsigned char secretuuid[VIR_UUID_BUFLEN];
bool hassecretuuid;
bool persistent_state;

View File

@ -5914,6 +5914,11 @@
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="debug">
<ref name="uint8"/>
</attribute>
</optional>
</group>
<group>
<attribute name="type">

View File

@ -28,7 +28,7 @@
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<tpm model='tpm-tis'>
<backend type='emulator' version='2.0'>
<backend type='emulator' version='2.0' debug='3'>
<encryption secret='b4a117f1-8af2-44a4-91b8-7f0d2d4d68a3'/>
<active_pcr_banks>
<sha256/>