Copilot commented on code in PR #13628:
URL: https://github.com/apache/cloudstack/pull/13628#discussion_r3666435853


##########
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java:
##########
@@ -556,7 +556,15 @@ private boolean canBypassSecondaryStorage(DataObject 
srcData, DataObject destDat
                 return true;
             }
 
+            if (Hypervisor.HypervisorType.XenServer.equals(((VolumeInfo) 
srcData).getHypervisorType())) {
+                return false;
+            }

Review Comment:
   This casts `srcData` to `VolumeInfo` without an `instanceof` guard. If 
`srcData` is not a `VolumeInfo`, this will throw `ClassCastException` at 
runtime and break data motion for non-volume source objects. Fix by guarding 
the cast (e.g., `if (srcData instanceof VolumeInfo && 
XenServer.equals(((VolumeInfo) srcData).getHypervisorType())) { ... }`).



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