From 61e06856a3140b5544a23739600a4052ca7e20b0 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 13 Mar 2015 14:39:47 +0100 Subject: [PATCH] virt-manager: Allow to change SGIO with LUN disk devices It is added only in the details window, and intentionally not added to the addhardware UI to keep it simpler. Users can edit this after a new device is added. Signed-off-by: Giuseppe Scrivano --- ui/details.ui | 63 +++++++++++++++++++++++++++++++----------- virtManager/details.py | 24 +++++++++++++++- virtManager/domain.py | 5 +++- 3 files changed, 74 insertions(+), 18 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index 6804124d6..1a0c9d39f 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -3708,22 +3708,6 @@ if you know what you are doing.</small> False 3 8 - - - True - False - 1 - 0 - 4 - Storage forma_t: - True - storage-format-combobox-entry - - - 0 - 2 - - True @@ -3846,6 +3830,53 @@ if you know what you are doing.</small> + + 1 + 3 + + + + + True + False + 1 + 0 + 4 + Storage forma_t: + True + storage-format-combobox-entry + + + 0 + 3 + + + + + True + False + 1 + _SGIO: + True + disk-sgio-entry + + + 0 + 2 + + + + + True + False + True + + + True + + + + 1 2 diff --git a/virtManager/details.py b/virtManager/details.py index c22417eb4..7d854b9c4 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -75,6 +75,7 @@ EDIT_DISK_BUS, EDIT_DISK_SERIAL, EDIT_DISK_FORMAT, EDIT_DISK_IOTUNE, +EDIT_DISK_SGIO, EDIT_SOUND_MODEL, @@ -104,7 +105,7 @@ EDIT_FS, EDIT_HOSTDEV_ROMBAR, -) = range(1, 45) +) = range(1, 46) # Columns in hw list model @@ -499,6 +500,7 @@ class vmmDetails(vmmGObjectUI): "on_disk_format_changed": self.disk_format_changed, "on_disk_serial_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SERIAL), "on_disk_iotune_changed": self.iotune_changed, + "on_disk_sgio_entry_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SGIO), "on_network_model_combo_changed": lambda *x: self.enable_apply(x, EDIT_NET_MODEL), @@ -2124,6 +2126,10 @@ class vmmDetails(vmmGObjectUI): if self.edited(EDIT_DISK_SERIAL): kwargs["serial"] = self.get_text("disk-serial") + if self.edited(EDIT_DISK_SGIO): + sgio = uiutil.get_combo_entry(self.widget("disk-sgio")) + kwargs["sgio"] = sgio + if self.edited(EDIT_DISK_IOTUNE): kwargs["iotune_rbs"] = int( self.widget("disk-iotune-rbs").get_value() * 1024) @@ -2597,6 +2603,15 @@ class vmmDetails(vmmGObjectUI): ignore, upper = maxmem.get_range() maxmem.set_range(curmem.get_value(), upper) + @staticmethod + def build_disk_sgio(vm, combo): + ignore = vm + model = Gtk.ListStore(str, str) + combo.set_model(model) + uiutil.set_combo_text_column(combo, 1) + model.append([None, "default"]) + model.append(["filtered", "filtered"]) + model.append(["unfiltered", "unfiltered"]) def refresh_disk_page(self): disk = self.get_hw_selection(HW_LIST_COL_DEVICE) @@ -2675,6 +2690,13 @@ class vmmDetails(vmmGObjectUI): self.widget("disk-removable").set_active(removable) uiutil.set_grid_row_visible(self.widget("disk-removable"), can_set_removable) + + is_lun = disk.device == virtinst.VirtualDisk.DEVICE_LUN + uiutil.set_grid_row_visible(self.widget("disk-sgio"), is_lun) + if is_lun: + self.build_disk_sgio(self.vm, self.widget("disk-sgio")) + uiutil.set_combo_entry(self.widget("disk-sgio"), disk.sgio) + self.widget("disk-size").set_text(size) uiutil.set_combo_entry(self.widget("disk-cache"), cache) uiutil.set_combo_entry(self.widget("disk-io"), io) diff --git a/virtManager/domain.py b/virtManager/domain.py index 66b41429f..a83bc96da 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -715,7 +715,8 @@ class vmmDomain(vmmLibvirtObject): shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL, io=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL, iotune_rbs=_SENTINEL, iotune_ris=_SENTINEL, iotune_tbs=_SENTINEL, - iotune_tis=_SENTINEL, iotune_wbs=_SENTINEL, iotune_wis=_SENTINEL): + iotune_tis=_SENTINEL, iotune_wbs=_SENTINEL, iotune_wis=_SENTINEL, + sgio=_SENTINEL): def _change_bus(editdev): oldprefix = editdev.get_target_prefix()[0] oldbus = editdev.bus @@ -776,6 +777,8 @@ class vmmDomain(vmmLibvirtObject): editdev.iotune_wbs = iotune_wbs if iotune_wis != _SENTINEL: editdev.iotune_wis = iotune_wis + if sgio != _SENTINEL: + editdev.sgio = sgio or None if bus != _SENTINEL: _change_bus(editdev)