conf, qemu, security, tests: introducing 'def->tpms' array

A TPM Proxy device can coexist with a regular TPM, but the
current domain definition supports only a single TPM device
in the 'tpm' pointer. This patch replaces this existing pointer
in the domain definition to an array of TPM devices.

All files that references the old pointer were adapted to
handle the new array instead. virDomainDefParseXML() TPM related
code was adapted to handle the parsing of an extra TPM device.
TPM validations after this new scenario will be updated in
the next patch.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Daniel Henrique Barboza
2020-06-10 15:11:47 -03:00
committed by Ján Tomko
parent db45fb49e8
commit 19d74fdf0e
14 changed files with 186 additions and 96 deletions

View File

@@ -437,12 +437,13 @@ testCompareXMLToArgvCreateArgs(virQEMUDriverPtr drv,
vsockPriv->vhostfd = 6789;
}
if (vm->def->tpm) {
if (vm->def->tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR) {
VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path);
vm->def->tpm->data.emulator.source.data.file.path = g_strdup("/dev/test");
vm->def->tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_FILE;
}
for (i = 0; i < vm->def->ntpms; i++) {
if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
continue;
VIR_FREE(vm->def->tpms[i]->data.emulator.source.data.file.path);
vm->def->tpms[i]->data.emulator.source.data.file.path = g_strdup("/dev/test");
vm->def->tpms[i]->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_FILE;
}
for (i = 0; i < vm->def->nvideos; i++) {