[Pkg-libvirt-commits] [virt-manager] 02/08: Disable unavailable clone options
Guido Guenther
agx at moszumanska.debian.org
Sat Dec 24 00:46:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
agx pushed a commit to annotated tag debian/1%1.4.0-4
in repository virt-manager.
commit b83d83623f16b217cef98d787a1cb9d06ea21c43
Author: Guido Günther <agx at sigxcpu.org>
Date: Fri Dec 23 21:28:19 2016 +0100
Disable unavailable clone options
---
.../We-can-t-clone-a-VM-in-some-scenarios.patch | 42 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 43 insertions(+)
diff --git a/debian/patches/We-can-t-clone-a-VM-in-some-scenarios.patch b/debian/patches/We-can-t-clone-a-VM-in-some-scenarios.patch
new file mode 100644
index 0000000..943048e
--- /dev/null
+++ b/debian/patches/We-can-t-clone-a-VM-in-some-scenarios.patch
@@ -0,0 +1,42 @@
+From: Chen Hanxiao <chenhanxiao at gmail.com>
+Date: Thu, 6 Oct 2016 23:12:59 +0800
+Subject: We can't clone a VM in some scenarios, such as a VM is active.
+
+This patch will disable 'Clone' label in VMActionMenu
+if we can't clone a VM,
+as same as we did for 'Clone' button in clone ui page.
+
+Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
+---
+ virtManager/domain.py | 4 ++++
+ virtManager/vmmenu.py | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/virtManager/domain.py b/virtManager/domain.py
+index 3185cf8..b9abc76 100644
+--- a/virtManager/domain.py
++++ b/virtManager/domain.py
+@@ -1651,6 +1651,10 @@ class vmmDomain(vmmLibvirtObject):
+ return self.status() in [libvirt.VIR_DOMAIN_PAUSED]
+ def is_paused(self):
+ return self.status() in [libvirt.VIR_DOMAIN_PAUSED]
++ def is_clonable(self):
++ return self.status() in [libvirt.VIR_DOMAIN_SHUTOFF,
++ libvirt.VIR_DOMAIN_PAUSED,
++ libvirt.VIR_DOMAIN_PMSUSPENDED]
+
+ def run_status(self):
+ return self.pretty_run_status(self.status(), self.has_managed_save())
+diff --git a/virtManager/vmmenu.py b/virtManager/vmmenu.py
+index a1ae375..bb23360 100644
+--- a/virtManager/vmmenu.py
++++ b/virtManager/vmmenu.py
+@@ -128,7 +128,7 @@ class VMActionMenu(_VMMenu):
+ "suspend": bool(vm and vm.is_stoppable()),
+ "resume": bool(vm and vm.is_paused()),
+ "migrate": bool(vm and vm.is_stoppable()),
+- "clone": True,
++ "clone": bool(vm and vm.is_clonable()),
+ }
+ vismap = {
+ "suspend": bool(vm and not vm.is_paused()),
diff --git a/debian/patches/series b/debian/patches/series
index 240fbd4..5c2a378 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ virtinst/fix-path-to-hvmloader.patch
virtinst/Fix-patch-to-pygrub.patch
Mark-Jessie-as-having-qemu-guest-agent.patch
osdict-Don-t-return-virtio1.0-net-as-a-valid-device-name.patch
+We-can-t-clone-a-VM-in-some-scenarios.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/virt-manager.git
More information about the Pkg-libvirt-commits
mailing list