[virt-tools-list] [virt-manager PATCH] details: disable config disk with readonly and shareable at the same time

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Tue Jan 28 07:09:49 UTC 2014


From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>

Currently we could config disk with readonly and
shareable at the same time, which is meaningless.
virsh had already discouraged users doing this.
This patch will disable users to config both
readonly and shareable at the same time by UI.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 virtManager/details.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/virtManager/details.py b/virtManager/details.py
index f5aa099..39a016a 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -2033,10 +2033,22 @@ class vmmDetails(vmmGObjectUI):
 
         if self.edited(EDIT_DISK_RO):
             do_readonly = self.widget("disk-readonly").get_active()
+            state_readonly = self.widget("disk-readonly").get_state()
+            state_shareable = self.widget("disk-shareable").get_state()
+            if ((state_readonly == Gtk.StateType.ACTIVE) and
+                    (state_shareable == Gtk.StateType.ACTIVE)):
+                raise ValueError("Readonly and Shareable should not "
+                        "be selected at the same time")
             add_define(self.vm.define_disk_readonly, dev_id_info, do_readonly)
 
         if self.edited(EDIT_DISK_SHARE):
             do_shareable = self.widget("disk-shareable").get_active()
+            state_readonly = self.widget("disk-readonly").get_state()
+            state_shareable = self.widget("disk-shareable").get_state()
+            if ((state_readonly == Gtk.StateType.ACTIVE) and
+                    (state_shareable == Gtk.StateType.ACTIVE)):
+                raise ValueError("Readonly and Shareable should not "
+                        "be selected at the same time")
             add_define(self.vm.define_disk_shareable,
                        dev_id_info, do_shareable)
 
-- 
1.8.2.1




More information about the virt-tools-list mailing list