Merge pull request #9060 from zhuangqh/polish-criu
task: expose criu work path opt
This commit is contained in:
commit
d015c99b2e
19
task_opts.go
19
task_opts.go
@ -92,7 +92,7 @@ func WithCheckpointImagePath(path string) CheckpointTaskOpts {
|
||||
}
|
||||
opts, ok := r.Options.(*options.CheckpointOptions)
|
||||
if !ok {
|
||||
return errors.New("invalid v2 shim checkpoint options format")
|
||||
return errors.New("invalid runtime v2 checkpoint options format")
|
||||
}
|
||||
opts.ImagePath = path
|
||||
return nil
|
||||
@ -107,13 +107,28 @@ func WithRestoreImagePath(path string) NewTaskOpts {
|
||||
}
|
||||
opts, ok := ti.Options.(*options.Options)
|
||||
if !ok {
|
||||
return errors.New("invalid v2 shim create options format")
|
||||
return errors.New("invalid runtime v2 options format")
|
||||
}
|
||||
opts.CriuImagePath = path
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithRestoreWorkPath sets criu work path for create option
|
||||
func WithRestoreWorkPath(path string) NewTaskOpts {
|
||||
return func(ctx context.Context, c *Client, ti *TaskInfo) error {
|
||||
if ti.Options == nil {
|
||||
ti.Options = &options.Options{}
|
||||
}
|
||||
opts, ok := ti.Options.(*options.Options)
|
||||
if !ok {
|
||||
return errors.New("invalid runtime v2 options format")
|
||||
}
|
||||
opts.CriuWorkPath = path
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ProcessDeleteOpts allows the caller to set options for the deletion of a task
|
||||
type ProcessDeleteOpts func(context.Context, Process) error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user