Return image references in ImageStatus()

The image's canonical reference is a name with a digest of the image's
manifest, so compute and return that value as the image's reference in
ImageStatus() and in ContainerStatus().

We don't auto-store a name based on the image digest when we pull one by
tag, but then CRI doesn't need us to do that.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-07-12 12:41:38 -04:00
parent beef44840e
commit 3f2bc09231
6 changed files with 94 additions and 54 deletions

View file

@ -46,6 +46,14 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
cState := s.Runtime().ContainerStatus(c)
rStatus := pb.ContainerState_CONTAINER_UNKNOWN
imageName := c.Image()
status, err := s.StorageImageServer().ImageStatus(s.ImageContext(), imageName)
if err != nil {
return nil, err
}
resp.Status.ImageRef = status.ImageRef
// If we defaulted to exit code -1 earlier then we attempt to
// get the exit code from the exit file again.
if cState.ExitCode == -1 {