()
| 5253 | #[test] |
| 5254 | #[cfg(not(feature = "mshv"))] |
| 5255 | fn test_ovs_dpdk() { |
| 5256 | let disk_config1 = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); |
| 5257 | let guest1 = Guest::new(Box::new(disk_config1)); |
| 5258 | |
| 5259 | let disk_config2 = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); |
| 5260 | let guest2 = Guest::new(Box::new(disk_config2)); |
| 5261 | let api_socket_source = format!("{}.1", temp_api_path(&guest2.tmp_dir)); |
| 5262 | |
| 5263 | let (mut child1, mut child2) = |
| 5264 | setup_ovs_dpdk_guests(&guest1, &guest2, &api_socket_source, false); |
| 5265 | |
| 5266 | // Create the snapshot directory |
| 5267 | let snapshot_dir = temp_snapshot_dir_path(&guest2.tmp_dir); |
| 5268 | |
| 5269 | let r = std::panic::catch_unwind(|| { |
| 5270 | // Remove one of the two ports from the OVS bridge |
| 5271 | assert!(exec_host_command_status("ovs-vsctl del-port vhost-user1").success()); |
| 5272 | |
| 5273 | // Spawn a new netcat listener in the first VM |
| 5274 | let guest_ip = guest1.network.guest_ip0.clone(); |
| 5275 | thread::spawn(move || { |
| 5276 | ssh_command_ip( |
| 5277 | "nc -l 12345", |
| 5278 | &guest_ip, |
| 5279 | DEFAULT_SSH_RETRIES, |
| 5280 | DEFAULT_SSH_TIMEOUT, |
| 5281 | ) |
| 5282 | .unwrap(); |
| 5283 | }); |
| 5284 | |
| 5285 | guest1 |
| 5286 | .wait_for_ssh_command( |
| 5287 | "ss -ltnH | awk '{print $4}' | grep -q ':12345$'", |
| 5288 | Duration::from_secs(20), |
| 5289 | ) |
| 5290 | .unwrap(); |
| 5291 | |
| 5292 | // Check the connection fails this time |
| 5293 | guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap_err(); |
| 5294 | |
| 5295 | // Add the OVS port back |
| 5296 | assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient1").success()); |
| 5297 | |
| 5298 | // And finally check the connection is functional again |
| 5299 | guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap(); |
| 5300 | |
| 5301 | // Pause the VM |
| 5302 | assert!(remote_command(&api_socket_source, "pause", None)); |
| 5303 | |
| 5304 | // Take a snapshot from the VM |
| 5305 | assert!(remote_command( |
| 5306 | &api_socket_source, |
| 5307 | "snapshot", |
| 5308 | Some(format!("file://{snapshot_dir}").as_str()), |
| 5309 | )); |
| 5310 | |
| 5311 | // Wait for the source VM snapshot artifacts to be ready. |
| 5312 | assert!(wait_until(Duration::from_secs(10), || { |
nothing calls this directly
no test coverage detected