task: WithExit() doesn't have to overwrite existing options
@@ -78,13 +78,23 @@ func withExit(rt string) containerd.CheckpointTaskOpts {
return func(r *containerd.CheckpointTaskInfo) error {
switch rt {
case "io.containerd.runc.v1":
+ if r.Options == nil {
r.Options = &options.CheckpointOptions{
Exit: true,
}
+ } else {
+ opts, _ := r.Options.(*options.CheckpointOptions)
+ opts.Exit = true
+ }
default:
+ if r.Options == nil {
r.Options = &runctypes.CheckpointOptions{
Exit: true,
}
+ } else {
+ opts, _ := r.Options.(*runctypes.CheckpointOptions)
+ opts.Exit = true
+ }
}
return nil
}
