Skip to content

Commit d5f8d05

Browse files
committed
Address reviews
1 parent 2433f7c commit d5f8d05

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,20 +480,20 @@ public boolean deleteVMSnapshotFromDB(VMSnapshot vmSnapshot, boolean unmanage) {
480480
public StrategyPriority canHandle(Long vmId, Long rootPoolId, boolean snapshotMemory) {
481481
UserVmVO vm = userVmDao.findById(vmId);
482482
if (State.Running.equals(vm.getState()) && !snapshotMemory) {
483-
logger.debug("Default VM snapshot cannot handle VM snapshot for [{}] as it is running and its memory will not be affected.", vm);
483+
logger.debug("Default VM snapshot strategy cannot handle VM snapshot for [{}] as it is running and its memory will not be affected.", vm);
484484
return StrategyPriority.CANT_HANDLE;
485485
}
486486

487487
if (vmHasKvmDiskOnlySnapshot(vm)) {
488-
logger.debug("Default VM snapshot cannot handle VM snapshot for [{}] as it has a disk-only VM snapshot using kvmFileBasedStorageSnapshot strategy." +
488+
logger.debug("Default VM snapshot strategy cannot handle VM snapshot for [{}] as it has a disk-only VM snapshot using kvmFileBasedStorageSnapshot strategy." +
489489
"These two strategies are not compatible, as reverting a disk-only VM snapshot will erase newer disk-and-memory VM snapshots.", vm);
490490
return StrategyPriority.CANT_HANDLE;
491491
}
492492

493493
List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
494494
for (VolumeVO volume : volumes) {
495495
if (volume.getFormat() != ImageFormat.QCOW2) {
496-
logger.debug("Default VM snapshot cannot handle VM snapshot for [{}] as it has a volume [{}] that is not in the QCOW2 format.", vm, volume);
496+
logger.debug("Default VM snapshot strategy cannot handle VM snapshot for [{}] as it has a volume [{}] that is not in the QCOW2 format.", vm, volume);
497497
return StrategyPriority.CANT_HANDLE;
498498
}
499499
}

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/KvmFileBasedStorageVmSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ public boolean revertVMSnapshot(VMSnapshot vmSnapshot) {
175175
}
176176

177177
VMSnapshotVO vmSnapshotBeingReverted = (VMSnapshotVO) vmSnapshot;
178+
Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshotBeingReverted.getVmId());
178179

179180
transitStateWithoutThrow(vmSnapshotBeingReverted, VMSnapshot.Event.RevertRequested);
180181

181-
Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshotBeingReverted.getVmId());
182182
List<SnapshotDataStoreVO> volumeSnapshots = getVolumeSnapshotsAssociatedWithVmSnapshot(vmSnapshotBeingReverted);
183183
List<SnapshotObjectTO> volumeSnapshotTos = volumeSnapshots.stream()
184184
.map(snapshot -> (SnapshotObjectTO) snapshotDataFactory.getSnapshot(snapshot.getSnapshotId(), snapshot.getDataStoreId(), DataStoreRole.Primary).getTO())

0 commit comments

Comments
 (0)