[virt-tools-list] [PATCH 5/5] Write back the changes in filesystem details page
Cédric Bosdonnat
cbosdonnat at suse.com
Tue Jan 21 09:05:32 UTC 2014
---
ui/fsdetails.ui | 7 +++++++
virtManager/details.py | 20 +++++++++++++++++++-
virtManager/domain.py | 13 +++++++++++++
virtManager/fsdetails.py | 16 ++++++++++++++++
4 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/ui/fsdetails.ui b/ui/fsdetails.ui
index bf19b6b..3e97bd3 100644
--- a/ui/fsdetails.ui
+++ b/ui/fsdetails.ui
@@ -56,6 +56,7 @@
<object class="GtkComboBox" id="fs-mode-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <signal name="changed" handler="on_fs_mode_combo_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -129,6 +130,7 @@
<object class="GtkComboBox" id="fs-wrpolicy-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <signal name="changed" handler="on_fs_wrpolicy_combo_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -162,6 +164,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <signal name="changed" handler="on_fs_target_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -179,6 +182,7 @@
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_fs_readonly_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -197,6 +201,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <signal name="changed" handler="on_fs_source_changed" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
@@ -366,6 +371,7 @@
<property name="xalign">1</property>
<property name="adjustment">adjustment6</property>
<property name="climb_rate">1</property>
+ <signal name="changed" handler="on_fs_ram_source_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -417,6 +423,7 @@
<object class="GtkComboBox" id="fs-format-combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <signal name="changed" handler="on_fs_format_combo_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/virtManager/details.py b/virtManager/details.py
index f1bcce6..778c63a 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -97,7 +97,9 @@ EDIT_WATCHDOG_ACTION,
EDIT_CONTROLLER_MODEL,
EDIT_TPM_TYPE,
-) = range(1, 42)
+
+EDIT_FS,
+) = range(1, 43)
# Columns in hw list model
@@ -556,6 +558,8 @@ class vmmDetails(vmmGObjectUI):
self.fsDetails.set_initial_state()
fsAlignment = self.widget("fs-alignment")
fsAlignment.add(self.fsDetails.topwin)
+ self.fsDetails.connect("changed", lambda *x: self.enable_apply(x,
+ EDIT_FS))
self.populate_hw_list()
self.repopulate_boot_list()
@@ -1927,6 +1931,8 @@ class vmmDetails(vmmGObjectUI):
ret = self.config_smartcard_apply(key)
elif pagetype is HW_LIST_TYPE_CONTROLLER:
ret = self.config_controller_apply(key)
+ elif pagetype is HW_LIST_TYPE_FILESYSTEM:
+ ret = self.config_filesystem_apply(key)
else:
ret = False
except Exception, e:
@@ -2356,6 +2362,18 @@ class vmmDetails(vmmGObjectUI):
return self._change_config_helper(df, da, hf, ha)
+ # Filesystem options
+ def config_filesystem_apply(self, dev_id_info):
+ df, da, add_define, hf, ha, add_hotplug = self.make_apply_data()
+ ignore = add_hotplug
+
+ if self.edited(EDIT_FS):
+ self.fsDetails.validate_page_filesystem()
+ add_define(self.vm.define_filesystem, dev_id_info,
+ self.fsDetails.get_dev())
+
+ return self._change_config_helper(df, da, hf, ha)
+
# Device removal
def remove_device(self, dev_type, dev_id_info):
logging.debug("Removing device: %s %s", dev_type, dev_id_info)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index ada404b..f7ef66f 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -845,6 +845,19 @@ class vmmDomain(vmmLibvirtObject):
return self._redefine_device(change, devobj)
+ def define_filesystem(self, devobj, newdev):
+ def change(editdev):
+ editdev.type = newdev.type
+ editdev.mode = newdev.mode
+ editdev.wrpolicy = newdev.wrpolicy
+ editdev.driver = newdev.driver
+ editdev.format = newdev.format
+ editdev.readonly = newdev.readonly
+ editdev.units = newdev.units
+ editdev.source = newdev.source
+ editdev.target = newdev.target
+
+ return self._redefine_device(change, devobj)
####################
diff --git a/virtManager/fsdetails.py b/virtManager/fsdetails.py
index 8bfafc1..7efeab0 100644
--- a/virtManager/fsdetails.py
+++ b/virtManager/fsdetails.py
@@ -21,6 +21,7 @@
# pylint: disable=E0611
from gi.repository import Gtk
+from gi.repository import GObject
# pylint: enable=E0611
from virtinst import VirtualFilesystem
@@ -30,6 +31,10 @@ from virtManager.storagebrowse import vmmStorageBrowser
class vmmFSDetails(vmmGObjectUI):
+ __gsignals__ = {
+ "changed": (GObject.SignalFlags.RUN_FIRST, None, [])
+ }
+
def __init__(self, vm):
vmmGObjectUI.__init__(self, "fsdetails.ui", "vmm-fs-details")
@@ -45,6 +50,13 @@ class vmmFSDetails(vmmGObjectUI):
"on_fs_driver_combo_changed": self.change_field,
"on_fs_source_browse_clicked": self.browse_fs_source,
"on_fs_ram_units_combo_changed": self.change_ram_units,
+ "on_fs_mode_combo_changed": self.notify_change,
+ "on_fs_wrpolicy_combo_changed": self.notify_change,
+ "on_fs_readonly_toggled": self.notify_change,
+ "on_fs_format_combo_changed": self.notify_change,
+ "on_fs_source_changed": self.notify_change,
+ "on_fs_ram_source_changed": self.notify_change,
+ "on_fs_target_changed": self.notify_change,
})
def _cleanup(self):
@@ -239,6 +251,9 @@ class vmmFSDetails(vmmGObjectUI):
label.set_text(value)
# listeners
+ def notify_change(self, ignore):
+ self.emit("changed")
+
def browse_fs_source(self, ignore1):
self._browse_file(self.widget("fs-source"), isdir=True)
@@ -287,6 +302,7 @@ class vmmFSDetails(vmmGObjectUI):
def change_field(self, src):
self.update_fs_rows()
+ self.notify_change(src)
def change_ram_units(self, ignore):
units = self.get_config_fs_units()
--
1.8.5.2
More information about the virt-tools-list
mailing list