[virt-tools-list] [virt-manager 3/3] virt-manager: add support for showing panic device
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Mon Jan 6 08:04:02 UTC 2014
From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
ui/details.ui | 110 +++++++++++++++++++++++++++++++++++++++++++++++--
virtManager/details.py | 28 ++++++++++++-
virtManager/domain.py | 3 ++
3 files changed, 136 insertions(+), 5 deletions(-)
diff --git a/ui/details.ui b/ui/details.ui
index 2dc014a..7f36351 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Wed Dec 4 18:33:33 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
@@ -1385,8 +1384,8 @@
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
- <signal name="activate" handler="on_security_type_changed" swapped="no"/>
<signal name="toggled" handler="on_security_type_changed" swapped="no"/>
+ <signal name="activate" handler="on_security_type_changed" swapped="no"/>
</object>
<packing>
<property name="x_options"/>
@@ -2167,7 +2166,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">start</property>
- <property name="vexpand">False</property>
<signal name="clicked" handler="on_cpu_copy_host_clicked" swapped="no"/>
</object>
<packing>
@@ -6945,6 +6943,112 @@
<property name="tab_fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="frame17">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkAlignment" id="alignment10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">3</property>
+ <property name="left_padding">8</property>
+ <child>
+ <object class="GtkGrid" id="table_panic">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">4</property>
+ <property name="column_spacing">8</property>
+ <child>
+ <object class="GtkLabel" id="label95">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="ypad">3</property>
+ <property name="label" translatable="yes"> Type:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label96">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">IO base:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="panic-type">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">panic-address-type</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="panic-iobase">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">panic-iobase</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label94">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Panic</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">20</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label93">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">panic</property>
+ </object>
+ <packing>
+ <property name="position">20</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/virtManager/details.py b/virtManager/details.py
index 258bdb0..3a1cdcc 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -126,7 +126,8 @@ EDIT_TPM_TYPE,
HW_LIST_TYPE_SMARTCARD,
HW_LIST_TYPE_REDIRDEV,
HW_LIST_TYPE_TPM,
- HW_LIST_TYPE_RNG) = range(20)
+ HW_LIST_TYPE_RNG,
+ HW_LIST_TYPE_PANIC) = range(21)
remove_pages = [HW_LIST_TYPE_NIC, HW_LIST_TYPE_INPUT,
HW_LIST_TYPE_GRAPHICS, HW_LIST_TYPE_SOUND, HW_LIST_TYPE_CHAR,
@@ -134,7 +135,7 @@ remove_pages = [HW_LIST_TYPE_NIC, HW_LIST_TYPE_INPUT,
HW_LIST_TYPE_WATCHDOG, HW_LIST_TYPE_CONTROLLER,
HW_LIST_TYPE_FILESYSTEM, HW_LIST_TYPE_SMARTCARD,
HW_LIST_TYPE_REDIRDEV, HW_LIST_TYPE_TPM,
- HW_LIST_TYPE_RNG]
+ HW_LIST_TYPE_RNG, HW_LIST_TYPE_PANIC]
# Boot device columns
(BOOT_DEV_TYPE,
@@ -1214,6 +1215,8 @@ class vmmDetails(vmmGObjectUI):
self.refresh_tpm_page()
elif pagetype == HW_LIST_TYPE_RNG:
self.refresh_rng_page()
+ elif pagetype == HW_LIST_TYPE_PANIC:
+ self.refresh_panic_page()
else:
pagetype = -1
except Exception, e:
@@ -3096,6 +3099,22 @@ class vmmDetails(vmmGObjectUI):
# Device type specific properties, only show if apply to the cur dev
show_ui("device_path")
+ def refresh_panic_page(self):
+ dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
+ if not dev:
+ return
+
+ def show_ui(param, val=None):
+ widgetname = "panic-" + param.replace("_", "-")
+ if not val:
+ val = getattr(dev, param)
+
+ uihelpers.set_grid_row_visible(self.widget(widgetname), True)
+ self.widget(widgetname).set_text(val or "-")
+
+ show_ui("type")
+ show_ui("iobase")
+
def refresh_rng_page(self):
dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
values = {
@@ -3620,6 +3639,11 @@ class vmmDetails(vmmGObjectUI):
update_hwlist(HW_LIST_TYPE_RNG, rng,
_("RNG"), "system-run")
+ # Populate list of Panic devices
+ for rng in self.vm.get_panic_devices():
+ update_hwlist(HW_LIST_TYPE_PANIC, rng,
+ _("Panic"), "system-run")
+
devs = range(len(hw_list_model))
devs.reverse()
for i in devs:
diff --git a/virtManager/domain.py b/virtManager/domain.py
index b0acd93..e7035b2 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -60,6 +60,7 @@ def compare_device(origdev, newdev, idx):
"redirdev" : ["bus" , "type", "vmmindex"],
"tpm" : ["type" , "vmmindex"],
"rng" : ["type" , "vmmindex"],
+ "panic" : ["type" , "vmmindex"],
}
if id(origdev) == id(newdev):
@@ -1130,6 +1131,8 @@ class vmmDomain(vmmLibvirtObject):
return self._build_device_list("tpm")
def get_rng_devices(self):
return self._build_device_list("rng")
+ def get_panic_devices(self):
+ return self._build_device_list("panic")
def get_disk_devices(self, refresh_if_nec=True, inactive=False):
devs = self._build_device_list("disk", refresh_if_nec, inactive)
--
1.8.2.1
More information about the virt-tools-list
mailing list