Shorten iotune names for simplicity

And refactor some of the virt-manager code for the same goal.
This commit is contained in:
Cole Robinson 2013-04-16 18:18:03 -04:00
parent 08e69ef35b
commit 9f3b21c9a1
4 changed files with 135 additions and 133 deletions

View File

@ -4343,7 +4343,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-read-bytes-sec">
<object class="GtkSpinButton" id="disk-iotune-rbs">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@ -4363,7 +4363,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-read-iops-sec">
<object class="GtkSpinButton" id="disk-iotune-ris">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@ -4383,7 +4383,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-write-bytes-sec">
<object class="GtkSpinButton" id="disk-iotune-wbs">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@ -4403,7 +4403,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-write-iops-sec">
<object class="GtkSpinButton" id="disk-iotune-wis">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@ -4423,7 +4423,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-total-bytes-sec">
<object class="GtkSpinButton" id="disk-iotune-tbs">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@ -4443,7 +4443,7 @@ I/O:</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="disk-iotune-total-iops-sec">
<object class="GtkSpinButton" id="disk-iotune-tis">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>

View File

@ -1884,50 +1884,52 @@ class vmmDetails(vmmGObjectUI):
# 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)
iotune_rbs = int(self.get_text("disk-iotune-rbs") or 0)
iotune_ris = int(self.get_text("disk-iotune-ris") or 0)
iotune_tbs = int(self.get_text("disk-iotune-tbs") or 0)
iotune_tis = int(self.get_text("disk-iotune-tis") or 0)
iotune_wbs = int(self.get_text("disk-iotune-wbs") or 0)
iotune_wis = int(self.get_text("disk-iotune-wis") 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)
have_rw_bytes = (iotune_rbs > 0 or
iotune_wbs > 0)
have_t_bytes = (not have_rw_bytes and iotune_tbs > 0)
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)
self.widget("disk-iotune-rbs").set_sensitive(have_rw_bytes or not
have_t_bytes)
self.widget("disk-iotune-wbs").set_sensitive(have_rw_bytes or not
have_t_bytes)
self.widget("disk-iotune-tbs").set_sensitive(have_t_bytes or not
have_rw_bytes)
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 have_rw_bytes:
self.widget("disk-iotune-tbs").get_adjustment().value = 0
elif have_t_bytes:
self.widget("disk-iotune-rbs").get_adjustment().value = 0
self.widget("disk-iotune-wbs").get_adjustment().value = 0
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)
have_rw_iops = (iotune_ris > 0 or iotune_wis > 0)
have_t_iops = (not have_rw_iops and iotune_tis > 0)
self.widget("disk-iotune-ris").set_sensitive(have_rw_iops or not
have_t_iops)
self.widget("disk-iotune-wis").set_sensitive(have_rw_iops or not
have_t_iops)
self.widget("disk-iotune-tis").set_sensitive(have_t_iops or not
have_rw_iops)
if have_rw_iops:
self.widget("disk-iotune-tis").get_adjustment().value = 0
elif have_t_iops:
self.widget("disk-iotune-ris").get_adjustment().value = 0
self.widget("disk-iotune-wis").get_adjustment().value = 0
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)
@ -2275,19 +2277,19 @@ class vmmDetails(vmmGObjectUI):
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)
iotune_rbs = int(self.widget("disk-iotune-rbs").get_adjustment().value * 1024)
iotune_ris = int(self.widget("disk-iotune-ris").get_adjustment().value)
iotune_tbs = int(self.widget("disk-iotune-tbs").get_adjustment().value * 1024)
iotune_tis = int(self.widget("disk-iotune-tis").get_adjustment().value)
iotune_wbs = int(self.widget("disk-iotune-wbs").get_adjustment().value * 1024)
iotune_wis = int(self.widget("disk-iotune-wis").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)
add_define(self.vm.define_disk_iotune_rbs, dev_id_info, iotune_rbs)
add_define(self.vm.define_disk_iotune_ris, dev_id_info, iotune_ris)
add_define(self.vm.define_disk_iotune_tbs, dev_id_info, iotune_tbs)
add_define(self.vm.define_disk_iotune_tis, dev_id_info, iotune_tis)
add_define(self.vm.define_disk_iotune_wbs, dev_id_info, iotune_wbs)
add_define(self.vm.define_disk_iotune_wis, dev_id_info, iotune_wis)
# Do this last since it can change uniqueness info of the dev
if self.editted(EDIT_DISK_BUS):
@ -2897,12 +2899,12 @@ class vmmDetails(vmmGObjectUI):
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
iotune_rbs = disk.iotune_rbs / 1024
iotune_ris = disk.iotune_ris
iotune_tbs = disk.iotune_tbs / 1024
iotune_tis = disk.iotune_tis
iotune_wbs = disk.iotune_wbs / 1024
iotune_wis = disk.iotune_wis
show_format = (not self.is_customize_dialog or
disk.path_exists(disk.conn, disk.path))
@ -2946,12 +2948,12 @@ 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
self.widget("disk-iotune-rbs").get_adjustment().value = iotune_rbs
self.widget("disk-iotune-ris").get_adjustment().value = iotune_ris
self.widget("disk-iotune-tbs").get_adjustment().value = iotune_tbs
self.widget("disk-iotune-tis").get_adjustment().value = iotune_tis
self.widget("disk-iotune-wbs").get_adjustment().value = iotune_wbs
self.widget("disk-iotune-wis").get_adjustment().value = iotune_wis
button = self.widget("config-cdrom-connect")
if is_cdrom or is_floppy:

