Add notification post-livemigration#2792
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds support for post-live-migration notifications in the Guest Emulation Transport (GET) protocol. It introduces a new guest notification type that will allow the host to notify the guest when a live migration has completed, enabling the guest to take appropriate actions in response.
Changes:
- Adds
NOTIFY_POST_LIVE_MIGRATIONguest notification to the GET protocol - Implements callback infrastructure for handling post-live-migration notifications
- Integrates the notification callback setup in OpenHCL worker initialization
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| vm/devices/get/get_protocol/src/lib.rs | Defines new NOTIFY_POST_LIVE_MIGRATION guest notification constant |
| vm/devices/get/guest_emulation_transport/src/process_loop.rs | Adds message type, field storage, and notification handling for post-live-migration callback |
| vm/devices/get/guest_emulation_transport/src/client.rs | Adds public API method to set the post-live-migration notification callback |
| openhcl/underhill_core/src/worker.rs | Attempts to wire up the callback in OpenHCL initialization |
89cd82a to
8df0c14
Compare
8df0c14 to
96f62f7
Compare
96f62f7 to
22b442f
Compare
| &mut self, | ||
| _notification: get_protocol::PostLiveMigrationNotification, | ||
| ) { | ||
| tracing::info!(CVM_ALLOWED, "notify_post_live_migration"); |
There was a problem hiding this comment.
The callback stored in self.post_live_migration is never actually invoked. Looking at the similar handle_debug_interrupt_notification function (lines 1565-1587), the callback should be called if it exists. The handler should invoke the callback like this: if let Some(callback) = self.post_live_migration.as_ref() { callback() }
| tracing::info!(CVM_ALLOWED, "notify_post_live_migration"); | |
| tracing::info!(CVM_ALLOWED, "notify_post_live_migration"); | |
| if let Some(callback) = self.post_live_migration.as_ref() { | |
| callback(); | |
| } |
| .notify(msg::Msg::SetDebugInterruptCallback(callback.into())); | ||
| } | ||
|
|
||
| /// Set the the callback to handle PostLiveMigrationNotification. |
There was a problem hiding this comment.
Duplicate word "the" in the comment. Should be "Set the callback to handle PostLiveMigrationNotification."
| /// Set the the callback to handle PostLiveMigrationNotification. | |
| /// Set the callback to handle PostLiveMigrationNotification. |
| /// Store the callback to trigger the debug interrupt. | ||
| // TODO: Consider a strategy that avoids LocalOnly here. | ||
| SetDebugInterruptCallback(LocalOnly<Box<dyn Fn(u8) + Send + Sync>>), | ||
| /// Notify that livemigration has finished. |
There was a problem hiding this comment.
The term should be "live migration" (two words) instead of "livemigration" (one word) for consistency with standard terminology and the rest of the codebase.
| /// Notify that livemigration has finished. | |
| /// Notify that live migration has finished. |
There was a problem hiding this comment.
More searchable this way?
Thanks for this contribution, Jay! I'd like to understand more why we are changing what has been a fundamental principal of the Hyper-V Live Migration guarantees. I'm sure there's a good reason, but can you share more info? I understand if there are parts of this conversation that we need to take offline since they refer to Hyper-V behavior. |
| GuestNotifications::INJECT_DEBUG_INTERRUPT => { | ||
| self.handle_debug_interrupt_notification(read_guest_notification(id, buf)?)?; | ||
| } | ||
| GuestNotifications::NOTIFY_POST_LIVE_MIGRATION => { |
There was a problem hiding this comment.
This loop will silently ignore messages that it does not understand. So, when an older version of OpenHCL runs on one of the hosts that sends this message, that openhcl will ignore it. Is that safe for the scenario?
(Also: older hosts won't send this message, is that safe?)
There was a problem hiding this comment.
We have no dependency on this yet, so..it should be OK?
There was a problem hiding this comment.
It should. This is a notification, not a request - for clarity, the guest doesn't get a chance to veto LM.
There was a problem hiding this comment.
- What happens to the hardware without notification?
- Should there be a vetoable check early on before migration?
There is hardware that will need to rederive some state when on a new host. |
22b442f to
1b6872b
Compare
This pull request adds a notification post-livemigration.
Guests are not generally meant to be aware of live migration, but there are or soon will be exceptions, and this will support them.