Skip to content

Commit 88c818f

Browse files
authored
shim: skip SandboxPlatform validation when platform is not explicitly set (microsoft#2620)
When runtime options are non-empty (e.g., SandboxIsolation is set) but SandboxPlatform is empty, skip the platform validation rather than failing. The validation only needs to check that the spec and shim options match when SandboxPlatform is explicitly configured. containerd's default config (config_windows.go) sets SandboxIsolation=1 for the runhcs-wcow-hypervisor runtime handler but omits SandboxPlatform, making options non-empty with an empty platform string. This causes platforms.Parse("") to fail with 'invalid runtime sandbox platform'. Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
1 parent 84e7d69 commit 88c818f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cmd/containerd-shim-runhcs-v1/service_internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (s *service) createInternal(ctx context.Context, req *task.CreateTaskReques
129129
return nil, fmt.Errorf("invalid runtime sandbox isolation (%s) for hypervisor isolated OCI spec", isolation.String())
130130
}
131131

132-
if !emptyShimOpts {
132+
if !emptyShimOpts && shimOpts.GetSandboxPlatform() != "" {
133133
// validate runtime platform
134134
plat, err := platforms.Parse(shimOpts.GetSandboxPlatform())
135135
if err != nil {

0 commit comments

Comments
 (0)