@@ -287,6 +287,12 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
287
287
Options : m .Options ,
288
288
})
289
289
}
290
+
291
+ rootfs := filepath .Join (r .Bundle , "rootfs" )
292
+ if err := os .Mkdir (rootfs , 0711 ); err != nil && ! os .IsExist (err ) {
293
+ return nil , err
294
+ }
295
+
290
296
config := & proc.CreateConfig {
291
297
ID : r .ID ,
292
298
Bundle : r .Bundle ,
@@ -301,7 +307,6 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
301
307
if err := s .writeRuntime (r .Bundle , opts .BinaryName ); err != nil {
302
308
return nil , err
303
309
}
304
- rootfs := filepath .Join (r .Bundle , "rootfs" )
305
310
defer func () {
306
311
if err != nil {
307
312
if err2 := mount .UnmountAll (rootfs , 0 ); err2 != nil {
@@ -327,6 +332,7 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
327
332
s .platform ,
328
333
config ,
329
334
& opts ,
335
+ rootfs ,
330
336
)
331
337
if err != nil {
332
338
return nil , errdefs .ToGRPC (err )
@@ -698,13 +704,12 @@ func getTopic(e interface{}) string {
698
704
return runtime .TaskUnknownTopic
699
705
}
700
706
701
- func newInit (ctx context.Context , path , workDir , namespace string , platform rproc.Platform , r * proc.CreateConfig , options * options.Options ) (* proc.Init , error ) {
707
+ func newInit (ctx context.Context , path , workDir , namespace string , platform rproc.Platform , r * proc.CreateConfig , options * options.Options , rootfs string ) (* proc.Init , error ) {
702
708
spec , err := utils .ReadSpec (r .Bundle )
703
709
if err != nil {
704
710
return nil , errors .Wrap (err , "read oci spec" )
705
711
}
706
712
runsc .FormatLogPath (r .ID , options .RunscConfig )
707
- rootfs := filepath .Join (path , "rootfs" )
708
713
runtime := proc .NewRunsc (options .Root , path , namespace , options .BinaryName , options .RunscConfig )
709
714
p := proc .New (r .ID , runtime , rproc.Stdio {
710
715
Stdin : r .Stdin ,
0 commit comments