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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
 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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux