details: List guest <filesystem> devices

This commit is contained in:
Cole Robinson 2011-05-19 15:18:33 -04:00
parent 7d5acf4b86
commit ae9ba46ff4
3 changed files with 182 additions and 2 deletions

View File

@ -61,11 +61,13 @@ HW_LIST_TYPE_HOSTDEV = 11
HW_LIST_TYPE_VIDEO = 12
HW_LIST_TYPE_WATCHDOG = 13
HW_LIST_TYPE_CONTROLLER = 14
HW_LIST_TYPE_FILESYSTEM = 15
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_CONTROLLER]
HW_LIST_TYPE_WATCHDOG, HW_LIST_TYPE_CONTROLLER,
HW_LIST_TYPE_FILESYSTEM]
# Boot device columns
BOOT_DEV_TYPE = 0
@ -1017,6 +1019,8 @@ class vmmDetails(vmmGObjectUI):
self.refresh_watchdog_page()
elif pagetype == HW_LIST_TYPE_CONTROLLER:
self.refresh_controller_page()
elif pagetype == HW_LIST_TYPE_FILESYSTEM:
self.refresh_filesystem_page()
else:
pagetype = -1
except Exception, e:
@ -2656,6 +2660,16 @@ class vmmDetails(vmmGObjectUI):
type_label = virtinst.VirtualController.pretty_type(dev.type)
self.window.get_widget("controller-type").set_text(type_label)
def refresh_filesystem_page(self):
dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
if not dev:
return
self.window.get_widget("fs-type").set_text(dev.type)
self.window.get_widget("fs-mode").set_text(dev.mode)
self.window.get_widget("fs-source").set_text(dev.source)
self.window.get_widget("fs-target").set_text(dev.target)
def refresh_boot_page(self):
# Refresh autostart
try:
@ -2856,16 +2870,25 @@ class vmmDetails(vmmGObjectUI):
for vid in self.vm.get_video_devices():
update_hwlist(HW_LIST_TYPE_VIDEO, vid, _("Video"), "video-display")
# Populate watchdog devices
for watch in self.vm.get_watchdog_devices():
update_hwlist(HW_LIST_TYPE_WATCHDOG, watch, _("Watchdog"),
"device_pci")
# Populate controller devices
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")
# Populate filesystem devices
for fs in self.vm.get_filesystem_devices():
target = fs.target[:8]
update_hwlist(HW_LIST_TYPE_FILESYSTEM, fs,
_("Filesystem %s") % target,
gtk.STOCK_DIRECTORY)
devs = range(len(hw_list_model))
devs.reverse()
for i in devs:

View File

@ -46,6 +46,7 @@ def compare_device(origdev, newdev, idx):
"graphics" : ["type", "vmmindex"],
"controller" : ["type", "index"],
"channel" : ["char_type", "target_name"],
"filesystem" : ["target" , "vmmindex"],
}
if id(origdev) == id(newdev):
@ -888,6 +889,8 @@ class vmmDomain(vmmLibvirtObject):
return self._build_device_list("sound")
def get_controller_devices(self):
return self._build_device_list("controller")
def get_filesystem_devices(self):
return self._build_device_list("filesystem")
def get_disk_devices(self, refresh_if_necc=True, inactive=False):
devs = self._build_device_list("disk", refresh_if_necc, inactive)

View File

@ -5249,7 +5249,7 @@ I/O:</property>
<child>
<widget class="GtkLabel" id="label47">
<property name="visible">True</property>
<property name="label">cntrl</property>
<property name="label">ctrl</property>
</widget>
<packing>
<property name="position">14</property>
@ -5257,6 +5257,160 @@ I/O:</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame16">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment35">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkTable" id="table12">
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<widget class="GtkLabel" id="label63">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Mode:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label65">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Source:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label66">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Target:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-mode">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">label</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-source">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">label</property>
<property name="ellipsize">end</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-target">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">label</property>
<property name="ellipsize">end</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label67">
<property name="visible">True</property>
<property name="xalign">0</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="fs-type">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">label</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="label64">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Filesystem&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">15</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label">fs</property>
</widget>
<packing>
<property name="position">15</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
</widget>
</child>
</widget>