[libvirt] [PATCH v8 15/18] qemu: Validate chosen TPM model rather than overwriting it

Ján Tomko jtomko at redhat.com
Sat Jun 2 13:38:01 UTC 2018


On Thu, May 24, 2018 at 04:26:11PM -0400, Stefan Berger wrote:
>TPM 1.2 does not support a CRB interface but only TIS. So, in
>this case we need to alert the user and request a change to the
>XML rather than silently overwriting it.
>
>Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>---
> src/conf/domain_conf.c | 15 ---------------
> src/qemu/qemu_domain.c | 28 +++++++++++++++++++++++++++-
> 2 files changed, 27 insertions(+), 16 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index d67ccbbf11..0b244b2eac 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -12727,21 +12727,6 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
>         def->version = VIR_DOMAIN_TPM_VERSION_1_2;
>     else
>         def->version = virDomainTPMVersionTypeFromString(version);
>-    switch (def->version) {
>-    case VIR_DOMAIN_TPM_VERSION_1_2:
>-        /* only TIS available for emulator */
>-        if (def->type == VIR_DOMAIN_TPM_TYPE_EMULATOR)
>-            def->model = VIR_DOMAIN_TPM_MODEL_TIS;
>-        break;
>-    case VIR_DOMAIN_TPM_VERSION_2:
>-        break;
>-    case VIR_DOMAIN_TPM_VERSION_LAST:
>-    default:
>-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>-                       _("Unsupported TPM version '%s'"),
>-                       version);
>-        goto error;
>-    }

Deleting code newly added in the series feels strange. It should not
have been added in the first place.

>
>     switch (def->type) {
>     case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:

For the rest:

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180602/cb927c23/attachment-0001.sig>


More information about the libvir-list mailing list