JoaoJandre commented on code in PR #10632:
URL: https://github.com/apache/cloudstack/pull/10632#discussion_r2200487028


##########
engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java:
##########
@@ -626,6 +646,30 @@ public StrategyPriority canHandle(Snapshot snapshot, Long 
zoneId, SnapshotOperat
         return StrategyPriority.DEFAULT;
     }
 
+    private StrategyPriority validateVmSnapshot(Snapshot snapshot) {
+        VolumeVO volumeVO = volumeDao.findById(snapshot.getVolumeId());
+        Long instanceId = volumeVO.getInstanceId();
+        if (instanceId == null) {
+            return StrategyPriority.DEFAULT;
+        }
+
+        VMInstanceVO vm = vmInstanceDao.findById(instanceId);
+        if (vm == null) {
+            return StrategyPriority.DEFAULT;
+        }
+
+        for (VMSnapshotVO vmSnapshotVO : 
vmSnapshotDao.findByVmAndByType(vm.getId(), VMSnapshot.Type.Disk)) {
+            List<VMSnapshotDetailsVO> vmSnapshotDetails = 
vmSnapshotDetailsDao.listDetails(vmSnapshotVO.getId());
+            if (vmSnapshotDetails.stream().anyMatch(vmSnapshotDetailsVO -> 
vmSnapshotDetailsVO.getName().equals(VolumeApiServiceImpl.KVM_FILE_BASED_STORAGE_SNAPSHOT)))
 {
+                logger.warn("VM [{}] already has KVM File-Based storage VM 
snapshots. These VM snapshots and volume snapshots are not supported " +

Review Comment:
   You are right that both are external. 
   
   However, for each VM snapshot, this feature creates a delta on top of the 
current volume, these deltas are not copied anywhere, they stay in the VM's 
backing chain. It is assumed that, when using this feature, if you have VM 
snapshots, at least one of them is part of the VM's backing chain.
   
   When restoring a volume snapshot, the volume of the VM will be overwritten 
with the snapshot.
   
   So restoring a volume snapshot would break the previous assumption.



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to