Add ImageFsInfo API for ImageManagerService

This commit is contained in:
Pengfei Ni 2017-05-02 10:13:50 +08:00
parent f3ae5ab721
commit 5f7de0ab97
6 changed files with 37 additions and 0 deletions

View File

@ -97,4 +97,6 @@ type ImageManagerService interface {
PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig) (string, error)
// RemoveImage removes the image.
RemoveImage(image *runtimeapi.ImageSpec) error
// ImageFsInfo returns information of the filesystem that is used to store images.
ImageFsInfo() (*runtimeapi.FsInfo, error)
}

View File

@ -118,3 +118,13 @@ func (r *FakeImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
return nil
}
// ImageFsInfo returns information of the filesystem that is used to store images.
func (r *FakeImageService) ImageFsInfo() (*runtimeapi.FsInfo, error) {
r.Lock()
defer r.Unlock()
r.Called = append(r.Called, "ImageFsInfo")
return nil, nil
}

View File

@ -121,3 +121,8 @@ func getImageRef(client dockertools.DockerInterface, image string) (string, erro
return img.ID, nil
}
// ImageFsInfo returns information of the filesystem that is used to store images.
func (ds *dockerService) ImageFsInfo() (*runtimeapi.FsInfo, error) {
return nil, fmt.Errorf("not implemented")
}

View File

@ -17,6 +17,7 @@ limitations under the License.
package remote
import (
"fmt"
"time"
"golang.org/x/net/context"
@ -214,3 +215,8 @@ func (d *dockerService) RemoveImage(ctx context.Context, r *runtimeapi.RemoveIma
}
return &runtimeapi.RemoveImageResponse{}, nil
}
// ImageFsInfo returns information of the filesystem that is used to store images.
func (d *dockerService) ImageFsInfo(ctx context.Context, r *runtimeapi.ImageFsInfoRequest) (*runtimeapi.ImageFsInfoResponse, error) {
return nil, fmt.Errorf("not implemented")
}

View File

@ -256,3 +256,12 @@ func (in instrumentedImageManagerService) RemoveImage(image *runtimeapi.ImageSpe
recordError(operation, err)
return err
}
func (in instrumentedImageManagerService) ImageFsInfo() (*runtimeapi.FsInfo, error) {
const operation = "image_fs_info"
defer recordOperation(operation, time.Now())
fsInfo, err := in.service.ImageFsInfo()
recordError(operation, err)
return fsInfo, nil
}

View File

@ -127,3 +127,8 @@ func (r *RemoteImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
return nil
}
// ImageFsInfo returns information of the filesystem that is used to store images.
func (r *RemoteImageService) ImageFsInfo() (*runtimeapi.FsInfo, error) {
return nil, fmt.Errorf("not implemented")
}