]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Move setting of TPM default to post parse function
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 9 Jul 2020 20:46:18 +0000 (16:46 -0400)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 15 Jul 2020 06:23:28 +0000 (08:23 +0200)
Move setting the TPM default version out of the validation function into
the post parse function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_validate.c

index 10d2033db1b3a6f3e1dc408995b48cf997f11c7f..44e832f57e765c72131d4f3f140cb313b732e5ad 100644 (file)
@@ -4111,12 +4111,13 @@ qemuDomainDefTPMsPostParse(virDomainDefPtr def)
     virDomainTPMDefPtr regularTPM = NULL;
     size_t i;
 
-    if (def->ntpms < 2)
-        return 0;
-
     for (i = 0; i < def->ntpms; i++) {
         virDomainTPMDefPtr tpm = def->tpms[i];
 
+        /* TPM 1.2 and 2 are not compatible, so we choose a specific version here */
+        if (tpm->version == VIR_DOMAIN_TPM_VERSION_DEFAULT)
+            tpm->version = VIR_DOMAIN_TPM_VERSION_1_2;
+
         if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) {
             if (proxyTPM) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
index bd7590a00a92c385dc25906c4607bd72391df0e0..d130b52bf29237733967ca7a78bb0f3671891d82 100644 (file)
@@ -3644,10 +3644,6 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm,
 {
     virQEMUCapsFlags flag;
 
-    /* TPM 1.2 and 2 are not compatible, so we choose a specific version here */
-    if (tpm->version == VIR_DOMAIN_TPM_VERSION_DEFAULT)
-        tpm->version = VIR_DOMAIN_TPM_VERSION_1_2;
-
     switch (tpm->version) {
     case VIR_DOMAIN_TPM_VERSION_1_2:
         /* TPM 1.2 + CRB do not work */