xapi_vm_migrate: Fix reservations not being cleared on halted VMs #6648
+5
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cross-pool migrations set
scheduled_to_be_resident_on
to the destination host, reserving memory and vGPUs. If the VM is still halted when migration is finished, the field is not cleared on the destination, preserving the reservations even though they're not necessarily going to be used anytime soon.Call
force_state_reset_keep_current_operations
inpool_migrate_complete
on the destination to clear the reservations among other things at the end of the migration.This fixes an issue when VMs migrated across pools in a halted state would take up memory in xapi's view (but not in RRD's view), which is not intuitive and could prevent further migrations from claiming enough free memory on the host.
I've tested this manually, confirming that migrating halted and running VMs works as designed, with the
scheduled_to_be_resident_on
field cleared at the end of the migration (in the first case it's because of the fix, in the second one it's because the VM is actually started on the host)