container.Checkpoint(), WithRestoreImage(): use ocispec.AnnotationRefName
instead of a locally defined const Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		@@ -42,7 +42,6 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
	checkpointImageNameLabel       = "org.opencontainers.image.ref.name"
 | 
					 | 
				
			||||||
	checkpointRuntimeNameLabel     = "io.containerd.checkpoint.runtime"
 | 
						checkpointRuntimeNameLabel     = "io.containerd.checkpoint.runtime"
 | 
				
			||||||
	checkpointSnapshotterNameLabel = "io.containerd.checkpoint.snapshotter"
 | 
						checkpointSnapshotterNameLabel = "io.containerd.checkpoint.snapshotter"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -357,7 +356,7 @@ func (c *container) Checkpoint(ctx context.Context, ref string, opts ...Checkpoi
 | 
				
			|||||||
	defer done(ctx)
 | 
						defer done(ctx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// add image name to manifest
 | 
						// add image name to manifest
 | 
				
			||||||
	index.Annotations[checkpointImageNameLabel] = img.Name()
 | 
						index.Annotations[ocispec.AnnotationRefName] = img.Name()
 | 
				
			||||||
	// add runtime info to index
 | 
						// add runtime info to index
 | 
				
			||||||
	index.Annotations[checkpointRuntimeNameLabel] = info.Runtime.Name
 | 
						index.Annotations[checkpointRuntimeNameLabel] = info.Runtime.Name
 | 
				
			||||||
	// add snapshotter info to index
 | 
						// add snapshotter info to index
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ type RestoreOpts func(context.Context, string, *Client, Image, *imagespec.Index)
 | 
				
			|||||||
// WithRestoreImage restores the image for the container
 | 
					// WithRestoreImage restores the image for the container
 | 
				
			||||||
func WithRestoreImage(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts {
 | 
					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 {
 | 
						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 == "" {
 | 
							if !ok || name == "" {
 | 
				
			||||||
			return ErrImageNameNotFoundInIndex
 | 
								return ErrImageNameNotFoundInIndex
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user