vm-migration: add MemoryMigrationContext for precopy metrics

Introduce MemoryMigrationContext to track internal metrics of an ongoing
precopy memory migration.

The context aggregates information such as iteration count, transferred
bytes, durations, bandwidth, and estimated downtime. This enables
migration logic to make decisions based on runtime characteristics,
such as terminating iterations once the expected downtime is below a
target threshold.

The type is used in the next commit to implement iteration-based
migration metrics.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2026-03-10 09:19:58 +01:00
committed by Rob Bradford
parent 447a4c236b
commit beb5808406
3 changed files with 413 additions and 0 deletions

View File

@@ -376,6 +376,11 @@ impl MemoryRangeTable {
}
Self { data }
}
/// Returns the effective size in bytes.
pub fn effective_size(&self) -> u64 {
self.data.iter().map(|r| r.length).sum()
}
}
#[cfg(test)]