weizhouapache commented on code in PR #12617:
URL: https://github.com/apache/cloudstack/pull/12617#discussion_r2817514329


##########
engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java:
##########
@@ -493,10 +501,31 @@ public boolean deleteVMSnapshotFromDB(VMSnapshot 
vmSnapshot, boolean unmanage) {
         return vmSnapshotDao.remove(vmSnapshot.getId());
     }
 
+    protected boolean isRunningVMVolumeOnCLVMStorage(UserVmVO vm, String 
cantHandleLog) {
+        Long vmId = vm.getId();
+        if (State.Running.equals(vm.getState())) {
+            List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+            for (VolumeVO volume : volumes) {
+                StoragePool pool = 
primaryDataStoreDao.findById(volume.getPoolId());
+                if (pool != null && pool.getPoolType() == 
Storage.StoragePoolType.CLVM) {
+                    logger.warn("Rejecting VM snapshot request: {} - VM is 
running on CLVM storage (pool: {}, poolType: CLVM)",
+                            cantHandleLog, pool.getName());
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
     @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 (isRunningVMVolumeOnCLVMStorage(vm, cantHandleLog)) {

Review Comment:
   @Pearl1594 
   what's the image format on CLVM ? RAW or QCOW2 ?
   



-- 
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]

Reply via email to