Skip to content

Commit c77e16a

Browse files
authored
update comments and exception related to kvm.snapshot.enabled configuration (#13733)
1 parent cddd2c6 commit c77e16a

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public interface SnapshotManager extends Configurable {
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

5858
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);
59+
"on KVM hosts", false, ConfigKey.Scope.Global, null);
6060

6161
ConfigKey<Boolean> kvmIncrementalSnapshot = new ConfigKey<>(Boolean.class, "kvm.incremental.snapshot", "Snapshots", "false", "Whether differential snapshots are enabled for" +
6262
" 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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,13 +1528,13 @@ private Type getSnapshotType(IntervalType intvType) {
15281528
return null;
15291529
}
15301530

1531-
private boolean hostSupportsSnapsthotForVolume(HostVO host, VolumeInfo volume, boolean isFromVmSnapshot) {
1531+
private boolean hostSupportsSnapshotForVolume(HostVO host, VolumeInfo volume, boolean isFromVmSnapshot) {
15321532
if (host.getHypervisorType() != HypervisorType.KVM) {
15331533
return true;
15341534
}
15351535

1536-
//Turn off snapshot by default for KVM if the volume attached to vm that is not in the Stopped/Destroyed state,
1537-
//unless it is set in the global flag
1536+
// For KVM, snapshots of a volume attached to a vm that is not in the Stopped/Destroyed state are allowed
1537+
// unless the global flag kvm.snapshot.enabled is turned off (it is enabled by default since 4.22.0.0)
15381538
Long vmId = volume.getInstanceId();
15391539
if (vmId != null) {
15401540
VMInstanceVO vm = _vmDao.findById(vmId);
@@ -1585,9 +1585,12 @@ private boolean supportedByHypervisor(VolumeInfo volume, boolean isFromVmSnapsho
15851585
}
15861586
if (hosts != null && !hosts.isEmpty()) {
15871587
HostVO host = hosts.get(0);
1588-
if (!hostSupportsSnapsthotForVolume(host, volume, isFromVmSnapshot)) {
1588+
if (!hostSupportsSnapshotForVolume(host, volume, isFromVmSnapshot)) {
15891589
throw new CloudRuntimeException(
1590-
"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.");
1590+
"KVM Snapshot is not supported for Running VMs because the global setting " +
1591+
"kvm.snapshot.enabled is set to false for this deployment. It can be disabled to " +
1592+
"avoid a possible volume corruption in certain cases. To allow snapshots of running " +
1593+
"VMs, set kvm.snapshot.enabled to true. See the documentation for more details.");
15911594
}
15921595
}
15931596
}

0 commit comments

Comments
 (0)