@@ -8528,6 +8528,8 @@ mod vfio {
85288528}
85298529
85308530mod live_migration {
8531+ use std:: num:: NonZeroU32 ;
8532+
85318533 use vmm:: api:: TimeoutStrategy ;
85328534
85338535 use crate :: * ;
@@ -9701,7 +9703,11 @@ mod live_migration {
97019703 . port ( )
97029704 }
97039705
9704- fn start_live_migration_tcp ( src_api_socket : & str , dest_api_socket : & str ) -> bool {
9706+ fn start_live_migration_tcp (
9707+ src_api_socket : & str ,
9708+ dest_api_socket : & str ,
9709+ connections : NonZeroU32 ,
9710+ ) -> bool {
97059711 // Get an available TCP port
97069712 let migration_port = get_available_port ( ) ;
97079713 let host_ip = "127.0.0.1" ;
@@ -9723,11 +9729,14 @@ mod live_migration {
97239729 thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
97249730
97259731 // Start the 'send-migration' command on the source
9732+ let connections = connections. get ( ) ;
97269733 let mut send_migration = Command :: new ( clh_command ( "ch-remote" ) )
97279734 . args ( [
97289735 & format ! ( "--api-socket={src_api_socket}" ) ,
97299736 "send-migration" ,
9730- & format ! ( "destination_url=tcp:{host_ip}:{migration_port}" ) ,
9737+ & format ! (
9738+ "destination_url=tcp:{host_ip}:{migration_port},connections={connections}"
9739+ ) ,
97319740 ] )
97329741 . stdin ( Stdio :: null ( ) )
97339742 . stderr ( Stdio :: piped ( ) )
@@ -9778,7 +9787,7 @@ mod live_migration {
97789787 send_success && receive_success
97799788 }
97809789
9781- fn _test_live_migration_tcp ( ) {
9790+ fn _test_live_migration_tcp ( connections : NonZeroU32 ) {
97829791 let disk_config = UbuntuDiskConfig :: new ( JAMMY_IMAGE_NAME . to_string ( ) ) ;
97839792 let guest = Guest :: new ( Box :: new ( disk_config) ) ;
97849793 let kernel_path = direct_kernel_boot_path ( ) ;
@@ -9860,7 +9869,7 @@ mod live_migration {
98609869 }
98619870 // Start TCP live migration
98629871 assert ! (
9863- start_live_migration_tcp( & src_api_socket, & dest_api_socket) ,
9872+ start_live_migration_tcp( & src_api_socket, & dest_api_socket, connections ) ,
98649873 "Unsuccessful command: 'send-migration' or 'receive-migration'."
98659874 ) ;
98669875 } ) ;
@@ -10249,7 +10258,12 @@ mod live_migration {
1024910258
1025010259 #[ test]
1025110260 fn test_live_migration_tcp ( ) {
10252- _test_live_migration_tcp ( ) ;
10261+ _test_live_migration_tcp ( NonZeroU32 :: new ( 1 ) . unwrap ( ) ) ;
10262+ }
10263+
10264+ #[ test]
10265+ fn test_live_migration_tcp_parallel_connections ( ) {
10266+ _test_live_migration_tcp ( NonZeroU32 :: new ( 8 ) . unwrap ( ) ) ;
1025310267 }
1025410268
1025510269 #[ test]
0 commit comments