[virt-tools-list] [virt-manager PATCH] details: disable config disk with readonly and shareable at the same time
Cole Robinson
crobinso at redhat.com
Tue Jan 28 14:21:26 UTC 2014
On 01/28/2014 02:09 AM, Chen Hanxiao wrote:
> 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.
>
How does 'virsh' complain? If libvirt throws an error about this, I'd rather
just let it complain and show that error to the user, than reproduce their
error check, since this is a fairly minor corner case.
- Cole
> 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)
>
>
More information about the virt-tools-list
mailing list