vendor: update containers/storage

update to version 956a1971694f18fd602b1203c0a2d192e2cc88a1

inherit support for IDs shifting when fuse-overlayfs is used.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1177
Approved by: mheon
This commit is contained in:
Giuseppe Scrivano
2018-07-28 09:14:59 +02:00
committed by Atomic Bot
parent 5aa36c1861
commit a4a667eac9
14 changed files with 158 additions and 162 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
@ -208,7 +209,8 @@ type LayerStore interface {
// Mount mounts a layer for use. If the specified layer is the parent of other
// layers, it should not be written to. An SELinux label to be applied to the
// mount can be specified to override the one configured for the layer.
Mount(id, mountLabel string) (string, error)
// The mappings used by the container can be specified.
Mount(id, mountLabel string, uidMaps, gidMaps []idtools.IDMap) (string, error)
// Unmount unmounts a layer when it is no longer in use.
Unmount(id string, force bool) (bool, error)
@ -635,7 +637,7 @@ func (r *layerStore) Mounted(id string) (int, error) {
return layer.MountCount, nil
}
func (r *layerStore) Mount(id, mountLabel string) (string, error) {
func (r *layerStore) Mount(id, mountLabel string, uidMaps, gidMaps []idtools.IDMap) (string, error) {
if !r.IsReadWrite() {
return "", errors.Wrapf(ErrStoreIsReadOnly, "not allowed to update mount locations for layers at %q", r.mountspath())
}
@ -650,7 +652,13 @@ func (r *layerStore) Mount(id, mountLabel string) (string, error) {
if mountLabel == "" {
mountLabel = layer.MountLabel
}
mountpoint, err := r.driver.Get(id, mountLabel)
if (uidMaps != nil || gidMaps != nil) && !r.driver.SupportsShifting() {
if !reflect.DeepEqual(uidMaps, layer.UIDMap) || !reflect.DeepEqual(gidMaps, layer.GIDMap) {
return "", fmt.Errorf("cannot mount layer %v: shifting not enabled", layer.ID)
}
}
mountpoint, err := r.driver.Get(id, mountLabel, uidMaps, gidMaps)
if mountpoint != "" && err == nil {
if layer.MountPoint != "" {
delete(r.bymount, layer.MountPoint)
@ -937,7 +945,7 @@ func (r *layerStore) newFileGetter(id string) (drivers.FileGetCloser, error) {
if getter, ok := r.driver.(drivers.DiffGetterDriver); ok {
return getter.DiffGetter(id)
}
path, err := r.Mount(id, "")
path, err := r.Mount(id, "", nil, nil)
if err != nil {
return nil, err
}