weizhouapache commented on code in PR #11039:
URL: https://github.com/apache/cloudstack/pull/11039#discussion_r2318799210
##########
engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java:
##########
@@ -479,24 +490,38 @@ public boolean deleteVMSnapshotFromDB(VMSnapshot
vmSnapshot, boolean unmanage) {
@Override
public StrategyPriority canHandle(Long vmId, Long rootPoolId, boolean
snapshotMemory) {
UserVmVO vm = userVmDao.findById(vmId);
+ String cantHandleLog = String.format("Default VM snapshot cannot
handle VM snapshot for [%s]", vm);
if (State.Running.equals(vm.getState()) && !snapshotMemory) {
- logger.debug("Default VM snapshot strategy cannot handle VM
snapshot for [{}] as it is running and its memory will not be affected.", vm);
+ logger.debug("{} as it is running and its memory will not be
affected.", cantHandleLog, vm);
return StrategyPriority.CANT_HANDLE;
}
if (vmHasKvmDiskOnlySnapshot(vm)) {
- logger.debug("Default VM snapshot strategy cannot handle VM
snapshot for [{}] as it has a disk-only VM snapshot using
kvmFileBasedStorageSnapshot strategy." +
- "These two strategies are not compatible, as reverting a
disk-only VM snapshot will erase newer disk-and-memory VM snapshots.", vm);
+ logger.debug("{} as it is not compatible with disk-only VM
snapshot on KVM. As disk-and-memory snapshots use internal snapshots and
disk-only VM snapshots use" +
+ " external snapshots. When restoring external snapshots,
any newer internal snapshots are lost.", cantHandleLog);
return StrategyPriority.CANT_HANDLE;
}
List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
for (VolumeVO volume : volumes) {
if (volume.getFormat() != ImageFormat.QCOW2) {
- 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);
+ logger.debug("{} as it has a volume [{}] that is not in the
QCOW2 format.", cantHandleLog, vm, volume);
+ return StrategyPriority.CANT_HANDLE;
+ }
+
+ if
(CollectionUtils.isNotEmpty(snapshotDao.listByVolumeIdAndTypeNotInAndStateNotRemoved(volume.getId(),
Snapshot.Type.GROUP))) {
+ logger.debug("{} as it has a volume [{}] with volume
snapshots. As disk-and-memory snapshots use internal snapshots and volume
snapshots use external" +
+ " snapshots. When restoring external snapshots, any
newer internal snapshots are lost.", cantHandleLog, volume);
return StrategyPriority.CANT_HANDLE;
}
}
+
+ BackupOfferingVO backupOffering =
backupOfferingDao.findById(vm.getBackupOfferingId());
+ if (backupOffering != null &&
"nas".equals(backupOffering.getProvider())) {
Review Comment:
good
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]