View File

@ -636,34 +636,34 @@ 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 define_disk_iotune_rbs(self, devobj, val):
def change(editdev):
editdev.iotune_read_bytes_sec = val
editdev.iotune_rbs = val
return self._redefine_device(change, devobj)
def define_disk_iotune_read_iops_sec(self, devobj, val):
def define_disk_iotune_ris(self, devobj, val):
def change(editdev):
editdev.iotune_read_iops_sec = val
editdev.iotune_ris = val
return self._redefine_device(change, devobj)
def define_disk_iotune_total_bytes_sec(self, devobj, val):
def define_disk_iotune_tbs(self, devobj, val):
def change(editdev):
editdev.iotune_total_bytes_sec = val
editdev.iotune_tbs = val
return self._redefine_device(change, devobj)
def define_disk_iotune_total_iops_sec(self, devobj, val):
def define_disk_iotune_tis(self, devobj, val):
def change(editdev):
editdev.iotune_total_iops_sec = val
editdev.iotune_tis = val
return self._redefine_device(change, devobj)
def define_disk_iotune_write_bytes_sec(self, devobj, val):
def define_disk_iotune_wbs(self, devobj, val):
def change(editdev):
editdev.iotune_write_bytes_sec = val
editdev.iotune_wbs = val
return self._redefine_device(change, devobj)
def define_disk_iotune_write_iops_sec(self, devobj, val):
def define_disk_iotune_wis(self, devobj, val):
def change(editdev):
editdev.iotune_write_iops_sec = val
editdev.iotune_wis = val
return self._redefine_device(change, devobj)
# Network define methods

View File

