From b9c260c0de4388142da7db3542736535dc9d06ca Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 11 Jan 2022 16:41:58 +0000 Subject: [PATCH] vmm, ch-remote: Add "local" option to send-migration API Signed-off-by: Rob Bradford --- src/bin/ch-remote.rs | 16 +++++++++++++++- vmm/src/api/mod.rs | 2 ++ vmm/src/lib.rs | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/bin/ch-remote.rs b/src/bin/ch-remote.rs index 9d822512e..8b9c7003b 100644 --- a/src/bin/ch-remote.rs +++ b/src/bin/ch-remote.rs @@ -263,9 +263,14 @@ fn receive_migration_api_command(socket: &mut UnixStream, url: &str) -> Result<( .map_err(Error::ApiClient) } -fn send_migration_api_command(socket: &mut UnixStream, url: &str) -> Result<(), Error> { +fn send_migration_api_command( + socket: &mut UnixStream, + url: &str, + local: bool, +) -> Result<(), Error> { let send_migration_data = vmm::api::VmSendMigrationData { destination_url: url.to_owned(), + local, }; simple_api_command( socket, @@ -402,6 +407,10 @@ fn do_command(matches: &ArgMatches) -> Result<(), Error> { .unwrap() .value_of("send_migration_config") .unwrap(), + matches + .subcommand_matches("send-migration") + .unwrap() + .is_present("send_migration_local"), ), Some("receive-migration") => receive_migration_api_command( &mut socket, @@ -560,6 +569,11 @@ fn main() { Arg::new("send_migration_config") .index(1) .help(""), + ) + .arg( + Arg::new("send_migration_local") + .long("local") + .takes_value(false), ), ) .subcommand( diff --git a/vmm/src/api/mod.rs b/vmm/src/api/mod.rs index a394593b3..147924db7 100644 --- a/vmm/src/api/mod.rs +++ b/vmm/src/api/mod.rs @@ -195,6 +195,8 @@ pub struct VmReceiveMigrationData { pub struct VmSendMigrationData { /// URL to migrate the VM to pub destination_url: String, + /// Send memory across socket without copying + pub local: bool, } pub enum ApiResponsePayload { diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 20f11c0f7..4c0e1529b 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1140,8 +1140,8 @@ impl Vmm { send_data_migration: VmSendMigrationData, ) -> result::Result<(), MigratableError> { info!( - "Sending migration: destination_url = {}", - send_data_migration.destination_url + "Sending migration: destination_url = {}, local = {}", + send_data_migration.destination_url, send_data_migration.local ); if let Some(vm) = self.vm.as_mut() { Self::send_migration(