Merge pull request #1656 from crosbymichael/rev-name

Reverse checkpoint url
This commit is contained in:
Michael Crosby 2017-10-18 15:07:57 -04:00 committed by GitHub
commit 84fa3967c5

View File

@ -36,6 +36,11 @@ import (
// or if an error was encountered when obtaining the exit status, it is set to 255.
const UnknownExitStatus = 255
const (
checkpointDateFormat = "01-02-2006-15:04:05"
checkpointNameFormat = "containerd.io/checkpoint/%s:%s"
)
// Status returns process status and exit information
type Status struct {
// Status of the process
@ -362,10 +367,9 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointTaskOpts) (Imag
return nil, err
}
}
const checkpointDateFormat = "01-02-2006-15:04:05"
// set a default name
if i.Name == "" {
i.Name = fmt.Sprintf("io.containerd/checkpoint/%s:%s", t.id, time.Now().Format(checkpointDateFormat))
i.Name = fmt.Sprintf(checkpointNameFormat, t.id, time.Now().Format(checkpointDateFormat))
}
request.ParentCheckpoint = i.ParentCheckpoint
if i.Options != nil {