DaanHoogland commented on code in PR #14256:
URL: https://github.com/apache/cloudstack/pull/14256#discussion_r4182019524


##########
server/src/main/java/org/apache/cloudstack/vm/VmwareCbtMigrationManagerImpl.java:
##########
@@ -2695,6 +2695,22 @@ private boolean 
hasActiveMigrationOnSameConvertHost(VmwareCbtMigrationVO migrati
     }
 
     private void sendCleanupCommand(VmwareCbtMigrationVO migration, boolean 
failOnCleanupError, int waitSeconds) {
+        // Import may finish after cancellation and record the VM without 
changing the Cancelled state.
+        // Its target disks now belong to that VM, so neither cancel nor 
delete may remove them.
+        // This does not prevent source snapshot cleanup or deletion of the 
migration record.

Review Comment:
   ```suggestion
   ```



##########
server/src/main/java/org/apache/cloudstack/vm/VmwareCbtMigrationManagerImpl.java:
##########
@@ -2695,6 +2695,22 @@ private boolean 
hasActiveMigrationOnSameConvertHost(VmwareCbtMigrationVO migrati
     }
 
     private void sendCleanupCommand(VmwareCbtMigrationVO migration, boolean 
failOnCleanupError, int waitSeconds) {
+        // Import may finish after cancellation and record the VM without 
changing the Cancelled state.
+        // Its target disks now belong to that VM, so neither cancel nor 
delete may remove them.
+        // This does not prevent source snapshot cleanup or deletion of the 
migration record.
+        Long importedVmId = migration.getVmId();
+        if (importedVmId == null) {
+            // Re-read before cleanup: an import may have recorded its VM 
since this caller loaded the migration.

Review Comment:
   ```suggestion
   ```



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