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

Aline Manera alinefm at linux.vnet.ibm.com
Thu Jan 19 12:30:06 UTC 2017


Hi Ramon,

The patch looks good. Just add a new test to cover the snapshot on a 
running VM.

Regards,
Aline manera

On 01/17/2017 01:24 PM, Ramon Medeiros wrote:
> 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                             | 3 +--
>   model/vmsnapshots.py                | 7 ++-----
>   ui/js/src/kimchi.guest_edit_main.js | 3 ---
>   3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/i18n.py b/i18n.py
> index da1391b..c1f27a0 100644
> --- a/i18n.py
> +++ b/i18n.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
> @@ -343,7 +343,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) {



More information about the Kimchi-devel mailing list