@@ -1019,7 +1019,14 @@ impl PodmanComputeDriver {
10191019 child_env,
10201020 ) ?;
10211021 self . client
1022- . copy_to_container ( & workload_id, archives. workload )
1022+ . copy_to_container (
1023+ & workload_id,
1024+ crate :: isolation:: CHANNEL_ROOT ,
1025+ archives. channel ,
1026+ )
1027+ . await ?;
1028+ self . client
1029+ . copy_to_container ( & workload_id, "/sandbox" , archives. workspace )
10231030 . await ?;
10241031 specs. supervisor . join_user_namespace ( & workload_id) ;
10251032 let supervisor_id = self
@@ -1028,7 +1035,7 @@ impl PodmanComputeDriver {
10281035 . await ?;
10291036 created_supervisor = Some ( supervisor_id. clone ( ) ) ;
10301037 self . client
1031- . copy_to_container ( & supervisor_id, archives. supervisor )
1038+ . copy_to_container ( & supervisor_id, "/" , archives. supervisor )
10321039 . await ?;
10331040 // Both resources and private files exist before either
10341041 // container can run. Only the trusted sandbox starts here;
@@ -1315,7 +1322,9 @@ impl PodmanComputeDriver {
13151322 . await ?;
13161323 let bundle =
13171324 extract_first_tar_entry ( & archive) . map_err ( ComputeDriverError :: Precondition ) ?;
1318- self . client . copy_to_container ( & container_id, bundle) . await ?;
1325+ self . client
1326+ . copy_to_container ( & container_id, crate :: isolation:: CHANNEL_ROOT , bundle)
1327+ . await ?;
13191328 self . client . verify_isolation_fence ( & container_id) . await ?;
13201329 self . client . start_container ( & container_id) . await ?;
13211330 if let Err ( error) = self . client . start_container ( & supervisor) . await {
@@ -1889,6 +1898,24 @@ mod tests {
18891898 . await
18901899 . expect ( "start should succeed" ) ;
18911900 start_handle. await . expect ( "start stub should finish" ) ;
1901+ let restart_requests = start_requests. lock ( ) . unwrap ( ) . clone ( ) ;
1902+ assert_eq ! (
1903+ restart_requests
1904+ . iter( )
1905+ . filter( |request| request. starts_with( "PUT " ) )
1906+ . cloned( )
1907+ . collect:: <Vec <_>>( ) ,
1908+ vec![ format!(
1909+ "PUT {}" ,
1910+ api_path( "/libpod/containers/ctr-1/archive?path=%2F.openshell%2Fchannel" )
1911+ ) ]
1912+ ) ;
1913+ assert ! (
1914+ !restart_requests
1915+ . iter( )
1916+ . any( |request| request. contains( "/volumes/create" )
1917+ || request. contains( "/containers/create" ) )
1918+ ) ;
18921919 assert_eq ! (
18931920 start_requests
18941921 . lock( )
@@ -2037,7 +2064,7 @@ mod tests {
20372064 use tracing_subscriber:: layer:: SubscriberExt as _;
20382065
20392066 let _tracing_lock = openshell_otel_test_support:: tracing_test_lock ( ) . await ;
2040- let ( socket_path, _requests , handle) = spawn_podman_stub (
2067+ let ( socket_path, requests , handle) = spawn_podman_stub (
20412068 "trace-create" ,
20422069 create_setup_responses ( false )
20432070 . into_iter ( )
@@ -2057,6 +2084,22 @@ mod tests {
20572084 . await
20582085 . expect ( "create should succeed" ) ;
20592086 handle. await . expect ( "stub should finish" ) ;
2087+ let uploads: Vec < _ > = requests
2088+ . lock ( )
2089+ . unwrap ( )
2090+ . iter ( )
2091+ . filter ( |request| request. starts_with ( "PUT " ) )
2092+ . cloned ( )
2093+ . collect ( ) ;
2094+ assert_eq ! (
2095+ uploads,
2096+ [
2097+ "/libpod/containers/workload/archive?path=%2F.openshell%2Fchannel" ,
2098+ "/libpod/containers/workload/archive?path=%2Fsandbox" ,
2099+ "/libpod/containers/supervisor/archive?path=%2F" ,
2100+ ]
2101+ . map( |path| format!( "PUT {}" , api_path( path) ) )
2102+ ) ;
20602103 provider. force_flush ( ) . unwrap ( ) ;
20612104
20622105 let spans = exporter. get_finished_spans ( ) . unwrap ( ) ;
@@ -3084,7 +3127,18 @@ mod tests {
30843127
30853128 fn restart_responses ( ) -> Vec < StubResponse > {
30863129 let mut archive = tar:: Builder :: new ( Vec :: new ( ) ) ;
3087- let bundle = tar:: Builder :: new ( Vec :: new ( ) ) . into_inner ( ) . unwrap ( ) ;
3130+ let identity = openshell_isolation_interface:: contract:: ResolvedWorkloadIdentity :: new (
3131+ 1000 ,
3132+ 1001 ,
3133+ vec ! [ ] ,
3134+ "image" . into ( ) ,
3135+ "sha256:image" . into ( ) ,
3136+ )
3137+ . unwrap ( ) ;
3138+ let bundle =
3139+ crate :: isolation:: bootstrap_archives ( "sandbox-1" , "ctr-1" , & identity, HashMap :: new ( ) )
3140+ . unwrap ( )
3141+ . channel ;
30883142 let mut header = tar:: Header :: new_gnu ( ) ;
30893143 header. set_size ( bundle. len ( ) as u64 ) ;
30903144 header. set_mode ( 0o600 ) ;
@@ -3099,7 +3153,7 @@ mod tests {
30993153 r#"{"Id":"supervisor","Name":"supervisor","State":{"Status":"exited","Running":false},"Config":{}}"# ,
31003154 ) ,
31013155 StubResponse :: new( StatusCode :: OK , archive. into_inner( ) . unwrap( ) ) ,
3102- StubResponse :: new( StatusCode :: OK , "" ) , // restore bootstrap
3156+ StubResponse :: new( StatusCode :: OK , "" ) . with_archive_members ( channel_archive_members ( ) ) ,
31033157 fence_response( ) ,
31043158 StubResponse :: new( StatusCode :: NO_CONTENT , "" ) , // workload start
31053159 StubResponse :: new( StatusCode :: NO_CONTENT , "" ) , // supervisor start
@@ -3197,14 +3251,26 @@ mod tests {
31973251 vec ! [
31983252 created_response( "workload" ) ,
31993253 fence_response( ) ,
3200- StubResponse :: new( StatusCode :: OK , "" ) , // workload archive
3254+ StubResponse :: new( StatusCode :: OK , "" ) . with_archive_members( channel_archive_members( ) ) ,
3255+ StubResponse :: new( StatusCode :: OK , "" ) . with_archive_members( & [ "." ] ) ,
32013256 created_response( "supervisor" ) ,
32023257 StubResponse :: new( StatusCode :: OK , "" ) , // supervisor archive
32033258 StubResponse :: new( StatusCode :: NO_CONTENT , "" ) , // workload start
32043259 StubResponse :: new( StatusCode :: NO_CONTENT , "" ) , // supervisor start
32053260 ]
32063261 }
32073262
3263+ fn channel_archive_members ( ) -> & ' static [ & ' static str ] {
3264+ & [
3265+ "." ,
3266+ "sandbox" ,
3267+ "sandbox/bootstrap.json" ,
3268+ "sandbox/server.crt" ,
3269+ "sandbox/server.key" ,
3270+ "sandbox/client-ca.crt" ,
3271+ ]
3272+ }
3273+
32083274 #[ tokio:: test]
32093275 async fn reserved_image_control_root_fails_before_workload_or_secrets ( ) {
32103276 let ( path, requests, handle) = spawn_podman_stub (
@@ -3283,7 +3349,7 @@ mod tests {
32833349 "create-start-fail" ,
32843350 create_setup_responses ( true )
32853351 . into_iter ( )
3286- . chain ( create_launch_responses ( ) . into_iter ( ) . take ( 6 ) )
3352+ . chain ( create_launch_responses ( ) . into_iter ( ) . take ( 7 ) )
32873353 . chain ( [
32883354 StubResponse :: new ( StatusCode :: INTERNAL_SERVER_ERROR , "supervisor start failed" ) ,
32893355 StubResponse :: new ( StatusCode :: NO_CONTENT , "" ) , // supervisor
0 commit comments