From 08ec545b6cdfdba7ee38e97da924ff7c021a98f1 Mon Sep 17 00:00:00 2001 From: Franciszek Przewozny Date: Fri, 4 Apr 2025 14:36:36 +0200 Subject: [PATCH] Fix vTPM metadefs. According to the Nova documentation[1], valid tpm_model properties are: tpm-tis and tpm-crb, not TIS and CRB. This patch fixes the misalignment and also adds missing tpm_version property. [1]https://docs.openstack.org/nova/latest/admin/emulated-tpm.html Closes-Bug: #2106223 Change-Id: I698dbd2946555c0a6455b1be17a6bf4a8d407ee7 (cherry picked from commit df5f2b3c8693ce288209e86bee656e7f9c7b9566) --- etc/metadefs/compute-vtpm-hw.json | 18 ++++++++++++++---- glance/tests/functional/db/base_metadef.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/etc/metadefs/compute-vtpm-hw.json b/etc/metadefs/compute-vtpm-hw.json index 0a4f060269..5d3f72fef4 100644 --- a/etc/metadefs/compute-vtpm-hw.json +++ b/etc/metadefs/compute-vtpm-hw.json @@ -17,14 +17,24 @@ "properties": { "tpm_model": { "title": "TPM model", - "description": "TPM model to use. Option CRB is only valid for TPM version 2.0. Defaults to TIS.", + "description": "TPM model to use. Option tpm-crb is only valid for TPM version 2.0. Defaults to tpm-tis.", "operators": [""], "type": "string", "enum": [ - "TIS", - "CRB" + "tpm-tis", + "tpm-crb" ], - "default": "TIS" + "default": "tpm-tis" + }, + "tpm_version": { + "title": "TPM version", + "description": "TPM version to use. Required if requesting a vTPM. Model tpm-tis supports both, tpm-crb supports only 2.0.", + "operators": [""], + "type": "string", + "enum": [ + "1.2", + "2.0" + ] } }, "objects": [] diff --git a/glance/tests/functional/db/base_metadef.py b/glance/tests/functional/db/base_metadef.py index 23dcd26173..c2982d0e1d 100644 --- a/glance/tests/functional/db/base_metadef.py +++ b/glance/tests/functional/db/base_metadef.py @@ -791,7 +791,7 @@ class MetadefLoadUnloadTests: 'OS::Glance::CommonImageProperties': 10, 'OS::Compute::GuestShutdownBehavior': 1, 'OS::Compute::VMwareFlavor': 2, - 'OS::Compute::TPM': 1, + 'OS::Compute::TPM': 2, 'OS::Compute::GuestMemoryBacking': 1, 'OS::Compute::LibvirtImage': 17, 'OS::Compute::VMware': 6,