diff --git a/src/runtime/pkg/containerd-shim-v2/create.go b/src/runtime/pkg/containerd-shim-v2/create.go index 78f9a90a2e..443702bd3e 100644 --- a/src/runtime/pkg/containerd-shim-v2/create.go +++ b/src/runtime/pkg/containerd-shim-v2/create.go @@ -39,6 +39,13 @@ import ( "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci" ) +type startManagementServerFunc func(s *service, ctx context.Context, ociSpec *specs.Spec) + +var defaultStartManagementServerFunc startManagementServerFunc = func(s *service, ctx context.Context, ociSpec *specs.Spec) { + go s.startManagementServer(ctx, ociSpec) + shimLog.Info("management server started") +} + func create(ctx context.Context, s *service, r *taskAPI.CreateTaskRequest) (*container, error) { rootFs := vc.RootFs{} if len(r.Rootfs) == 1 { @@ -131,7 +138,9 @@ func create(ctx context.Context, s *service, r *taskAPI.CreateTaskRequest) (*con } s.hpid = uint32(pid) - go s.startManagementServer(ctx, ociSpec) + if defaultStartManagementServerFunc != nil { + defaultStartManagementServerFunc(s, ctx, ociSpec) + } case vc.PodContainer: span, ctx := katatrace.Trace(s.ctx, shimLog, "create", shimTracingTags) diff --git a/src/runtime/pkg/containerd-shim-v2/utils_test.go b/src/runtime/pkg/containerd-shim-v2/utils_test.go index 5c0cc1c025..3ff22787ac 100644 --- a/src/runtime/pkg/containerd-shim-v2/utils_test.go +++ b/src/runtime/pkg/containerd-shim-v2/utils_test.go @@ -125,6 +125,10 @@ func init() { } tc = ktu.NewTestConstraint(false) + + // disable shim management server. + // all tests are not using this, so just set it to nil + defaultStartManagementServerFunc = nil } // createOCIConfig creates an OCI configuration (spec) file in