details: Allow viewing/removing controller devices

This commit is contained in:
Cole Robinson 2010-12-16 12:41:47 -05:00
parent 6af4a2bda7
commit d0870fe9ca
4 changed files with 103 additions and 15 deletions

View File

@ -600,7 +600,7 @@ class vmmConsolePages(vmmGObjectUI):
except Exception, e:
# We can fail here if VM is destroyed: xen is a bit racy
# and can't handle domain lookups that soon after
logging.debug("Getting graphics console failed: %s" % str(e))
logging.exception("Getting graphics console failed: %s" % str(e))
return
if protocol is None:

View File

@ -59,11 +59,12 @@ HW_LIST_TYPE_CHAR = 10
HW_LIST_TYPE_HOSTDEV = 11
HW_LIST_TYPE_VIDEO = 12
HW_LIST_TYPE_WATCHDOG = 13
HW_LIST_TYPE_CONTROLLER = 14
remove_pages = [HW_LIST_TYPE_NIC, HW_LIST_TYPE_INPUT,
HW_LIST_TYPE_GRAPHICS, HW_LIST_TYPE_SOUND, HW_LIST_TYPE_CHAR,
HW_LIST_TYPE_HOSTDEV, HW_LIST_TYPE_DISK, HW_LIST_TYPE_VIDEO,
HW_LIST_TYPE_WATCHDOG]
HW_LIST_TYPE_WATCHDOG, HW_LIST_TYPE_CONTROLLER]
# Boot device columns
BOOT_DEV_TYPE = 0
@ -899,6 +900,8 @@ class vmmDetails(vmmGObjectUI):
self.refresh_video_page()
elif pagetype == HW_LIST_TYPE_WATCHDOG:
self.refresh_watchdog_page()
elif pagetype == HW_LIST_TYPE_CONTROLLER:
self.refresh_controller_page()
else:
pagetype = -1
except Exception, e:
@ -2241,6 +2244,14 @@ class vmmDetails(vmmGObjectUI):
self.set_combo_label("watchdog-model", 0, model)
self.set_combo_label("watchdog-action", 0, action)
def refresh_controller_page(self):
dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
if not dev:
return
type_label = virtinst.VirtualController.pretty_type(dev.type)
self.window.get_widget("controller-type").set_text(type_label)
def refresh_boot_page(self):
# Refresh autostart
try:
@ -2445,6 +2456,12 @@ class vmmDetails(vmmGObjectUI):
update_hwlist(HW_LIST_TYPE_WATCHDOG, watch, _("Watchdog"),
"device_pci")
for cont in self.vm.get_controller_devices():
pretty_type = virtinst.VirtualController.pretty_type(cont.type)
update_hwlist(HW_LIST_TYPE_CONTROLLER, cont,
_("Controller %s") % pretty_type,
"device_pci")
devs = range(len(hw_list_model))
devs.reverse()
for i in devs:

View File

@ -45,6 +45,7 @@ def compare_device(origdev, newdev, idx):
"parallel" : ["char_type", "target_port"],
"console" : ["char_type", "target_type", "target_port"],
"graphics" : ["type", "vmmindex"],
"controller" : ["type", "index"],
}
if id(origdev) == id(newdev):
@ -617,6 +618,8 @@ class vmmDomainBase(vmmLibvirtObject):
return self._build_device_list("graphics")
def get_sound_devices(self):
return self._build_device_list("sound")
def get_controller_devices(self):
return self._build_device_list("controller")
def get_disk_devices(self, refresh_if_necc=True, inactive=False):
devs = self._build_device_list("disk", refresh_if_necc, inactive)

View File

@ -1622,7 +1622,7 @@
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">Over</property>
<property name="label" translatable="yes">over</property>
</widget>
<packing>
<property name="tab_fill">False</property>
@ -1811,7 +1811,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes">Stats</property>
<property name="label" translatable="yes">stat</property>
</widget>
<packing>
<property name="position">1</property>
@ -2243,7 +2243,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label53">
<property name="visible">True</property>
<property name="label" translatable="yes">Proc</property>
<property name="label" translatable="yes">cpu</property>
</widget>
<packing>
<property name="position">2</property>
@ -2469,7 +2469,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label54">
<property name="visible">True</property>
<property name="label" translatable="yes">Mem</property>
<property name="label" translatable="yes">mem</property>
</widget>
<packing>
<property name="position">3</property>
@ -2847,7 +2847,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="boot-options-lbl">
<property name="visible">True</property>
<property name="label" translatable="yes">Boot</property>
<property name="label" translatable="yes">boot</property>
</widget>
<packing>
<property name="position">4</property>
@ -3312,7 +3312,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label55">
<property name="visible">True</property>
<property name="label" translatable="yes">Disk</property>
<property name="label" translatable="yes">dsk</property>
</widget>
<packing>
<property name="position">5</property>
@ -3473,7 +3473,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label56">
<property name="visible">True</property>
<property name="label" translatable="yes">Net</property>
<property name="label" translatable="yes">net</property>
</widget>
<packing>
<property name="position">6</property>
@ -3632,7 +3632,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label401">
<property name="visible">True</property>
<property name="label" translatable="yes">Input</property>
<property name="label" translatable="yes">inp</property>
</widget>
<packing>
<property name="position">7</property>
@ -3965,7 +3965,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label500">
<property name="visible">True</property>
<property name="label">Gfx</property>
<property name="label">gfx</property>
</widget>
<packing>
<property name="position">8</property>
@ -4065,7 +4065,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label440">
<property name="visible">True</property>
<property name="label" translatable="yes">Sound</property>
<property name="label" translatable="yes">snd</property>
</widget>
<packing>
<property name="position">9</property>
@ -4175,7 +4175,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label501">
<property name="visible">True</property>
<property name="label" translatable="yes">Char</property>
<property name="label" translatable="yes">chr</property>
</widget>
<packing>
<property name="position">10</property>
@ -4254,7 +4254,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label">Host</property>
<property name="label">phy</property>
</widget>
<packing>
<property name="position">11</property>
@ -4411,7 +4411,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="label" translatable="yes">Vid</property>
<property name="label" translatable="yes">vid</property>
</widget>
<packing>
<property name="position">12</property>
@ -4568,6 +4568,74 @@ I/O:</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame12">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment30">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkTable" id="table14">
<property name="visible">True</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<widget class="GtkLabel" id="label48">
<property name="visible">True</property>
<property name="label" translatable="yes">Type:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="controller-type">
<property name="visible">True</property>
<property name="label">foo</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label42">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Controller&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">14</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label47">
<property name="visible">True</property>
<property name="label" translatable="yes">cntrl</property>
</widget>
<packing>
<property name="position">14</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
</widget>
</child>
</widget>