[virt-tools-list] [virt-manager] [PATCH 2/7] domcaps: tpm: Add function supports_tpm_v2()

Lin Ma lma at suse.de
Tue Jul 11 00:26:47 UTC 2023


It returns true if libvirt advertises tpm 2.0 in domcaps.

Signed-off-by: Lin Ma <lma at suse.de>
---
 virtinst/domcapabilities.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index db08bf65..34d762ae 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -440,6 +440,14 @@ class DomainCapabilities(XMLBuilder):
 
         return len(models) > 0 and bool("emulator" in backends)
 
+    def supports_tpm_v2(self):
+        """
+        Returns True if libvirt advertises tpm emulator 2.0 in domcaps
+        """
+        versions = self.devices.tpm.get_enum("backendVersion").get_values()
+
+        return bool("2.0" in versions)
+
     def supports_graphics_spice(self):
         if not self.devices.graphics.supported:
             # domcaps is too old, or the driver doesn't advertise graphics
-- 
2.41.0



More information about the virt-tools-list mailing list