Skip to content

Commit 3cb3c47

Browse files
committed
The shim should be started with a single-task VM in this test
Passing a VM ID switches our shim to keep its Firecracker VM. Starting a container with the same name multiple times doesn't work under this configuration.
1 parent 3d6b10a commit 3cb3c47

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

runtime/service.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ type service struct {
124124
agentClient taskAPI.TaskService
125125
eventBridgeClient eventbridge.Getter
126126
stubDriveHandler stubDriveHandler
127-
exitAfterAllTasksDeleted bool
127+
exitAfterAllTasksDeleted bool // exit the VM and shim when all tasks are deleted
128128

129129
machine *firecracker.Machine
130130
machineConfig *firecracker.Config
@@ -284,7 +284,8 @@ func (s *service) StartShim(shimCtx context.Context, containerID, containerdBina
284284

285285
logrus.SetOutput(logFifo)
286286

287-
log.G(shimCtx).WithField("id", containerID).Debug("StartShim")
287+
log := log.G(shimCtx).WithField("id", containerID)
288+
log.Debug("StartShim")
288289

289290
// If we are running a shim start routine, we can safely assume our current working
290291
// directory is the bundle directory
@@ -319,6 +320,10 @@ func (s *service) StartShim(shimCtx context.Context, containerID, containerdBina
319320
// task is deleted
320321
containerCount = 1
321322
exitAfterAllTasksDeleted = true
323+
324+
log.Infof("will start a single-task VM %s since no VMID has been provided", s.vmID)
325+
} else {
326+
log.Infof("will start a persistent VM %s", s.vmID)
322327
}
323328

324329
client, err := ttrpcutil.NewClient(containerdAddress + ".ttrpc")

runtime/service_integ_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ func TestRemoveDir_Isolated(t *testing.T) {
609609
containerd.WithNewSnapshot(snapshotName, image),
610610
containerd.WithNewSpec(
611611
oci.WithProcessArgs("echo", "hello"),
612-
firecrackeroci.WithVMID(strconv.Itoa(vmID)),
613612
),
614613
)
615614
require.NoError(t, err, "failed to create container %s", containerName)
@@ -622,7 +621,6 @@ func TestRemoveDir_Isolated(t *testing.T) {
622621
containerd.WithNewSnapshot(snapshotName, image),
623622
containerd.WithNewSpec(
624623
oci.WithProcessArgs("echo", "hello"),
625-
firecrackeroci.WithVMID(strconv.Itoa(vmID)),
626624
),
627625
)
628626
require.NoError(t, err, "failed to create container %s", containerName)

0 commit comments

Comments
 (0)