From c94ee1454d3ecdf1bf371fd18c8e3ec0631d3092 Mon Sep 17 00:00:00 2001 From: Vladimir Melnik Date: Tue, 4 Jun 2019 13:34:45 +0300 Subject: [PATCH] kvm: suspend a VM before snapshot deletion (see PR #3193) (#3194) To make sure that a qemu2-image won't be corrupted by the snapshot deletion procedure which is being performed after copying the snapshot to a secondary store, I'd propose to put a VM in to suspended state. Additional reference: https://bugzilla.redhat.com/show_bug.cgi?id=920020#c5 Fixes #3193 --- .../cloud/hypervisor/kvm/storage/KVMStorageProcessor.java | 6 ++++++ ui/l10n/en.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 36be2d39a2e..53a2278c163 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -996,6 +996,12 @@ public class KVMStorageProcessor implements StorageProcessor { primaryStore.getUuid()); if (state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING && !primaryStorage.isExternalSnapshot()) { final DomainSnapshot snap = vm.snapshotLookupByName(snapshotName); + try { + vm.suspend(); + } catch(final Exception e) { + s_logger.debug("Failed to suspend the VM: " + e); + throw e; + } snap.delete(0); /* diff --git a/ui/l10n/en.js b/ui/l10n/en.js index 86a860616e0..b9f36822b7a 100644 --- a/ui/l10n/en.js +++ b/ui/l10n/en.js @@ -1922,7 +1922,7 @@ var dictionary = {"ICMP.code":"ICMP Code", "message.action.take.snapshot":"Please confirm that you want to take a snapshot of this volume.", "message.action.unmanage.cluster":"Please confirm that you want to unmanage the cluster.", "message.action.vmsnapshot.create":"Please confirm that you want to take a snapshot of this instance.
Please notice that the instance will be paused during the snapshoting, and resumed after snapshotting, if it runs on KVM.", -"message.action.vmsnapshot.delete":"Please confirm that you want to delete this VM snapshot.", +"message.action.vmsnapshot.delete":"Please confirm that you want to delete this VM snapshot.
Please notice that the instance will be paused before the snapshot deletion, and resumed after deletion, if it runs on KVM.", "message.action.vmsnapshot.revert":"Revert VM snapshot", "message.activate.project":"Are you sure you want to activate this project?", "message.add.VPN.gateway":"Please confirm that you want to add a VPN Gateway",