vmm: api: add configurable downtime and timeout to VmSendMigrationData

Management software needs fine-grained control over live migration to
meet QoS requirements for VM guests. Add `downtime_ms`, `timeout_s`, and
`timeout_strategy` fields to `VmSendMigrationData`, exposed via API.

This commit contains the API changes only; the VMM does not yet act on
these values. This follows in the next commit.

For the JSON API, downtime and timeout are represented as plain integers
(downtime_ms and timeout_s) to make the units explicit. Using Duration
directly would require custom (de)serialization logic, so instead the
internal raw integers are exposed as Duration via getters. This
introduces minor conversion overhead but keeps the Rust API clear and
unambiguous.

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-13 23:26:28 +01:00
committed by Rob Bradford
parent 040fcaed92
commit bbb0f083b0
2 changed files with 170 additions and 7 deletions

View File

@@ -1308,6 +1308,8 @@ impl Vmm {
fn do_memory_migration(
vm: &mut Vm,
socket: &mut SocketStream,
// Used in next commit
_send_data_migration: &VmSendMigrationData,
) -> result::Result<(), MigratableError> {
const MAX_ITERATIONS: usize = 5;
@@ -1424,7 +1426,7 @@ impl Vmm {
// Now pause VM
vm.pause()?;
} else {
Self::do_memory_migration(vm, &mut socket)?;
Self::do_memory_migration(vm, &mut socket, send_data_migration)?;
}
// We release the locks early to enable locking them on the destination host.
@@ -2438,8 +2440,12 @@ impl RequestHandler for Vmm {
send_data_migration: VmSendMigrationData,
) -> result::Result<(), MigratableError> {
info!(
"Sending migration: destination_url = {}, local = {}",
send_data_migration.destination_url, send_data_migration.local
"Sending migration: destination_url={},local={},downtime={}ms,timeout={}s,timeout_strategy={:?}",
send_data_migration.destination_url,
send_data_migration.local,
send_data_migration.downtime().as_millis(),
send_data_migration.timeout().as_secs(),
send_data_migration.timeout_strategy
);
if !self