Unpack image during import.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-07-26 07:23:48 +00:00
parent a0cfc8c1d2
commit e1a37e8797
3 changed files with 29 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ func (c *criService) LoadImage(ctx context.Context, r *api.LoadImageRequest) (*a
if err != nil {
return nil, errors.Wrap(err, "failed to open file")
}
repoTags, err := importer.Import(ctx, c.client, f)
repoTags, err := importer.Import(ctx, c.client, f, importer.WithUnpack(c.config.ContainerdConfig.Snapshotter))
if err != nil {
return nil, errors.Wrap(err, "failed to import image")
}
@@ -48,10 +48,6 @@ func (c *criService) LoadImage(ctx context.Context, r *api.LoadImageRequest) (*a
if err != nil {
return nil, errors.Wrapf(err, "failed to get image %q", repoTag)
}
if err := image.Unpack(ctx, c.config.ContainerdConfig.Snapshotter); err != nil {
logrus.WithError(err).Warnf("Failed to unpack image %q", repoTag)
// Do not fail image importing. Unpack will be retried when container creation.
}
info, err := getImageInfo(ctx, image)
if err != nil {
return nil, errors.Wrapf(err, "failed to get image %q info", repoTag)