shifting: raise an error if the container needs shifting

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2018-07-27 16:56:56 +02:00
parent 06cea37b86
commit 3f55e5a3ac
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
@ -651,6 +652,12 @@ func (r *layerStore) Mount(id, mountLabel string, uidMaps, gidMaps []idtools.IDM
if mountLabel == "" {
mountLabel = layer.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 != "" {