Implement temporary ImageStats in kuberuntime_manager, and

fix a bug in dockershim which causes summary api not working
properly.
This commit is contained in:
Random-Liu
2016-09-30 17:08:32 -07:00
parent 47b4c0e770
commit c3ce58b934
8 changed files with 75 additions and 19 deletions

View File

@@ -127,8 +127,18 @@ func (m *kubeGenericRuntimeManager) RemoveImage(image kubecontainer.ImageSpec) e
}
// ImageStats returns the statistics of the image.
// TODO: Implement this function.
// Notice that current logic doesn't really work for images which share layers (e.g. docker image),
// this is a known issue, and we'll address this by getting imagefs stats directly from CRI.
// TODO: Get imagefs stats directly from CRI.
func (m *kubeGenericRuntimeManager) ImageStats() (*kubecontainer.ImageStats, error) {
var usageBytes uint64 = 0
return &kubecontainer.ImageStats{TotalStorageBytes: usageBytes}, nil
allImages, err := m.imageService.ListImages(nil)
if err != nil {
glog.Errorf("ListImages failed: %v", err)
return nil, err
}
stats := &kubecontainer.ImageStats{}
for _, img := range allImages {
stats.TotalStorageBytes += img.GetSize_()
}
return stats, nil
}