Skip to content

Commit 1e23d6b

Browse files
server: enable KVM volume and VM snapshot by default (#11446)
Signed-off-by: Rohit Yadav <[email protected]>
1 parent 162c45f commit 1e23d6b

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

engine/schema/src/main/resources/META-INF/db/schema-410to420.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ CREATE TABLE `cloud_usage`.`usage_vmsnapshot` (
23052305
) ENGINE=InnoDB CHARSET=utf8;
23062306

23072307
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)');
2308-
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'kvm.snapshot.enabled', 'false', 'whether snapshot is enabled for KVM hosts');
2308+
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'kvm.snapshot.enabled', 'true', 'whether snapshot is enabled for KVM hosts');
23092309
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');
23102310
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'snapshot.backup.rightafter', 'true', 'backup snapshot right after snapshot is taken');
23112311

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

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

410409
// Advanced
411410
EventPurgeInterval(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@
789789
import com.cloud.storage.GuestOSVO;
790790
import com.cloud.storage.GuestOsCategory;
791791
import com.cloud.storage.ScopeType;
792+
import com.cloud.storage.snapshot.SnapshotManager;
792793
import com.cloud.storage.Storage;
793794
import com.cloud.storage.StorageManager;
794795
import com.cloud.storage.StoragePool;
@@ -4667,7 +4668,6 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
46674668
final boolean isCallerAdmin = _accountService.isAdmin(caller.getId());
46684669
boolean securityGroupsEnabled = false;
46694670
boolean elasticLoadBalancerEnabled;
4670-
boolean KVMSnapshotEnabled;
46714671
String supportELB = "false";
46724672
final List<NetworkVO> networks = networkDao.listSecurityGroupEnabledNetworks();
46734673
if (networks != null && !networks.isEmpty()) {
@@ -4684,7 +4684,7 @@ public Map<String, Object> listCapabilities(final ListCapabilitiesCmd cmd) {
46844684

46854685
final long diskOffMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
46864686
final long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
4687-
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
4687+
final boolean KVMSnapshotEnabled = SnapshotManager.KVMSnapshotEnabled.value();
46884688

46894689
final boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());
46904690

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ public interface SnapshotManager extends Configurable {
5353
public static final ConfigKey<Integer> BackupRetryInterval = new ConfigKey<Integer>(Integer.class, "backup.retry.interval", "Advanced", "300",
5454
"Time in seconds between retries in backing up snapshot to secondary", false, ConfigKey.Scope.Global, null);
5555

56-
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);
56+
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);
57+
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);
5760

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

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

0 commit comments

Comments
 (0)