Merge pull request #156 from yanxuean/metalabel

Checkpoint and restart recovery
This commit is contained in:
Lantao Liu
2017-08-23 15:36:19 -07:00
committed by GitHub
3 changed files with 36 additions and 2 deletions

View File

@@ -118,7 +118,18 @@ func (c *criContainerdService) CreateContainer(ctx context.Context, r *runtime.C
}
}()
opts = append(opts, containerd.WithSpec(spec), containerd.WithRuntime(defaultRuntime))
metaBytes, err := meta.Encode()
if err != nil {
return nil, fmt.Errorf("failed to convert sandbox metadata: %+v, %v", meta, err)
}
labels := map[string]string{
containerMetadataLabel: string(metaBytes),
}
opts = append(opts,
containerd.WithSpec(spec),
containerd.WithRuntime(defaultRuntime),
containerd.WithContainerLabels(labels))
var cntr containerd.Container
if cntr, err = c.client.NewContainer(ctx, id, opts...); err != nil {
return nil, fmt.Errorf("failed to create containerd container: %v", err)