@@ -272,7 +272,7 @@ func (s *local) waitForShimToExit(ctx context.Context, vmID string, killShim boo
272
272
if killShim {
273
273
s .logger .Debug ("Killing shim" )
274
274
275
- if err := syscall .Kill (int (pid ), 9 ); err != nil {
275
+ if err := syscall .Kill (int (pid ), syscall . SIGKILL ); err != nil {
276
276
s .logger .WithError (err ).Error ("Failed to kill shim process" )
277
277
return err
278
278
}
@@ -442,10 +442,6 @@ func (s *local) newShim(ns, vmID, containerdAddress string, shimSocket *net.Unix
442
442
if err := fcSocketFile .Close (); err != nil {
443
443
logger .WithError (err ).Errorf ("failed to close %q" , fcSocketFile .Name ())
444
444
}
445
-
446
- if err := os .RemoveAll (shimDir .RootPath ()); err != nil {
447
- logger .WithError (err ).Errorf ("failed to remove %q" , shimDir .RootPath ())
448
- }
449
445
}()
450
446
451
447
err = setShimOOMScore (cmd .Process .Pid )
@@ -497,11 +493,11 @@ func (s *local) loadShim(ctx context.Context, ns, vmID, containerdAddress string
497
493
return nil , err
498
494
}
499
495
500
- // If we're here, there is no pre-existing shim for this VMID, so we spawn a new one
501
496
defer shimSocket .Close ()
502
- if err := os .Mkdir (s .config .ShimBaseDir , 0700 ); err != nil && ! os .IsExist (err ) {
503
- s .logger .WithError (err ).Error ()
504
- return nil , errors .Wrapf (err , "failed to make shim base directory: %s" , s .config .ShimBaseDir )
497
+
498
+ // If we're here, there is no pre-existing shim for this VMID, so we spawn a new one
499
+ if _ , err := os .Stat (s .config .ShimBaseDir ); os .IsNotExist (err ) {
500
+ return nil , errors .Wrapf (err , "shim base dir does not exist: %s" , s .config .ShimBaseDir )
505
501
}
506
502
507
503
shimDir , err := vm .ShimDir (s .config .ShimBaseDir , ns , vmID )
@@ -511,13 +507,6 @@ func (s *local) loadShim(ctx context.Context, ns, vmID, containerdAddress string
511
507
return nil , err
512
508
}
513
509
514
- err = shimDir .Mkdir ()
515
- if err != nil {
516
- err = errors .Wrapf (err , "failed to create VM dir %q" , shimDir .RootPath ())
517
- s .logger .WithError (err ).Error ()
518
- return nil , err
519
- }
520
-
521
510
fcSocketAddress , err := fcShim .FCControlSocketAddress (ctx , vmID )
522
511
if err != nil {
523
512
err = errors .Wrap (err , "failed to obtain shim socket address" )
0 commit comments