@ -635,12 +635,12 @@ class VirtualDisk(VirtualDevice):
self._error_policy = None
self._serial = None
self._target = None
self._iotune_read_bytes_sec = None
self._iotune_read_iops_sec = None
self._iotune_total_bytes_sec = None
self._iotune_total_iops_sec = None
self._iotune_write_bytes_sec = None
self._iotune_write_iops_sec = None
self._iotune_rbs = None
self._iotune_ris = None
self._iotune_tbs = None
self._iotune_tis = None
self._iotune_wbs = None
self._iotune_wis = None
self._validate = validate
# XXX: No property methods for these
@ -915,80 +915,80 @@ class VirtualDisk(VirtualDevice):
serial = _xml_property(_get_serial, _set_serial,
xpath="./serial")
def _get_iotune_read_bytes_sec(self):
return self._iotune_read_bytes_sec
def _set_iotune_read_bytes_sec(self, val):
def _get_iotune_rbs(self):
return self._iotune_rbs
def _set_iotune_rbs(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune read bytes per second value must be an "
"integer"))
self._iotune_read_bytes_sec = val
iotune_read_bytes_sec = _xml_property(_get_iotune_read_bytes_sec,
_set_iotune_read_bytes_sec,
self._iotune_rbs = val
iotune_rbs = _xml_property(_get_iotune_rbs,
_set_iotune_rbs,
xpath="./iotune/read_bytes_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
def _get_iotune_read_iops_sec(self):
return self._iotune_read_iops_sec
def _set_iotune_read_iops_sec(self, val):
def _get_iotune_ris(self):
return self._iotune_ris
def _set_iotune_ris(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune read iops per second value must be an "
"integer"))
self._iotune_read_iops_sec = val
iotune_read_iops_sec = _xml_property(_get_iotune_read_iops_sec,
_set_iotune_read_iops_sec,
self._iotune_ris = val
iotune_ris = _xml_property(_get_iotune_ris,
_set_iotune_ris,
xpath="./iotune/read_iops_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
def _get_iotune_total_bytes_sec(self):
return self._iotune_total_bytes_sec
def _set_iotune_total_bytes_sec(self, val):
def _get_iotune_tbs(self):
return self._iotune_tbs
def _set_iotune_tbs(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune total bytes per second value must be an "
"integer"))
self._iotune_total_bytes_sec = val
iotune_total_bytes_sec = _xml_property(_get_iotune_total_bytes_sec,
_set_iotune_total_bytes_sec,
self._iotune_tbs = val
iotune_tbs = _xml_property(_get_iotune_tbs,
_set_iotune_tbs,
xpath="./iotune/total_bytes_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
def _get_iotune_total_iops_sec(self):
return self._iotune_total_iops_sec
def _set_iotune_total_iops_sec(self, val):
def _get_iotune_tis(self):
return self._iotune_tis
def _set_iotune_tis(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune total iops per second value must be an "
"integer"))
self._iotune_total_iops_sec = val
iotune_total_iops_sec = _xml_property(_get_iotune_total_iops_sec,
_set_iotune_total_iops_sec,
self._iotune_tis = val
iotune_tis = _xml_property(_get_iotune_tis,
_set_iotune_tis,
xpath="./iotune/total_iops_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
def _get_iotune_write_bytes_sec(self):
return self._iotune_write_bytes_sec
def _set_iotune_write_bytes_sec(self, val):
def _get_iotune_wbs(self):
return self._iotune_wbs
def _set_iotune_wbs(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune write bytes per second value must be an "
"integer"))
self._iotune_write_bytes_sec = val
iotune_write_bytes_sec = _xml_property(_get_iotune_write_bytes_sec,
_set_iotune_write_bytes_sec,
self._iotune_wbs = val
iotune_wbs = _xml_property(_get_iotune_wbs,
_set_iotune_wbs,
xpath="./iotune/write_bytes_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
def _get_iotune_write_iops_sec(self):
return self._iotune_write_iops_sec
def _set_iotune_write_iops_sec(self, val):
def _get_iotune_wis(self):
return self._iotune_wis
def _set_iotune_wis(self, val):
if not isinstance(val, int) or val < 0:
raise ValueError(_("IOTune write iops per second value must be an "
"integer"))
self._iotune_write_iops_sec = val
iotune_write_iops_sec = _xml_property(_get_iotune_write_iops_sec,
_set_iotune_write_iops_sec,
self._iotune_wis = val
iotune_wis = _xml_property(_get_iotune_wis,
_set_iotune_wis,
xpath="./iotune/write_iops_sec",
get_converter=lambda s, x: int(x or 0),
set_converter=lambda s, x: int(x))
@ -1562,22 +1562,22 @@ class VirtualDisk(VirtualDevice):
ret += (" <serial>%s</serial>\n" %
util.xml_escape(self.serial))
if (self.iotune_read_bytes_sec or self.iotune_read_iops_sec or
self.iotune_total_bytes_sec or self.iotune_total_iops_sec or
self.iotune_write_bytes_sec or self.iotune_write_iops_sec):
if (self.iotune_rbs or self.iotune_ris or
self.iotune_tbs or self.iotune_tis or
self.iotune_wbs or self.iotune_wis):
ret += " <iotune>"
if self.iotune_read_bytes_sec:
ret += " <read_bytes_sec>%s</read_bytes_sec>" % (self.iotune_read_bytes_sec)
if self.iotune_read_iops_sec:
ret += " <read_iops_sec>%s</read_iops_sec>" % (self.iotune_read_iops_sec)
if self.iotune_total_bytes_sec:
ret += " <total_bytes_sec>%s</total_bytes_sec>" % (self.iotune_total_bytes_sec)
if self.iotune_total_iops_sec:
ret += " <total_iops_sec>%s</total_iops_sec>" % (self.iotune_total_iops_sec)
if self.iotune_write_bytes_sec:
ret += " <write_bytes_sec>%s</write_bytes_sec>" % (self.iotune_write_bytes_sec)
if self.iotune_write_iops_sec:
ret += " <write_iops_sec>%s</write_iops_sec>" % (self.iotune_write_iops_sec)
if self.iotune_rbs:
ret += " <read_bytes_sec>%s</read_bytes_sec>" % (self.iotune_rbs)
if self.iotune_ris:
ret += " <read_iops_sec>%s</read_iops_sec>" % (self.iotune_ris)
if self.iotune_tbs:
ret += " <total_bytes_sec>%s</total_bytes_sec>" % (self.iotune_tbs)
if self.iotune_tis:
ret += " <total_iops_sec>%s</total_iops_sec>" % (self.iotune_tis)
if self.iotune_wbs:
ret += " <write_bytes_sec>%s</write_bytes_sec>" % (self.iotune_wbs)
if self.iotune_wis:
ret += " <write_iops_sec>%s</write_iops_sec>" % (self.iotune_wis)
ret += " </iotune>"
ret += " </disk>"