Skip to content

Commit b29c3fe

Browse files
rohityadavclouddhslove
authored andcommitted
server: enable KVM volume and VM snapshot by default (apache#11446)
Signed-off-by: Rohit Yadav <[email protected]>
1 parent 11a8eb7 commit b29c3fe

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

server/src/main/java/com/cloud/configuration/Config.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ public enum Config {
512512
"300",
513513
"The time interval in seconds when the management server polls for snapshots to be scheduled.",
514514
null),
515-
KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class, "kvm.snapshot.enabled", "false", "Whether volume snapshot is enabled on running instances on a KVM host", null),
516515

517516
// Advanced
518517
EventPurgeInterval(

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@
831831
import com.cloud.storage.GuestOSVO;
832832
import com.cloud.storage.GuestOsCategory;
833833
import com.cloud.storage.ScopeType;
834+
import com.cloud.storage.snapshot.SnapshotManager;
834835
import com.cloud.storage.Storage;
835836
import com.cloud.storage.StorageManager;
836837
import com.cloud.storage.StoragePool;
@@ -5081,7 +5082,7 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
50815082

50825083
final long diskOffMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
50835084
final long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
5084-
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
5085+
final boolean KVMSnapshotEnabled = SnapshotManager.KVMSnapshotEnabled.value();
50855086

50865087
final boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
50875088

server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ public interface SnapshotManager extends Configurable {
5656
public static final ConfigKey<Boolean> BackupSnapshotAfterTakingSnapshot = new ConfigKey<Boolean>(Boolean.class, "snapshot.backup.to.secondary", "Snapshots", "false",
5757
"Indicates whether to always backup primary storage snapshot to secondary storage. Keeping snapshots only on Primary storage is applicable for KVM + Ceph only.", false, ConfigKey.Scope.Global, null);
5858

59-
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. Requieres qemu version 1.6+ (on NFS or Local file system) and qemu-guest-agent installed on guest VM", true, ConfigKey.Scope.Global, null);
59+
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);
60+
61+
ConfigKey<Boolean> KVMSnapshotEnabled = new ConfigKey<>(Boolean.class, "kvm.snapshot.enabled", "Snapshots", "true", "Whether volume snapshot is enabled on running instances " +
62+
"on a KVM hosts", false, ConfigKey.Scope.Global, null);
6063

6164
ConfigKey<Boolean> kvmIncrementalSnapshot = new ConfigKey<>(Boolean.class, "kvm.incremental.snapshot", "Snapshots", "false", "Whether differential snapshots are enabled for" +
6265
" 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);

server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public String getConfigComponentName() {
298298
@Override
299299
public ConfigKey<?>[] getConfigKeys() {
300300
return new ConfigKey<?>[] {BackupRetryAttempts, BackupRetryInterval, SnapshotHourlyMax, SnapshotDailyMax, SnapshotMonthlyMax, SnapshotWeeklyMax, usageSnapshotSelection,
301-
SnapshotInfo.BackupSnapshotAfterTakingSnapshot, VmStorageSnapshotKvm, kvmIncrementalSnapshot, snapshotDeltaMax, snapshotShowChainSize, UseStorageReplication};
301+
SnapshotInfo.BackupSnapshotAfterTakingSnapshot, VmStorageSnapshotKvm, kvmIncrementalSnapshot, snapshotDeltaMax, snapshotShowChainSize, UseStorageReplication, KVMSnapshotEnabled};
302302
}
303303

304304
@Override
@@ -1561,7 +1561,7 @@ private boolean hostSupportsSnapsthotForVolume(HostVO host, VolumeInfo volume, b
15611561
if (vmId != null) {
15621562
VMInstanceVO vm = _vmDao.findById(vmId);
15631563
if (vm.getState() != VirtualMachine.State.Stopped && vm.getState() != VirtualMachine.State.Destroyed) {
1564-
boolean snapshotEnabled = Boolean.parseBoolean(_configDao.getValue("kvm.snapshot.enabled"));
1564+
boolean snapshotEnabled = KVMSnapshotEnabled.value();
15651565
if (!snapshotEnabled && !isFromVmSnapshot) {
15661566
logger.debug("Snapshot is not supported on host " + host + " for the volume " + volume + " attached to the vm " + vm);
15671567
return false;

0 commit comments

Comments
 (0)