From 6a3024c13d89c143cbc600985f8c915d2bfe2ef1 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 9 Apr 2026 10:42:55 +0200 Subject: [PATCH] vm-migration: add MemoryMigrationContext::empty_finalized() helper This is helpful in the following to properly aggregate statistics for local migrations. On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster --- vm-migration/src/context.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vm-migration/src/context.rs b/vm-migration/src/context.rs index 338dad9ed..21801c029 100644 --- a/vm-migration/src/context.rs +++ b/vm-migration/src/context.rs @@ -286,6 +286,15 @@ impl MemoryMigrationContext { } } + /// Returns an empty finalized block. + /// + /// This can be used if no memory was transferred (e.g., local migration). + pub fn empty_finalized() -> Self { + let mut this = Self::new(); + this.finalize(); + this + } + /// Updates the metrics right before the transfer over the wire. /// /// Supposed to be called once per precopy memory iteration.