mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: migration: add vm.migration-receive-ready event
The new event allows management software to handle the migration better via events. The `vm.migration-receive-ready` event tells that the VMM is ready to accept connections whereas `vm.migration-receive-started` means a migration is incoming. On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
bbd271e85b
commit
b241084d0e
@@ -6699,6 +6699,7 @@ mod common_parallel {
|
|||||||
fn start_live_migration_tcp(
|
fn start_live_migration_tcp(
|
||||||
src_api_socket: &str,
|
src_api_socket: &str,
|
||||||
dest_api_socket: &str,
|
dest_api_socket: &str,
|
||||||
|
dest_event_path: &str,
|
||||||
connections: NonZeroU32,
|
connections: NonZeroU32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// Get an available TCP port
|
// Get an available TCP port
|
||||||
@@ -6718,8 +6719,15 @@ mod common_parallel {
|
|||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Give the destination some time to start listening
|
let expected_events = [&MetaEvent {
|
||||||
thread::sleep(Duration::from_secs(1));
|
event: "migration-receive-ready".to_string(),
|
||||||
|
device_id: None,
|
||||||
|
}];
|
||||||
|
assert!(wait_for_sequential_events(
|
||||||
|
Duration::from_secs(30),
|
||||||
|
&expected_events,
|
||||||
|
dest_event_path
|
||||||
|
));
|
||||||
|
|
||||||
// Start the 'send-migration' command on the source
|
// Start the 'send-migration' command on the source
|
||||||
let connections = connections.get();
|
let connections = connections.get();
|
||||||
@@ -6794,6 +6802,7 @@ mod common_parallel {
|
|||||||
let memory_param: &[&str] = &["--memory", "size=1500M,shared=on"];
|
let memory_param: &[&str] = &["--memory", "size=1500M,shared=on"];
|
||||||
let boot_vcpus = 2;
|
let boot_vcpus = 2;
|
||||||
let max_vcpus = 4;
|
let max_vcpus = 4;
|
||||||
|
let dest_event_path = temp_event_monitor_path(&guest.tmp_dir);
|
||||||
let pmem_temp_file = TempFile::new().unwrap();
|
let pmem_temp_file = TempFile::new().unwrap();
|
||||||
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
pmem_temp_file.as_file().set_len(128 << 20).unwrap();
|
||||||
std::process::Command::new("mkfs.ext4")
|
std::process::Command::new("mkfs.ext4")
|
||||||
@@ -6850,6 +6859,10 @@ mod common_parallel {
|
|||||||
dest_api_socket.push_str(".dest");
|
dest_api_socket.push_str(".dest");
|
||||||
let mut dest_child = GuestCommand::new(&guest)
|
let mut dest_child = GuestCommand::new(&guest)
|
||||||
.args(["--api-socket", &dest_api_socket])
|
.args(["--api-socket", &dest_api_socket])
|
||||||
|
.args([
|
||||||
|
"--event-monitor",
|
||||||
|
format!("path={dest_event_path}").as_str(),
|
||||||
|
])
|
||||||
.capture_output()
|
.capture_output()
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -6893,7 +6906,12 @@ mod common_parallel {
|
|||||||
}
|
}
|
||||||
// Start TCP live migration
|
// Start TCP live migration
|
||||||
assert!(
|
assert!(
|
||||||
start_live_migration_tcp(&src_api_socket, &dest_api_socket, connections),
|
start_live_migration_tcp(
|
||||||
|
&src_api_socket,
|
||||||
|
&dest_api_socket,
|
||||||
|
&dest_event_path,
|
||||||
|
connections
|
||||||
|
),
|
||||||
"Unsuccessful command: 'send-migration' or 'receive-migration'."
|
"Unsuccessful command: 'send-migration' or 'receive-migration'."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -6985,6 +7003,7 @@ mod common_parallel {
|
|||||||
|
|
||||||
let src_vm_path = clh_command("cloud-hypervisor");
|
let src_vm_path = clh_command("cloud-hypervisor");
|
||||||
let src_api_socket = temp_api_path(&guest.tmp_dir);
|
let src_api_socket = temp_api_path(&guest.tmp_dir);
|
||||||
|
let dest_event_path = temp_event_monitor_path(&guest.tmp_dir);
|
||||||
let mut src_vm_cmd = GuestCommand::new_with_binary_path(&guest, &src_vm_path);
|
let mut src_vm_cmd = GuestCommand::new_with_binary_path(&guest, &src_vm_path);
|
||||||
src_vm_cmd
|
src_vm_cmd
|
||||||
.args(["--cpus", format!("boot={boot_vcpus}").as_str()])
|
.args(["--cpus", format!("boot={boot_vcpus}").as_str()])
|
||||||
@@ -7001,6 +7020,10 @@ mod common_parallel {
|
|||||||
dest_api_socket.push_str(".dest");
|
dest_api_socket.push_str(".dest");
|
||||||
let mut dest_child = GuestCommand::new(&guest)
|
let mut dest_child = GuestCommand::new(&guest)
|
||||||
.args(["--api-socket", &dest_api_socket])
|
.args(["--api-socket", &dest_api_socket])
|
||||||
|
.args([
|
||||||
|
"--event-monitor",
|
||||||
|
format!("path={dest_event_path}").as_str(),
|
||||||
|
])
|
||||||
.capture_output()
|
.capture_output()
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -7033,7 +7056,15 @@ mod common_parallel {
|
|||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(1));
|
let expected_events = [&MetaEvent {
|
||||||
|
event: "migration-receive-ready".to_string(),
|
||||||
|
device_id: None,
|
||||||
|
}];
|
||||||
|
assert!(wait_for_sequential_events(
|
||||||
|
Duration::from_secs(30),
|
||||||
|
&expected_events,
|
||||||
|
&dest_event_path
|
||||||
|
));
|
||||||
|
|
||||||
// Use a tight downtime budget (1ms) combined with a 1s timeout so the
|
// Use a tight downtime budget (1ms) combined with a 1s timeout so the
|
||||||
// migration practically cannot converge regardless of strategy.
|
// migration practically cannot converge regardless of strategy.
|
||||||
|
|||||||
@@ -2534,6 +2534,9 @@ impl RequestHandler for Vmm {
|
|||||||
|
|
||||||
let mut listener =
|
let mut listener =
|
||||||
migration_transport::receive_migration_listener(&receive_data_migration.receiver_url)?;
|
migration_transport::receive_migration_listener(&receive_data_migration.receiver_url)?;
|
||||||
|
|
||||||
|
event!("vm", "migration-receive-ready");
|
||||||
|
|
||||||
// Accept the connection and get the socket
|
// Accept the connection and get the socket
|
||||||
let mut socket = listener.accept()?;
|
let mut socket = listener.accept()?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user