[virt-tools-list] [virt-manager PATCH 1/5] addhardware: learn to choose a TPM model
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Thu May 24 10:39:13 UTC 2018
From: Marc-André Lureau <marcandre.lureau at redhat.com>
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 at redhat.com>
---
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.17.0.253.g3dd125b46d
More information about the virt-tools-list
mailing list