Merge pull request #860 from mrunalp/img_size_id
pkg: storage: image: get size from image ID
This commit is contained in:
commit
6d2b19acbb
1 changed files with 12 additions and 12 deletions
|
@ -90,10 +90,12 @@ func (svc *imageService) ListImages(systemContext *types.SystemContext, filter s
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
size := imageSize(img)
|
||||
img.Close()
|
||||
results = append(results, ImageResult{
|
||||
ID: image.ID,
|
||||
Names: image.Names,
|
||||
Size: imageSize(img),
|
||||
Size: size,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -102,9 +104,7 @@ func (svc *imageService) ListImages(systemContext *types.SystemContext, filter s
|
|||
return nil, err
|
||||
}
|
||||
for _, image := range images {
|
||||
var size *uint64
|
||||
if len(image.Names) != 0 {
|
||||
ref, err := svc.getRef(image.Names[0])
|
||||
ref, err := istorage.Transport.ParseStoreReference(svc.store, "@"+image.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ func (svc *imageService) ListImages(systemContext *types.SystemContext, filter s
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
size = imageSize(img)
|
||||
}
|
||||
size := imageSize(img)
|
||||
img.Close()
|
||||
results = append(results, ImageResult{
|
||||
ID: image.ID,
|
||||
Names: image.Names,
|
||||
|
|
Loading…
Reference in a new issue