This is an automated email from the ASF dual-hosted git repository.

DaanHoogland pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new c77e16a7feb update comments and exception related to 
kvm.snapshot.enabled configuration (#13733)
c77e16a7feb is described below

commit c77e16a7feb6816e07f624b068c67835db23b98f
Author: Manoj Kumar <[email protected]>
AuthorDate: Wed Sep 9 18:42:55 2026 +0530

    update comments and exception related to kvm.snapshot.enabled configuration 
(#13733)
---
 .../java/com/cloud/storage/snapshot/SnapshotManager.java    |  2 +-
 .../com/cloud/storage/snapshot/SnapshotManagerImpl.java     | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java 
b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
index 10dcc2683de..6fcf124a961 100644
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
@@ -56,7 +56,7 @@ public interface SnapshotManager extends Configurable {
     public static final ConfigKey<Boolean> VmStorageSnapshotKvm = new 
ConfigKey<>(Boolean.class, "kvm.vmstoragesnapshot.enabled", "Snapshots", 
"true", "For live snapshot of virtual machine instance on KVM hypervisor 
without memory. Requires qemu version 1.6+ (on NFS or Local file system) and 
qemu-guest-agent installed on guest VM", true, ConfigKey.Scope.Global, null);
 
     ConfigKey<Boolean> KVMSnapshotEnabled = new ConfigKey<>(Boolean.class, 
"kvm.snapshot.enabled", "Snapshots", "true", "Whether volume snapshot is 
enabled on running instances " +
-            "on a KVM hosts", false, ConfigKey.Scope.Global, null);
+            "on KVM hosts", false, ConfigKey.Scope.Global, null);
 
     ConfigKey<Boolean> kvmIncrementalSnapshot = new ConfigKey<>(Boolean.class, 
"kvm.incremental.snapshot", "Snapshots", "false", "Whether differential 
snapshots are enabled for" +
             " KVM or not. When this is enabled, all KVM snapshots will be 
incremental. Bear in mind that it will generate a new full snapshot when the 
snapshot chain reaches the limit defined in snapshot.delta.max.", true, 
ConfigKey.Scope.Cluster, null);
diff --git 
a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java 
b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index dc33a4442a3..2d23e22a015 100755
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -1528,13 +1528,13 @@ public class SnapshotManagerImpl extends 
MutualExclusiveIdsManagerBase implement
         return null;
     }
 
-    private boolean hostSupportsSnapsthotForVolume(HostVO host, VolumeInfo 
volume, boolean isFromVmSnapshot) {
+    private boolean hostSupportsSnapshotForVolume(HostVO host, VolumeInfo 
volume, boolean isFromVmSnapshot) {
         if (host.getHypervisorType() != HypervisorType.KVM) {
             return true;
         }
 
-        //Turn off snapshot by default for KVM if the volume attached to vm 
that is not in the Stopped/Destroyed state,
-        //unless it is set in the global flag
+        // For KVM, snapshots of a volume attached to a vm that is not in the 
Stopped/Destroyed state are allowed
+        // unless the global flag kvm.snapshot.enabled is turned off (it is 
enabled by default since 4.22.0.0)
         Long vmId = volume.getInstanceId();
         if (vmId != null) {
             VMInstanceVO vm = _vmDao.findById(vmId);
@@ -1585,9 +1585,12 @@ public class SnapshotManagerImpl extends 
MutualExclusiveIdsManagerBase implement
             }
             if (hosts != null && !hosts.isEmpty()) {
                 HostVO host = hosts.get(0);
-                if (!hostSupportsSnapsthotForVolume(host, volume, 
isFromVmSnapshot)) {
+                if (!hostSupportsSnapshotForVolume(host, volume, 
isFromVmSnapshot)) {
                     throw new CloudRuntimeException(
-                            "KVM Snapshot is not supported for Running VMs. It 
is disabled by default due to a possible volume corruption in certain cases. To 
enable it set global settings kvm.snapshot.enabled to True. See the 
documentation for more details.");
+                            "KVM Snapshot is not supported for Running VMs 
because the global setting " +
+                                    "kvm.snapshot.enabled is set to false for 
this deployment. It can be disabled to " +
+                                    "avoid a possible volume corruption in 
certain cases. To allow snapshots of running " +
+                                    "VMs, set kvm.snapshot.enabled to true. 
See the documentation for more details.");
                 }
             }
         }

Reply via email to