From: Daniel P. Berrangé Date: Thu, 4 Jul 2024 11:08:55 +0000 (+0100) Subject: conf: add support for 'debug' parameter on TPM emulator X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5c77ecd5f3916ad53c5b99938d4bf609b922a47f;p=libvirt.git conf: add support for 'debug' parameter on TPM emulator Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 5c09b87d2b..fbd05e089d 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8097,7 +8097,7 @@ Example: usage of the TPM Emulator ... - + @@ -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 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7033b4e9fe..6080f4f90a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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]; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2818a9f1f5..1b9d07f1a4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -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; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 33e34255f4..b163e4eece 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -5914,6 +5914,11 @@ + + + + + diff --git a/tests/qemuxmlconfdata/tpm-emulator-tpm2.xml b/tests/qemuxmlconfdata/tpm-emulator-tpm2.xml index 79acde218b..8a613db456 100644 --- a/tests/qemuxmlconfdata/tpm-emulator-tpm2.xml +++ b/tests/qemuxmlconfdata/tpm-emulator-tpm2.xml @@ -28,7 +28,7 @@ - +