runtime: add Add/Delete method in PlatformRuntime interface

The two new method Add/Delete can allow custom plugin to add or migrate
existing task into major Runtime plugin.

close: #2888

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu
2018-12-21 10:18:03 +08:00
parent 06e04bc5a9
commit 568b5be936
4 changed files with 32 additions and 0 deletions

View File

@@ -153,6 +153,14 @@ func (r *windowsRuntime) Tasks(ctx context.Context, all bool) ([]runtime.Task, e
return r.tasks.GetAll(ctx, all)
}
func (r *windowsRuntime) Add(ctx context.Context, task runtime.Task) error {
return r.tasks.Add(ctx, task)
}
func (r *windowsRuntime) Delete(ctx context.Context, id string) {
r.tasks.Delete(ctx, id)
}
func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, rootfs []mount.Mount, spec *runtimespec.Spec, io runtime.IO, createOpts *hcsshimtypes.CreateOptions) (*task, error) {
var (
err error