Merge pull request #8567 from thaJeztah/use_the_const_luke

container.Checkpoint(), WithRestoreImage(): use ocispec.AnnotationRefName
This commit is contained in:
Derek McGowan 2024-05-02 15:18:38 +00:00 committed by GitHub
commit 0730bb8569
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -42,7 +42,6 @@ import (
)
const (
checkpointImageNameLabel = "org.opencontainers.image.ref.name"
checkpointRuntimeNameLabel = "io.containerd.checkpoint.runtime"
checkpointSnapshotterNameLabel = "io.containerd.checkpoint.snapshotter"
)
@ -357,7 +356,7 @@ func (c *container) Checkpoint(ctx context.Context, ref string, opts ...Checkpoi
defer done(ctx)
// add image name to manifest
index.Annotations[checkpointImageNameLabel] = img.Name()
index.Annotations[ocispec.AnnotationRefName] = img.Name()
// add runtime info to index
index.Annotations[checkpointRuntimeNameLabel] = info.Runtime.Name
// add snapshotter info to index

View File

@ -45,7 +45,7 @@ type RestoreOpts func(context.Context, string, *Client, Image, *imagespec.Index)
// WithRestoreImage restores the image for the container
func WithRestoreImage(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts {
return func(ctx context.Context, client *Client, c *containers.Container) error {
name, ok := index.Annotations[checkpointImageNameLabel]
name, ok := index.Annotations[imagespec.AnnotationRefName]
if !ok || name == "" {
return ErrImageNameNotFoundInIndex
}