tests: adjust to new dispatch semantics of ch-remote send-migration

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-05-29 07:52:49 +02:00
committed by Bo Chen
parent a56594324c
commit 6a16b65ea6

View File

@@ -7173,6 +7173,8 @@ 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 event_path = temp_event_monitor_path(&guest.tmp_dir);
let src_event_path = format!("{event_path}.src");
let dest_event_path = temp_event_monitor_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
@@ -7183,6 +7185,7 @@ mod common_parallel {
.default_disks() .default_disks()
.args(["--net", net_params.as_str()]) .args(["--net", net_params.as_str()])
.args(["--api-socket", &src_api_socket]) .args(["--api-socket", &src_api_socket])
.args(["--event-monitor", format!("path={src_event_path}").as_str()])
.capture_output(); .capture_output();
let mut src_child = src_vm_cmd.spawn().unwrap(); let mut src_child = src_vm_cmd.spawn().unwrap();
@@ -7259,6 +7262,18 @@ mod common_parallel {
.wait_timeout(Duration::from_secs(60)) .wait_timeout(Duration::from_secs(60))
.unwrap(); .unwrap();
let send_dispatched = match send_status {
Some(status) => status.success(),
None => {
let _ = send_migration.kill();
false
}
};
assert!(
send_dispatched,
"send-migration should have dispatched successfully"
);
// Clean up receive-migration regardless of its outcome // Clean up receive-migration regardless of its outcome
if receive_status.is_none() { if receive_status.is_none() {
let _ = receive_migration.kill(); let _ = receive_migration.kill();
@@ -7270,19 +7285,21 @@ mod common_parallel {
match timeout_strategy { match timeout_strategy {
TimeoutStrategy::Cancel => { TimeoutStrategy::Cancel => {
// With cancel strategy the send must fail and the source VM let expected_events = [
// must keep running. &MetaEvent {
let send_failed = match send_status { event: "migration-started".to_string(),
Some(status) => !status.success(), device_id: None,
None => { },
let _ = send_migration.kill(); &MetaEvent {
false event: "migration-failed".to_string(),
} device_id: None,
}; },
assert!( ];
send_failed, assert!(wait_for_sequential_events(
"send-migration should have failed due to 1s timeout with cancel strategy" Duration::from_secs(30),
); &expected_events,
&src_event_path
));
thread::sleep(Duration::from_secs(2)); thread::sleep(Duration::from_secs(2));
assert!( assert!(
@@ -7294,19 +7311,21 @@ mod common_parallel {
assert_eq!(guest.get_cpu_count().unwrap_or_default(), boot_vcpus); assert_eq!(guest.get_cpu_count().unwrap_or_default(), boot_vcpus);
} }
TimeoutStrategy::Ignore => { TimeoutStrategy::Ignore => {
// With Ignore strategy the send must succeed despite the timeout let expected_events = [
// being reached, and the source VM must have terminated. &MetaEvent {
let send_succeeded = match send_status { event: "migration-started".to_string(),
Some(status) => status.success(), device_id: None,
None => { },
let _ = send_migration.kill(); &MetaEvent {
false event: "migration-finished".to_string(),
} device_id: None,
}; },
assert!( ];
send_succeeded, assert!(wait_for_sequential_events(
"send-migration should have succeeded with timeout_strategy=ignore" Duration::from_secs(30),
); &expected_events,
&src_event_path
));
thread::sleep(Duration::from_secs(3)); thread::sleep(Duration::from_secs(3));
assert!( assert!(