Skip to content

Commit 251278d

Browse files
committed
Explicitly specify Container Count
This change workarounds 'Drive "root_drive" could not be found' issue. The way we manage stub drives may not right, but we are not going to fix the issue right now, in this pull request. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent 1fb86a7 commit 251278d

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

runtime/service_integ_test.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,27 @@ func startAndWaitTask(ctx context.Context, t *testing.T, c containerd.Container)
562562
return stdout.String()
563563
}
564564

565-
func testCreateContainerWithSameName(t *testing.T, opts ...oci.SpecOpts) {
565+
func testCreateContainerWithSameName(t *testing.T, vmID string) {
566566
ctx := namespaces.WithNamespace(context.Background(), "default")
567-
withNewSpec := containerd.WithNewSpec(append([]oci.SpecOpts{oci.WithProcessArgs("echo", "hello")}, opts...)...)
567+
568+
pluginClient, err := ttrpcutil.NewClient(containerdSockPath + ".ttrpc")
569+
require.NoError(t, err, "failed to create ttrpc client")
570+
571+
// Explicitly specify Container Count = 2
572+
// TODO: shouldn't it work without specifying the count?
573+
fcClient := fccontrol.NewFirecrackerClient(pluginClient.Client())
574+
_, err = fcClient.CreateVM(ctx, &proto.CreateVMRequest{
575+
VMID: vmID,
576+
RootDrive: &proto.FirecrackerDrive{
577+
PathOnHost: defaultRootfsPath,
578+
IsReadOnly: true,
579+
IsRootDevice: true,
580+
},
581+
ContainerCount: 2,
582+
})
583+
require.NoError(t, err)
584+
585+
withNewSpec := containerd.WithNewSpec(oci.WithProcessArgs("echo", "hello"), firecrackeroci.WithVMID(vmID))
568586

569587
client, err := containerd.New(containerdSockPath, containerd.WithDefaultRuntime(firecrackerRuntime))
570588
require.NoError(t, err, "unable to create client to containerd service at %s, is containerd running?", containerdSockPath)
@@ -614,6 +632,8 @@ func testCreateContainerWithSameName(t *testing.T, opts ...oci.SpecOpts) {
614632
func TestCreateContainerWithSameName_Isolated(t *testing.T) {
615633
internal.RequiresIsolation(t)
616634

617-
testCreateContainerWithSameName(t)
618-
testCreateContainerWithSameName(t, firecrackeroci.WithVMID("reuse-same-vm"))
635+
testCreateContainerWithSameName(t, "")
636+
637+
vmID := fmt.Sprintf("same-vm-%d", time.Now().UnixNano())
638+
testCreateContainerWithSameName(t, vmID)
619639
}

0 commit comments

Comments
 (0)