vm-migration: improve logging to make clear if receiver caused failure

This improves the observability whether a migration failed because of
the sender or because of some error on the receiving side.

Using a simple log message is simpler than introducing a new error enum
to differentiate between SendError and RemoteError.

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Philipp Schuster
2026-06-29 11:18:40 +02:00
committed by Bo Chen
parent 969d2f855d
commit 81022ab087

View File

@@ -91,6 +91,7 @@ use std::ops::RangeInclusive;
use anyhow::anyhow;
use itertools::Itertools;
use log::error;
use serde::{Deserialize, Serialize};
use zerocopy::{FromBytes, Immutable, IntoBytes, TryFromBytes};
@@ -363,9 +364,10 @@ impl Response {
}
/// Return the response if its status is `Ok`; return the caller-provided error for any other status.
pub fn ok_or_error(self, error: MigratableError) -> Result<Response, MigratableError> {
pub fn ok_or_error(self, sender_error: MigratableError) -> Result<Response, MigratableError> {
if self.status != Status::Ok {
return Err(error);
error!("Receiver reported error: aborting migration");
return Err(sender_error);
}
Ok(self)
}