[Kimchi-devel] [PATCH][Kimchi 1/2] Bug fix #1029: Unable to create a snapshot on a running guest

Ramon Medeiros ramonn at linux.vnet.ibm.com
Thu Jan 19 18:06:21 UTC 2017


Libvirt supports live snapshot. This patch just removes the limitation
to run snapshot only on turned off guests

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 i18n.py                             | 1 -
 model/vmsnapshots.py                | 7 ++-----
 ui/js/src/kimchi.guest_edit_main.js | 3 ---
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/i18n.py b/i18n.py
index 6e2daa8..f505693 100644
--- a/i18n.py
+++ b/i18n.py
@@ -344,7 +344,6 @@ messages = {
     "KCHVMSTOR0020E": _("On s390x arch 'format' must be specified while attaching disk to virtual machine"),
     "KCHVMSTOR0021E": _("Virtual disk already exists on the system: %(disk_path)s"),
 
-    "KCHSNAP0001E": _("Virtual machine '%(vm)s' must be stopped before creating a snapshot of it."),
     "KCHSNAP0002E": _("Unable to create snapshot '%(name)s' on virtual machine '%(vm)s'. Details: %(err)s"),
     "KCHSNAP0003E": _("Snapshot '%(name)s' does not exist on virtual machine '%(vm)s'."),
     "KCHSNAP0004E": _("Unable to retrieve snapshot '%(name)s' on virtual machine '%(vm)s'. Details: %(err)s"),
diff --git a/model/vmsnapshots.py b/model/vmsnapshots.py
index 6589306..8c30a53 100644
--- a/model/vmsnapshots.py
+++ b/model/vmsnapshots.py
@@ -1,7 +1,7 @@
 #
 # Project Kimchi
 #
-# Copyright IBM Corp, 2015-2016
+# Copyright IBM Corp, 2015-2017
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -28,7 +28,7 @@ from wok.exception import InvalidOperation, NotFoundError, OperationFailed
 from wok.xmlutils.utils import xpath_get_text
 from wok.model.tasks import TaskModel
 
-from wok.plugins.kimchi.model.vms import DOM_STATE_MAP, VMModel
+from wok.plugins.kimchi.model.vms import VMModel
 from wok.plugins.kimchi.model.vmstorages import VMStorageModel, VMStoragesModel
 
 
@@ -57,9 +57,6 @@ class VMSnapshotsModel(object):
         """
         if params is None:
             params = {}
-        vir_dom = VMModel.get_vm(vm_name, self.conn)
-        if DOM_STATE_MAP[vir_dom.info()[0]] != u'shutoff':
-            raise InvalidOperation('KCHSNAP0001E', {'vm': vm_name})
 
         # if the VM has a non-CDROM disk with type 'raw', abort.
         for storage_name in self.vmstorages.get_list(vm_name):
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 1682a58..b47d293 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -961,9 +961,6 @@ kimchi.guest_edit_main = function() {
                 addOngoingItem(task);
             });
         });
-        if (kimchi.thisVMState === "running") {
-            $("button", "#form-guest-edit-snapshot").remove();
-        }
     };
 
     var initContent = function(guest) {
-- 
2.7.4



More information about the Kimchi-devel mailing list