[virt-tools-list] [PATCH virt-manager 2/2] virt-manager: Allow to change SGIO with LUN disk devices
Giuseppe Scrivano
gscrivan at redhat.com
Fri Mar 13 13:43:31 UTC 2015
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 <gscrivan at redhat.com>
---
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 6804124..1a0c9d3 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -3709,22 +3709,6 @@ if you know what you are doing.</small></property>
<property name="row_spacing">3</property>
<property name="column_spacing">8</property>
<child>
- <object class="GtkLabel" id="label30">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0</property>
- <property name="ypad">4</property>
- <property name="label" translatable="yes">Storage forma_t:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">storage-format-combobox-entry</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label32">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -3848,6 +3832,53 @@ if you know what you are doing.</small></property>
</object>
<packing>
<property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label30">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0</property>
+ <property name="ypad">4</property>
+ <property name="label" translatable="yes">Storage forma_t:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">storage-format-combobox-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label66">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_SGIO:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">disk-sgio-entry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="disk-sgio">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_entry">True</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="disk-sgio-entry">
+ <property name="can_focus">True</property>
+ <signal name="changed" handler="on_disk_sgio_entry_changed" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
diff --git a/virtManager/details.py b/virtManager/details.py
index c22417e..7d854b9 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 66b4142..a83bc96 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)
--
2.1.0
More information about the virt-tools-list
mailing list