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

dahn 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 1e23d6bc205 server: enable KVM volume and VM snapshot by default 
(#11446)
1e23d6bc205 is described below

commit 1e23d6bc205c3f65dc631bf8624b37ba37c9ae6c
Author: Rohit Yadav <[email protected]>
AuthorDate: Mon Oct 13 13:23:11 2025 +0530

    server: enable KVM volume and VM snapshot by default (#11446)
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 engine/schema/src/main/resources/META-INF/db/schema-410to420.sql     | 2 +-
 server/src/main/java/com/cloud/configuration/Config.java             | 1 -
 server/src/main/java/com/cloud/server/ManagementServerImpl.java      | 4 ++--
 server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java | 5 ++++-
 .../main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java    | 4 ++--
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql 
b/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql
index 35f73b35d3c..d62a9bb9303 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql
@@ -2305,7 +2305,7 @@ CREATE TABLE `cloud_usage`.`usage_vmsnapshot` (
 ) ENGINE=InnoDB CHARSET=utf8;
 
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 
'management-server', 'healthcheck.update.interval', '600', 'Time Interval to 
fetch the LB health check states (in sec)');
-INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 
'SnapshotManager', 'kvm.snapshot.enabled', 'false', 'whether snapshot is 
enabled for KVM hosts');
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 
'SnapshotManager', 'kvm.snapshot.enabled', 'true', 'whether snapshot is enabled 
for KVM hosts');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 
'management-server', 'eip.use.multiple.netscalers', 'false', 'Should be set to 
true, if there will be multiple NetScaler devices providing EIP service in a 
zone');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 
'SnapshotManager', 'snapshot.backup.rightafter', 'true', 'backup snapshot right 
after snapshot is taken');
 
diff --git a/server/src/main/java/com/cloud/configuration/Config.java 
b/server/src/main/java/com/cloud/configuration/Config.java
index d728c251af7..3e039e44c0c 100644
--- a/server/src/main/java/com/cloud/configuration/Config.java
+++ b/server/src/main/java/com/cloud/configuration/Config.java
@@ -405,7 +405,6 @@ public enum Config {
             "300",
             "The time interval in seconds when the management server polls for 
snapshots to be scheduled.",
             null),
-    KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class, 
"kvm.snapshot.enabled", "false", "Whether volume snapshot is enabled on running 
instances on a KVM host", null),
 
     // Advanced
     EventPurgeInterval(
diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java 
b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
index 1b96cd4ef15..a84dfc13933 100644
--- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
@@ -789,6 +789,7 @@ import com.cloud.storage.GuestOSHypervisorVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.GuestOsCategory;
 import com.cloud.storage.ScopeType;
+import com.cloud.storage.snapshot.SnapshotManager;
 import com.cloud.storage.Storage;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
@@ -4667,7 +4668,6 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
         final boolean isCallerAdmin = _accountService.isAdmin(caller.getId());
         boolean securityGroupsEnabled = false;
         boolean elasticLoadBalancerEnabled;
-        boolean KVMSnapshotEnabled;
         String supportELB = "false";
         final List<NetworkVO> networks = 
networkDao.listSecurityGroupEnabledNetworks();
         if (networks != null && !networks.isEmpty()) {
@@ -4684,7 +4684,7 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
 
         final long diskOffMinSize = 
VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
         final long diskOffMaxSize = 
VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
-        KVMSnapshotEnabled = 
Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
+        final boolean KVMSnapshotEnabled = 
SnapshotManager.KVMSnapshotEnabled.value();
 
         final boolean userPublicTemplateEnabled = 
TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
 
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 6e2059e5776..b245a371969 100644
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
@@ -53,7 +53,10 @@ public interface SnapshotManager extends Configurable {
     public static final ConfigKey<Integer> BackupRetryInterval = new 
ConfigKey<Integer>(Integer.class, "backup.retry.interval", "Advanced", "300",
             "Time in seconds between retries in backing up snapshot to 
secondary", false, ConfigKey.Scope.Global, null);
 
-    public static final ConfigKey<Boolean> VmStorageSnapshotKvm = new 
ConfigKey<>(Boolean.class, "kvm.vmstoragesnapshot.enabled", "Snapshots", 
"false", "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);
+    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);
 
     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 57209fe58ed..4f91a66552e 100755
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -298,7 +298,7 @@ public class SnapshotManagerImpl extends 
MutualExclusiveIdsManagerBase implement
     @Override
     public ConfigKey<?>[] getConfigKeys() {
         return new ConfigKey<?>[] {BackupRetryAttempts, BackupRetryInterval, 
SnapshotHourlyMax, SnapshotDailyMax, SnapshotMonthlyMax, SnapshotWeeklyMax, 
usageSnapshotSelection,
-                SnapshotInfo.BackupSnapshotAfterTakingSnapshot, 
VmStorageSnapshotKvm, kvmIncrementalSnapshot, snapshotDeltaMax, 
snapshotShowChainSize, UseStorageReplication};
+                SnapshotInfo.BackupSnapshotAfterTakingSnapshot, 
VmStorageSnapshotKvm, kvmIncrementalSnapshot, snapshotDeltaMax, 
snapshotShowChainSize, UseStorageReplication, KVMSnapshotEnabled};
     }
 
     @Override
@@ -1537,7 +1537,7 @@ public class SnapshotManagerImpl extends 
MutualExclusiveIdsManagerBase implement
         if (vmId != null) {
             VMInstanceVO vm = _vmDao.findById(vmId);
             if (vm.getState() != VirtualMachine.State.Stopped && vm.getState() 
!= VirtualMachine.State.Destroyed) {
-                boolean snapshotEnabled = 
Boolean.parseBoolean(_configDao.getValue("kvm.snapshot.enabled"));
+                boolean snapshotEnabled = KVMSnapshotEnabled.value();
                 if (!snapshotEnabled && !isFromVmSnapshot) {
                     logger.debug("Snapshot is not supported on host " + host + 
" for the volume " + volume + " attached to the vm " + vm);
                     return false;

Reply via email to