Checkpoint and restart recovery

fix part of #120

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
This commit is contained in:
yanxuean
2017-08-23 15:07:19 +08:00
parent dcc3cb2a05
commit d2757cb8f9
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)