[PATCH v2 1/6] addhardware: learn to choose a TPM model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

There is only one for now, but we are adding CRB next (and SPAPR is
being added too in qemu/libvirt).

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 ui/addhardware.ui          | 42 +++++++++++++++++++++++++++++++++---------
 virtManager/addhardware.py |  6 ++++++
 virtinst/devices/tpm.py    |  6 ++++++
 3 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/ui/addhardware.ui b/ui/addhardware.ui
index cec4e439..b4cc35ea 100644
--- a/ui/addhardware.ui
+++ b/ui/addhardware.ui
@@ -1402,6 +1402,20 @@
                             <property name="can_focus">False</property>
                             <property name="row_spacing">6</property>
                             <property name="column_spacing">6</property>
+                            <child>
+                              <object class="GtkLabel" id="tpm-device-path-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="halign">start</property>
+                                <property name="label" translatable="yes">Device _Path:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">tpm-device-path</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">2</property>
+                              </packing>
+                            </child>
                             <child>
                               <object class="GtkEntry" id="tpm-device-path">
                                 <property name="visible">True</property>
@@ -1411,17 +1425,17 @@
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">1</property>
+                                <property name="top_attach">2</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="tpm-device-path-label">
+                              <object class="GtkLabel" id="label35">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="label" translatable="yes">Device _Path:</property>
+                                <property name="halign">end</property>
+                                <property name="label" translatable="yes">_Backend:</property>
                                 <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">tpm-device-path</property>
+                                <property name="mnemonic_widget">tpm-type</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -1436,23 +1450,33 @@
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label35">
+                              <object class="GtkLabel" id="label1">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">end</property>
-                                <property name="label" translatable="yes">_Backend:</property>
+                                <property name="label" translatable="yes">_Model:</property>
                                 <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">tpm-type</property>
+                                <property name="mnemonic_widget">tpm-model</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">0</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkComboBox" id="tpm-model">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
                             <child internal-child="accessible">
                               <object class="AtkObject" id="table12-atkobject">
                                 <property name="AtkObject::accessible-name">tpm-tab</property>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 1fa832c5..901ed5fb 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -680,6 +680,10 @@ class vmmAddHardware(vmmGObjectUI):
         for t in DeviceTpm.TYPES:
             values.append([t, DeviceTpm.get_pretty_type(t)])
         _build_combo(self.widget("tpm-type"), values)
+        values = []
+        for t in DeviceTpm.MODELS:
+            values.append([t, DeviceTpm.get_pretty_model(t)])
+        _build_combo(self.widget("tpm-model"), values)
 
 
     def _build_panic_model_combo(self):
@@ -1440,9 +1444,11 @@ class vmmAddHardware(vmmGObjectUI):
 
     def _validate_page_tpm(self):
         typ = uiutil.get_list_selection(self.widget("tpm-type"))
+        model = uiutil.get_list_selection(self.widget("tpm-model"))
         device_path = self.widget("tpm-device-path").get_text()
         self._dev = DeviceTpm(self.conn.get_backend())
         self._dev.type = typ
+        self._dev.model = model
         self._dev.device_path = device_path
 
     def _validate_page_panic(self):
diff --git a/virtinst/devices/tpm.py b/virtinst/devices/tpm.py
index a09b08e1..634f8b52 100644
--- a/virtinst/devices/tpm.py
+++ b/virtinst/devices/tpm.py
@@ -30,6 +30,12 @@ class DeviceTpm(Device):
             return _("Passthrough device")
         return tpm_type
 
+    @staticmethod
+    def get_pretty_model(tpm_model):
+        if tpm_model == DeviceTpm.MODEL_TIS:
+            return _("TIS")
+        return tpm_model
+
     def supports_property(self, propname):
         """
         Whether the TPM dev type supports the passed property name
-- 
2.14.4

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux