Fix auto-converge on live migration retry - #189
Conversation
The ThrottleCommand does not need to be Clone (nor Copy) as of now and we will need to introduce a variant wrapping a type that is not Copy in a follow up commit. It is also debatable whether a message type should be Clone, as they are typically intended to be sent only once (and not used for other purposes). Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
In order to add a command for resetting the throttle thread with confirmation we have to add an additional variant that wraps a type that does not implement the PartialEq and Eq traits. We thus need to choose between manually implementing these traits for ThrottleCommand, or avoiding them. We choose the latter because that requires much less code. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
It makes more sense for a command to use the imperative form and the enum does not need to be used to track the throttling thread's current state. This enables us to introduce a reset variant to the enum that asks the throttle thread to stop its throttle loop and inform us when it is back to waiting for the next incoming command. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
b13edd0 to
04f57d3
Compare
amphi
left a comment
There was a problem hiding this comment.
I like it, very clean!
We may want to consider just spawning the throttling thread per live migration attempt instead
We want to avoid spawning more threads than necessary during runtime, because it makes pinning them in libvirt much harder.
04f57d3 to
ceb50ab
Compare
|
@scholzp I introduced one more commit for resetting the throttling thread when do_memory_iterations fails as we do not want the VM to continue running on the migration source with throttled vCPUs. Thanks for the tip! |
ceb50ab to
bff88e7
Compare
Looks great, Thanks! :) |
scholzp
left a comment
There was a problem hiding this comment.
Thank for the nice and clean work! :)
The current behavior of joining the vCPU throttling thread towards the end of a live migration is problematic when the live migration fails because then auto-converge is no longer possible on a second attempt. We fix this by instead resetting the throttling thread to its initial state. The throttling thread is now instead gracefully stopped by the ThrottleThreadHandle's destructor which runs whenever the Vm instance goes out of scope. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
When a live migration fails before all memory iterations have been sent we also need to reset the throttling thread, otherwise the VM continues existing on the migration source with throttled vCPUs. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
bff88e7 to
87f6b17
Compare
Fixes https://github.com/cobaltcore-dev/cobaltcore/issues/642.
We may want to consider just spawning the throttling thread per live migration attempt instead, but since we might very well replace auto-converge with post-copy in the not too distant feature it might not be worth investing too much time in perfecting this now.
The existing libvirt test suite seems to pass on this branch: https://gitlab.cyberus-technology.de/cyberus/cloud/libvirt/-/merge_requests/267, but it would be nice to include an additional test for this particular case.