vmm: extract a helper to send the VM config

This further decreases boilerplate code in lib.rs while keeping the
behavior.

On-behalf-of: SAP sebastian.eydam@sap.com
Signed-off-by: Sebastian Eydam <sebastian.eydam@cyberus-technology.de>
This commit is contained in:
Sebastian Eydam
2026-03-09 10:41:27 +01:00
committed by Bo Chen
parent d4a8d55074
commit 196e48af30
2 changed files with 23 additions and 11 deletions

View File

@@ -1434,15 +1434,7 @@ impl Vmm {
common_cpuid,
memory_manager_data: vm.memory_manager_data(),
};
let config_data = serde_json::to_vec(&vm_migration_config).unwrap();
Request::config(config_data.len() as u64).write_to(&mut socket)?;
socket
.write_all(&config_data)
.map_err(MigratableError::MigrateSocket)?;
migration_transport::expect_ok_response(
&mut socket,
MigratableError::MigrateSend(anyhow!("Error during config migration")),
)?;
migration_transport::send_config(&mut socket, &vm_migration_config)?;
// Let every Migratable object know about the migration being started.
vm.start_migration()?;