Update GRPC for consistency

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-20 17:47:59 -07:00
parent 13e7d3c393
commit 94eafaab60
56 changed files with 3941 additions and 2802 deletions

View File

@@ -254,19 +254,24 @@ func (p *initProcess) Stdin() io.Closer {
func (p *initProcess) Checkpoint(context context.Context, r *shimapi.CheckpointRequest) error {
var actions []runc.CheckpointAction
if !r.Exit {
actions = append(actions, runc.LeaveRunning)
}
/*
if !r.Exit {
actions = append(actions, runc.LeaveRunning)
}
*/
work := filepath.Join(p.bundle, "work")
defer os.RemoveAll(work)
// TODO: convert options into runc flags or a better format for criu
if err := p.runc.Checkpoint(context, p.id, &runc.CheckpointOpts{
WorkDir: work,
ImagePath: r.CheckpointPath,
AllowOpenTCP: r.AllowTcp,
AllowExternalUnixSockets: r.AllowUnixSockets,
AllowTerminal: r.AllowTerminal,
FileLocks: r.FileLocks,
EmptyNamespaces: r.EmptyNamespaces,
WorkDir: work,
ImagePath: r.Path,
/*
AllowOpenTCP: r.AllowTcp,
AllowExternalUnixSockets: r.AllowUnixSockets,
AllowTerminal: r.AllowTerminal,
FileLocks: r.FileLocks,
EmptyNamespaces: r.EmptyNamespaces,
*/
}, actions...); err != nil {
dumpLog := filepath.Join(p.bundle, "criu-dump.log")
if cerr := copyFile(dumpLog, filepath.Join(work, "dump.log")); cerr != nil {

View File

@@ -165,20 +165,15 @@ func (t *Task) CloseStdin(ctx context.Context, pid uint32) error {
return err
}
func (t *Task) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error {
_, err := t.shim.Checkpoint(ctx, &shim.CheckpointRequest{
Exit: opts.Exit,
AllowTcp: opts.AllowTCP,
AllowUnixSockets: opts.AllowUnixSockets,
AllowTerminal: opts.AllowTerminal,
FileLocks: opts.FileLocks,
EmptyNamespaces: opts.EmptyNamespaces,
CheckpointPath: opts.Path,
})
if err != nil {
err = errors.New(grpc.ErrorDesc(err))
func (t *Task) Checkpoint(ctx context.Context, path string, options map[string]string) error {
r := &shim.CheckpointRequest{
Path: path,
Options: options,
}
return err
if _, err := t.shim.Checkpoint(ctx, r); err != nil {
return errors.New(grpc.ErrorDesc(err))
}
return nil
}
func (t *Task) DeleteProcess(ctx context.Context, pid uint32) (*plugin.Exit, error) {