Skip to content

Commit 8bb7d90

Browse files
Move kvm.snapshot.enabled to ConfigKey
1 parent ecb3bb9 commit 8bb7d90

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-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
@@ -504,7 +504,6 @@ public enum Config {
504504
"300",
505505
"The time interval in seconds when the management server polls for snapshots to be scheduled.",
506506
null),
507-
KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class, "kvm.snapshot.enabled", "true", "Whether volume snapshot is enabled on running instances on a KVM host", null),
508507

509508
// Advanced
510509
EventPurgeInterval(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.cloud.network.dao.NetrisProviderDao;
5151
import com.cloud.network.dao.NsxProviderDao;
5252

53+
import com.cloud.storage.snapshot.SnapshotManager;
5354
import com.cloud.utils.security.CertificateHelper;
5455
import com.cloud.api.query.dao.ManagementServerJoinDao;
5556
import com.cloud.api.query.vo.ManagementServerJoinVO;
@@ -4699,7 +4700,6 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
46994700
final boolean isCallerAdmin = _accountService.isAdmin(caller.getId());
47004701
boolean securityGroupsEnabled = false;
47014702
boolean elasticLoadBalancerEnabled = false;
4702-
boolean KVMSnapshotEnabled = false;
47034703
String supportELB = "false";
47044704
final List<NetworkVO> networks = networkDao.listSecurityGroupEnabledNetworks();
47054705
if (networks != null && !networks.isEmpty()) {
@@ -4716,7 +4716,7 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
47164716

47174717
final long diskOffMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
47184718
final long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
4719-
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("kvm.snapshot.enabled"));
4719+
final boolean KVMSnapshotEnabled = SnapshotManager.KVMSnapshotEnabled.value();
47204720

47214721
final boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
47224722

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public interface SnapshotManager extends Configurable {
5555

5656
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);
5757

58+
ConfigKey<Boolean> KVMSnapshotEnabled = new ConfigKey<>(Boolean.class, "kvm.snapshot.enabled", "Snapshots", "true", "Whether volume snapshot is enabled on running instances " +
59+
"on a KVM hosts", false, ConfigKey.Scope.Global, null);
60+
5861
ConfigKey<Boolean> kvmIncrementalSnapshot = new ConfigKey<>(Boolean.class, "kvm.incremental.snapshot", "Snapshots", "false", "Whether differential snapshots are enabled for" +
5962
" 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);
6063

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
@@ -1508,7 +1508,7 @@ private boolean hostSupportsSnapsthotForVolume(HostVO host, VolumeInfo volume, b
15081508
if (vmId != null) {
15091509
VMInstanceVO vm = _vmDao.findById(vmId);
15101510
if (vm.getState() != VirtualMachine.State.Stopped && vm.getState() != VirtualMachine.State.Destroyed) {
1511-
boolean snapshotEnabled = Boolean.parseBoolean(_configDao.getValue("kvm.snapshot.enabled"));
1511+
boolean snapshotEnabled = KVMSnapshotEnabled.value();
15121512
if (!snapshotEnabled && !isFromVmSnapshot) {
15131513
logger.debug("Snapshot is not supported on host " + host + " for the volume " + volume + " attached to the vm " + vm);
15141514
return false;

0 commit comments

Comments
 (0)