virt-manager: add support for iotune

(crobinso: Add David to AUTHORS, pylint cleanups, enable for test driver)
This commit is contained in:
David Shane Holden 2013-02-17 08:40:37 -05:00 committed by Cole Robinson
parent 97156c6e15
commit e6d5c10129
4 changed files with 375 additions and 2 deletions

View File

@ -86,6 +86,7 @@ Further patches have been submitted by:
Michal Privoznik <mprivozn-at-redhat-dot-com>
Martin Kletzander <mkletzan-at-redhat-dot-com>
ChenHanxiao <chenhanxiao-at-cn-dot-fujitsu-dot-com>
David Shane Holden <dpejesh@yahoo.com>
<...send a patch & get your name here...>

View File

@ -51,7 +51,7 @@ _comboentry_xml = """
"""
# Parameters that can be editted in the details window
EDIT_TOTAL = 36
EDIT_TOTAL = 37
(EDIT_NAME,
EDIT_ACPI,
EDIT_APIC,
@ -80,6 +80,7 @@ EDIT_DISK_IO,
EDIT_DISK_BUS,
EDIT_DISK_SERIAL,
EDIT_DISK_FORMAT,
EDIT_DISK_IOTUNE,
EDIT_SOUND_MODEL,
@ -445,6 +446,8 @@ class vmmDetails(vmmGObjectUI):
"on_disk_format_changed": (self.enable_apply, EDIT_DISK_FORMAT),
"on_disk_serial_changed": (self.enable_apply, EDIT_DISK_SERIAL),
"on_disk_iotune_changed": self.iotune_changed,
"on_network_source_combo_changed": (self.enable_apply,
EDIT_NET_SOURCE),
"on_network_bridge_changed": (self.enable_apply,
@ -937,6 +940,10 @@ class vmmDetails(vmmGObjectUI):
disk_bus = self.widget("disk-bus-combo")
uihelpers.build_disk_bus_combo(self.vm, disk_bus)
# Disk iotune expander
if not (self.conn.is_qemu() or self.conn.is_test_conn()):
self.widget("iotune-expander").set_property("visible", False)
# Network source
net_source = self.widget("network-source-combo")
net_bridge = self.widget("network-bridge-box")
@ -1870,6 +1877,52 @@ class vmmDetails(vmmGObjectUI):
self.repopulate_boot_list(boot_devs, boot_selection)
self.enable_apply(EDIT_BOOTORDER)
# IO Tuning
def iotune_changed(self, ignore):
iotune_read_bytes_sec = int(self.get_text("disk-iotune-read-bytes-sec") or 0)
iotune_read_iops_sec = int(self.get_text("disk-iotune-read-iops-sec") or 0)
iotune_total_bytes_sec = int(self.get_text("disk-iotune-total-bytes-sec") or 0)
iotune_total_iops_sec = int(self.get_text("disk-iotune-total-iops-sec") or 0)
iotune_write_bytes_sec = int(self.get_text("disk-iotune-write-bytes-sec") or 0)
iotune_write_iops_sec = int(self.get_text("disk-iotune-write-iops-sec") or 0)
# libvirt doesn't support having read/write settings along side total
# settings, so disable the widgets accordingly.
if (iotune_read_bytes_sec > 0 or iotune_write_bytes_sec > 0):
iotune_total_bytes_sec = int(0)
self.widget("disk-iotune-total-bytes-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-total-bytes-sec").set_sensitive(False)
else:
self.widget("disk-iotune-total-bytes-sec").set_sensitive(True)
if (iotune_total_bytes_sec > 0):
self.widget("disk-iotune-read-bytes-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-write-bytes-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-read-bytes-sec").set_sensitive(False)
self.widget("disk-iotune-write-bytes-sec").set_sensitive(False)
else:
self.widget("disk-iotune-read-bytes-sec").set_sensitive(True)
self.widget("disk-iotune-write-bytes-sec").set_sensitive(True)
if (iotune_read_iops_sec > 0 or iotune_write_iops_sec > 0):
iotune_total_iops_sec = int(0)
self.widget("disk-iotune-total-iops-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-total-iops-sec").set_sensitive(False)
else:
self.widget("disk-iotune-total-iops-sec").set_sensitive(True)
if (iotune_total_iops_sec > 0):
self.widget("disk-iotune-read-iops-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-write-iops-sec").get_adjustment().value = int(0)
self.widget("disk-iotune-read-iops-sec").set_sensitive(False)
self.widget("disk-iotune-write-iops-sec").set_sensitive(False)
else:
self.widget("disk-iotune-read-iops-sec").set_sensitive(True)
self.widget("disk-iotune-write-iops-sec").set_sensitive(True)
self.enable_apply(EDIT_DISK_IOTUNE)
# CDROM Eject/Connect
def toggle_storage_media(self, src_ignore):
disk = self.get_hw_selection(HW_LIST_COL_DEVICE)
@ -2216,6 +2269,21 @@ class vmmDetails(vmmGObjectUI):
serial = self.get_text("disk-serial")
add_define(self.vm.define_disk_serial, dev_id_info, serial)
if self.editted(EDIT_DISK_IOTUNE):
iotune_read_bytes_sec = int(self.widget("disk-iotune-read-bytes-sec").get_adjustment().value * 1024)
iotune_read_iops_sec = int(self.widget("disk-iotune-read-iops-sec").get_adjustment().value)
iotune_total_bytes_sec = int(self.widget("disk-iotune-total-bytes-sec").get_adjustment().value * 1024)
iotune_total_iops_sec = int(self.widget("disk-iotune-total-iops-sec").get_adjustment().value)
iotune_write_bytes_sec = int(self.widget("disk-iotune-write-bytes-sec").get_adjustment().value * 1024)
iotune_write_iops_sec = int(self.widget("disk-iotune-write-iops-sec").get_adjustment().value)
add_define(self.vm.define_disk_iotune_read_bytes_sec, dev_id_info, iotune_read_bytes_sec)
add_define(self.vm.define_disk_iotune_read_iops_sec, dev_id_info, iotune_read_iops_sec)
add_define(self.vm.define_disk_iotune_total_bytes_sec, dev_id_info, iotune_total_bytes_sec)
add_define(self.vm.define_disk_iotune_total_iops_sec, dev_id_info, iotune_total_iops_sec)
add_define(self.vm.define_disk_iotune_write_bytes_sec, dev_id_info, iotune_write_bytes_sec)
add_define(self.vm.define_disk_iotune_write_iops_sec, dev_id_info, iotune_write_iops_sec)
# Do this last since it can change uniqueness info of the dev
if self.editted(EDIT_DISK_BUS):
bus = self.get_combo_label_value("disk-bus")
@ -2826,6 +2894,14 @@ class vmmDetails(vmmGObjectUI):
io = disk.driver_io
driver_type = disk.driver_type or ""
serial = disk.serial
iotune_read_bytes_sec = disk.iotune_read_bytes_sec / 1024
iotune_read_iops_sec = disk.iotune_read_iops_sec
iotune_total_bytes_sec = disk.iotune_total_bytes_sec / 1024
iotune_total_iops_sec = disk.iotune_total_iops_sec
iotune_write_bytes_sec = disk.iotune_write_bytes_sec / 1024
iotune_write_iops_sec = disk.iotune_write_iops_sec
show_format = (not self.is_customize_dialog or
disk.path_exists(disk.conn, disk.path))
@ -2868,6 +2944,13 @@ class vmmDetails(vmmGObjectUI):
self.set_combo_label("disk-bus", bus)
self.widget("disk-serial").set_text(serial or "")
self.widget("disk-iotune-read-bytes-sec").get_adjustment().value = iotune_read_bytes_sec
self.widget("disk-iotune-read-iops-sec").get_adjustment().value = iotune_read_iops_sec
self.widget("disk-iotune-total-bytes-sec").get_adjustment().value = iotune_total_bytes_sec
self.widget("disk-iotune-total-iops-sec").get_adjustment().value = iotune_total_iops_sec
self.widget("disk-iotune-write-bytes-sec").get_adjustment().value = iotune_write_bytes_sec
self.widget("disk-iotune-write-iops-sec").get_adjustment().value = iotune_write_iops_sec
button = self.widget("config-cdrom-connect")
if is_cdrom or is_floppy:
if not path:

View File

@ -616,6 +616,36 @@ class vmmDomain(vmmLibvirtObject):
editdev.serial = val or None
return self._redefine_device(change, devobj)
def define_disk_iotune_read_bytes_sec(self, devobj, val):
def change(editdev):
editdev.iotune_read_bytes_sec = val
return self._redefine_device(change, devobj)
def define_disk_iotune_read_iops_sec(self, devobj, val):
def change(editdev):
editdev.iotune_read_iops_sec = val
return self._redefine_device(change, devobj)
def define_disk_iotune_total_bytes_sec(self, devobj, val):
def change(editdev):
editdev.iotune_total_bytes_sec = val
return self._redefine_device(change, devobj)
def define_disk_iotune_total_iops_sec(self, devobj, val):
def change(editdev):
editdev.iotune_total_iops_sec = val
return self._redefine_device(change, devobj)
def define_disk_iotune_write_bytes_sec(self, devobj, val):
def change(editdev):
editdev.iotune_write_bytes_sec = val
return self._redefine_device(change, devobj)
def define_disk_iotune_write_iops_sec(self, devobj, val):
def change(editdev):
editdev.iotune_write_iops_sec = val
return self._redefine_device(change, devobj)
# Network define methods
def define_network_source(self, devobj, newtype, newsource, newmode):

View File

@ -51,6 +51,30 @@
<property name="step_increment">1</property>
<property name="page_increment">2</property>
</object>
<object class="GtkAdjustment" id="adjustment8">
<property name="upper">1000000000</property>
<property name="step_increment">1024</property>
</object>
<object class="GtkAdjustment" id="adjustment9">
<property name="upper">1000000000</property>
<property name="step_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment10">
<property name="upper">1000000000</property>
<property name="step_increment">1024</property>
</object>
<object class="GtkAdjustment" id="adjustment11">
<property name="upper">1000000000</property>
<property name="step_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment12">
<property name="upper">1000000000</property>
<property name="step_increment">1024</property>
</object>
<object class="GtkAdjustment" id="adjustment13">
<property name="upper">1000000000</property>
<property name="step_increment">10</property>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -3994,7 +4018,7 @@ I/O:</property>
<object class="GtkTable" id="table11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">4</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">8</property>
<property name="row_spacing">3</property>
@ -4277,6 +4301,241 @@ I/O:</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkExpander" id="iotune-expander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTable" id="table20">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="n_rows">4</property>
<property name="n_columns">3</property>
<property name="column_spacing">8</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkLabel" id="label80">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Read:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label82">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Write:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label84">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="xpad">2</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label85">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Total:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label86">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">KBytes/Sec</property>
<property name="use_underline">True</property>
<property name="max_width_chars">20</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label87">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">IOPS/Sec</property>
<property name="use_underline">True</property>
<property name="max_width_chars">20</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-read-bytes-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment8</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<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="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-read-iops-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment9</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-write-bytes-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment10</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<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="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-write-iops-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment11</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-total-bytes-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment12</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<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="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-total-iops-sec">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
<property name="adjustment">adjustment13</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="changed" handler="on_disk_iotune_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label83">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">IO _Tuning</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">iotune-expander</property>
</object>
</child>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
</object>
</child>
<child type="label">