On 05/10/2018 05:57 PM, Stefan Berger wrote:
This patch adds support for an external swtpm TPM emulator. The XML
for
this type of TPM looks as follows:
<tpm model='tpm-tis'>
<backend type='emulator'/>
</tpm>
The XML will currently only define a TPM 1.2.
Extend the documentation.
Add a test case testing the XML parser and formatter.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
---
docs/formatdomain.html.in | 30 +++++++++++++++++++++++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_audit.c | 2 ++
src/conf/domain_conf.c | 28 +++++++++++++++++++------
src/conf/domain_conf.h | 7 +++++++
src/qemu/qemu_cgroup.c | 1 +
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_domain.c | 1 +
src/security/security_dac.c | 2 ++
src/security/security_selinux.c | 2 ++
tests/qemuxml2argvdata/tpm-emulator.xml | 30 +++++++++++++++++++++++++++
tests/qemuxml2xmloutdata/tpm-emulator.xml | 34 +++++++++++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
13 files changed, 138 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator.xml
Even though R-by in place...
[...]
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 15d228b..c304b08 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1286,6 +1286,7 @@ typedef enum {
typedef enum {
VIR_DOMAIN_TPM_TYPE_PASSTHROUGH,
+ VIR_DOMAIN_TPM_TYPE_EMULATOR,
VIR_DOMAIN_TPM_TYPE_LAST
} virDomainTPMBackendType;
@@ -1300,6 +1301,11 @@ struct _virDomainTPMDef {
struct {
virDomainChrSourceDef source;
} passthrough;
+ struct {
+ virDomainChrSourceDef source;
+ char *storagepath;
+ char *logfile;
+ } emulator;
} data;
};
@@ -2814,6 +2820,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
int type);
virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
void virDomainTPMDefFree(virDomainTPMDefPtr def);
+void virDomainTPMDelete(virDomainDefPtr def);
No longer an API - so this can be removed.
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
[...]
John