raniers1 opened a new pull request, #13099:
URL: https://github.com/apache/cloudstack/pull/13099

   
   When iterating over VMs in getBestMigration, the call to 
listHostsForMigrationOfVM throws InvalidParameterValueException for VMs using a 
GPU passthrough profile. This exception was not caught inside the loop, causing 
it to propagate up and abort the entire DRS plan generation for the cluster, 
leaving all other eligible VMs without a migration plan.
   
   Fix wraps the listHostsForMigrationOfVM call in a try-catch block. When the 
exception is caught, the VM is skipped with a debug log message and the loop 
continues evaluating the remaining VMs.
   
   Also adds unit test testGetBestMigrationSkipsPassthroughVm to verify that a 
VM throwing InvalidParameterValueException is skipped while other eligible VMs 
are still considered for migration.
   
   Fixes: #13098
   
   
   ### Types of changes
   
   - [x]  Bug fix (non-breaking change which fixes an issue)
   
   
   #### Bug Severity
   
   - [x] Minor
   
   ### How Has This Been Tested?
   
   - Added unit test testGetBestMigrationSkipsPassthroughVm in 
ClusterDrsServiceImplTest. The test mocks one VM throwing 
InvalidParameterValueException and verifies that the exception is caught, the 
VM is skipped, and the remaining eligible VM is still selected for migration.
   - All 15 tests in ClusterDrsServiceImplTest pass with no failures.
   - Validated in a live environment. After the fix, the VM with host 
passthrough is correctly skipped with a debug log instead of aborting the 
entire cluster DRS plan:
   
   DEBUG [o.a.c.c.ClusterDrsServiceImpl] Skipping VM VM instance
   {"id":621,"instanceName":"i-23-621-VM","state":"Running","type":"User"}
   for DRS, unsupported operation: Unsupported operation, VM uses host 
passthrough, cannot migrate.
   
   


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