Implement task update

This allows tasks to have their resources updated as they are running.

Fixes #1067

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-26 16:38:49 -07:00
parent 1f478be14d
commit f36e0193a4
15 changed files with 749 additions and 152 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/containerd/containerd/plugin"
"github.com/containerd/fifo"
runc "github.com/containerd/go-runc"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
@@ -284,6 +285,14 @@ func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointT
return nil
}
func (p *initProcess) Update(context context.Context, r *shimapi.UpdateTaskRequest) error {
var resources specs.LinuxResources
if err := json.Unmarshal(r.Resources.Value, &resources); err != nil {
return err
}
return p.runc.Update(context, p.id, &resources)
}
// TODO(mlaventure): move to runc package?
func getLastRuncError(r *runc.Runc) (string, error) {
if r.Log == "" {