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

Stefan Berger stefanb at linux.vnet.ibm.com
Mon Jun 4 12:52:25 UTC 2018


On 06/02/2018 09:38 AM, Ján Tomko wrote:
> 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:

If you don't mind, I will squash this into 10/18.

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





More information about the libvir-list mailing list