Bump github.com/containers/storage from 1.21.2 to 1.22.0

Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.21.2 to 1.22.0.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.21.2...v1.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
dependabot-preview[bot]
2020-08-07 08:59:36 +00:00
committed by Daniel J Walsh
parent c052ed7ec8
commit c24363ccda
52 changed files with 683 additions and 310 deletions

View File

@@ -2223,16 +2223,23 @@ func (s *store) DeleteLayer(id string) error {
}
for _, layer := range layers {
if layer.Parent == id {
return ErrLayerHasChildren
return errors.Wrapf(ErrLayerHasChildren, "used by layer %v", layer.ID)
}
}
images, err := ristore.Images()
if err != nil {
return err
}
for _, image := range images {
if image.TopLayer == id || stringutils.InSlice(image.MappedTopLayers, id) {
return errors.Wrapf(ErrLayerUsedByImage, "Layer %v used by image %v", id, image.ID)
if image.TopLayer == id {
return errors.Wrapf(ErrLayerUsedByImage, "layer %v used by image %v", id, image.ID)
}
if stringutils.InSlice(image.MappedTopLayers, id) {
// No write access to the image store, fail before the layer is deleted
if _, ok := ristore.(*imageStore); !ok {
return errors.Wrapf(ErrLayerUsedByImage, "layer %v used by image %v", id, image.ID)
}
}
}
containers, err := rcstore.Containers()
@@ -2241,10 +2248,25 @@ func (s *store) DeleteLayer(id string) error {
}
for _, container := range containers {
if container.LayerID == id {
return errors.Wrapf(ErrLayerUsedByContainer, "Layer %v used by container %v", id, container.ID)
return errors.Wrapf(ErrLayerUsedByContainer, "layer %v used by container %v", id, container.ID)
}
}
return rlstore.Delete(id)
if err := rlstore.Delete(id); err != nil {
return errors.Wrapf(err, "delete layer %v", id)
}
// The check here is used to avoid iterating the images if we don't need to.
// There is already a check above for the imageStore to be writeable when the layer is part of MappedTopLayers.
if istore, ok := ristore.(*imageStore); ok {
for _, image := range images {
if stringutils.InSlice(image.MappedTopLayers, id) {
if err = istore.removeMappedTopLayer(image.ID, id); err != nil {
return errors.Wrapf(err, "remove mapped top layer %v from image %v", id, image.ID)
}
}
}
}
return nil
}
return ErrNotALayer
}