@@ -361,7 +361,6 @@ type FirecrackerContainer struct {
361361 containerImage string // the OCI container image. ex "alpine:latest"
362362 actionWorkingDir string // the action directory with inputs / outputs
363363 containerFSPath string // the path to the container ext4 image
364- tempDir string // path for writing disk images before the chroot is created
365364 user string // user to execute all commands as
366365
367366 rmOnce * sync.Once
@@ -1634,27 +1633,12 @@ func (c *FirecrackerContainer) create(ctx context.Context) error {
16341633 c .rmOnce = & sync.Once {}
16351634 c .rmErr = nil
16361635
1637- var err error
1638- c .tempDir , err = os .MkdirTemp (c .jailerRoot , "fc-container-*" )
1639- if err != nil {
1640- return err
1641- }
16421636 if err := os .MkdirAll (c .getChroot (), 0755 ); err != nil {
16431637 return status .InternalErrorf ("failed to create chroot dir: %s" , err )
16441638 }
16451639
16461640 scratchFSPath := c .scratchFSPath ()
16471641 workspaceFSPath := c .workspaceFSPath ()
1648-
1649- // When mounting the workspace image directly as a block device (rather than
1650- // as an NBD), the firecracker go SDK expects the disk images to be outside
1651- // the chroot, and will move them to the chroot for us. So we place them in
1652- // a temp dir so that the SDK doesn't complain that the chroot paths already
1653- // exist when it tries to create them.
1654- if ! * enableNBD {
1655- scratchFSPath = filepath .Join (c .tempDir , scratchFSName )
1656- workspaceFSPath = filepath .Join (c .tempDir , workspaceFSName )
1657- }
16581642 if * EnableRootfs {
16591643 if err := c .initRootfsStore (ctx ); err != nil {
16601644 return status .WrapError (err , "create root image" )
@@ -1670,7 +1654,6 @@ func (c *FirecrackerContainer) create(ctx context.Context) error {
16701654 if err := c .createWorkspaceImage (ctx , "" /*=workspaceDir*/ , workspaceFSPath ); err != nil {
16711655 return err
16721656 }
1673- log .CtxDebugf (ctx , "Scratch and workspace disk images written to %q" , c .tempDir )
16741657 log .CtxDebugf (ctx , "Using container image at %q" , c .containerFSPath )
16751658 log .CtxDebugf (ctx , "getChroot() is %q" , c .getChroot ())
16761659 fcCfg , err := c .getConfig (ctx , c .containerFSPath , scratchFSPath , workspaceFSPath )
@@ -1969,12 +1952,6 @@ func (c *FirecrackerContainer) remove(ctx context.Context) error {
19691952 log .CtxErrorf (ctx , "Error cleaning up networking: %s" , err )
19701953 lastErr = err
19711954 }
1972- if c .tempDir != "" {
1973- if err := os .RemoveAll (c .tempDir ); err != nil {
1974- log .CtxErrorf (ctx , "Error removing workspace fs: %s" , err )
1975- lastErr = err
1976- }
1977- }
19781955 if err := os .RemoveAll (filepath .Dir (c .getChroot ())); err != nil {
19791956 log .CtxErrorf (ctx , "Error removing chroot: %s" , err )
19801957 lastErr = err
0 commit comments