mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: migration: emit lifecycle events
Emit migration lifecycle events via the event monitor.
This aligns migration with other VM lifecycle operations such as boot,
pause, and resume, allowing external management software to observe
migration progress consistently.
Events emitted:
src:
vm.migration-started
vm.migration-finished
vm.migration-failed
dst:
vm.migration-receive-started
vm.migration-receive-finished
vm.migration-receive-failed
Please note that these features are independent of an upcoming new
endpoint to fetch migration statistics.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
5c93bcf2d7
commit
b90634a887
@@ -2305,6 +2305,8 @@ impl RequestHandler for Vmm {
|
||||
// Accept the connection and get the socket
|
||||
let mut socket = Vmm::receive_migration_socket(&receive_data_migration.receiver_url)?;
|
||||
|
||||
event!("vm", "migration-receive-started");
|
||||
|
||||
let mut state = ReceiveMigrationState::Established;
|
||||
|
||||
while !state.finished() {
|
||||
@@ -2334,8 +2336,11 @@ impl RequestHandler for Vmm {
|
||||
}
|
||||
|
||||
if let ReceiveMigrationState::Aborted = state {
|
||||
event!("vm", "migration-receive-failed");
|
||||
self.vm = None;
|
||||
self.vm_config = None;
|
||||
} else {
|
||||
event!("vm", "migration-receive-finished");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -2379,6 +2384,7 @@ impl RequestHandler for Vmm {
|
||||
)));
|
||||
}
|
||||
|
||||
event!("vm", "migration-started");
|
||||
Self::send_migration(
|
||||
vm,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
@@ -2387,6 +2393,7 @@ impl RequestHandler for Vmm {
|
||||
)
|
||||
.map_err(|migration_err| {
|
||||
error!("Migration failed: {migration_err:?}");
|
||||
event!("vm", "migration-failed");
|
||||
|
||||
// Stop logging dirty pages only for non-local migrations
|
||||
if !send_data_migration.local
|
||||
@@ -2404,6 +2411,8 @@ impl RequestHandler for Vmm {
|
||||
migration_err
|
||||
})?;
|
||||
|
||||
event!("vm", "migration-finished");
|
||||
|
||||
// Shutdown the VM after the migration succeeded
|
||||
self.exit_evt.write(1).map_err(|e| {
|
||||
MigratableError::MigrateSend(anyhow!(
|
||||
|
||||
Reference in New Issue
Block a user