mirror of
https://github.com/containers/podman.git
synced 2025-12-04 20:28:40 +08:00
Vendor in latest containers/storage
This allows us to modify the containers mount option on a per/container basis Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
22
vendor/github.com/containers/storage/drivers/aufs/aufs.go
generated
vendored
22
vendor/github.com/containers/storage/drivers/aufs/aufs.go
generated
vendored
@@ -441,7 +441,7 @@ func (a *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
|
||||
// If a dir does not have a parent ( no layers )do not try to mount
|
||||
// just return the diff path to the data
|
||||
if len(parents) > 0 {
|
||||
if err := a.mount(id, m, options.MountLabel, parents); err != nil {
|
||||
if err := a.mount(id, m, parents, options); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
@@ -585,7 +585,7 @@ func (a *Driver) getParentLayerPaths(id string) ([]string, error) {
|
||||
return layers, nil
|
||||
}
|
||||
|
||||
func (a *Driver) mount(id string, target string, mountLabel string, layers []string) error {
|
||||
func (a *Driver) mount(id string, target string, layers []string, options graphdriver.MountOpts) error {
|
||||
a.Lock()
|
||||
defer a.Unlock()
|
||||
|
||||
@@ -596,7 +596,7 @@ func (a *Driver) mount(id string, target string, mountLabel string, layers []str
|
||||
|
||||
rw := a.getDiffPath(id)
|
||||
|
||||
if err := a.aufsMount(layers, rw, target, mountLabel); err != nil {
|
||||
if err := a.aufsMount(layers, rw, target, options); err != nil {
|
||||
return fmt.Errorf("error creating aufs mount to %s: %v", target, err)
|
||||
}
|
||||
return nil
|
||||
@@ -643,7 +643,7 @@ func (a *Driver) Cleanup() error {
|
||||
return mountpk.Unmount(a.root)
|
||||
}
|
||||
|
||||
func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err error) {
|
||||
func (a *Driver) aufsMount(ro []string, rw, target string, options graphdriver.MountOpts) (err error) {
|
||||
defer func() {
|
||||
if err != nil {
|
||||
Unmount(target)
|
||||
@@ -657,7 +657,7 @@ func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err erro
|
||||
if useDirperm() {
|
||||
offset += len(",dirperm1")
|
||||
}
|
||||
b := make([]byte, unix.Getpagesize()-len(mountLabel)-offset) // room for xino & mountLabel
|
||||
b := make([]byte, unix.Getpagesize()-len(options.MountLabel)-offset) // room for xino & mountLabel
|
||||
bp := copy(b, fmt.Sprintf("br:%s=rw", rw))
|
||||
|
||||
index := 0
|
||||
@@ -670,21 +670,25 @@ func (a *Driver) aufsMount(ro []string, rw, target, mountLabel string) (err erro
|
||||
}
|
||||
|
||||
opts := "dio,xino=/dev/shm/aufs.xino"
|
||||
if a.mountOptions != "" {
|
||||
opts += fmt.Sprintf(",%s", a.mountOptions)
|
||||
mountOptions := a.mountOptions
|
||||
if len(options.Options) > 0 {
|
||||
mountOptions = strings.Join(options.Options, ",")
|
||||
}
|
||||
if mountOptions != "" {
|
||||
opts += fmt.Sprintf(",%s", mountOptions)
|
||||
}
|
||||
|
||||
if useDirperm() {
|
||||
opts += ",dirperm1"
|
||||
}
|
||||
data := label.FormatMountLabel(fmt.Sprintf("%s,%s", string(b[:bp]), opts), mountLabel)
|
||||
data := label.FormatMountLabel(fmt.Sprintf("%s,%s", string(b[:bp]), opts), options.MountLabel)
|
||||
if err = mount("none", target, "aufs", 0, data); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for ; index < len(ro); index++ {
|
||||
layer := fmt.Sprintf(":%s=ro+wh", ro[index])
|
||||
data := label.FormatMountLabel(fmt.Sprintf("append%s", layer), mountLabel)
|
||||
data := label.FormatMountLabel(fmt.Sprintf("append%s", layer), options.MountLabel)
|
||||
if err = mount("none", target, "aufs", unix.MS_REMOUNT, data); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
3
vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
generated
vendored
3
vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
generated
vendored
@@ -640,6 +640,9 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(options.Options) > 0 {
|
||||
return "", fmt.Errorf("btrfs driver does not support mount options")
|
||||
}
|
||||
|
||||
if !st.IsDir() {
|
||||
return "", fmt.Errorf("%s: not a directory", dir)
|
||||
|
||||
15
vendor/github.com/containers/storage/drivers/devmapper/deviceset.go
generated
vendored
15
vendor/github.com/containers/storage/drivers/devmapper/deviceset.go
generated
vendored
@@ -2364,7 +2364,7 @@ func (devices *DeviceSet) xfsSetNospaceRetries(info *devInfo) error {
|
||||
}
|
||||
|
||||
// MountDevice mounts the device if not already mounted.
|
||||
func (devices *DeviceSet) MountDevice(hash, path, mountLabel string) error {
|
||||
func (devices *DeviceSet) MountDevice(hash, path string, moptions graphdriver.MountOpts) error {
|
||||
info, err := devices.lookupDeviceWithLock(hash)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -2396,8 +2396,17 @@ func (devices *DeviceSet) MountDevice(hash, path, mountLabel string) error {
|
||||
options = joinMountOptions(options, "nouuid")
|
||||
}
|
||||
|
||||
options = joinMountOptions(options, devices.mountOptions)
|
||||
options = joinMountOptions(options, label.FormatMountLabel("", mountLabel))
|
||||
mountOptions := devices.mountOptions
|
||||
if len(moptions.Options) > 0 {
|
||||
addNouuid := strings.Contains("nouuid", mountOptions)
|
||||
mountOptions = strings.Join(moptions.Options, ",")
|
||||
if addNouuid {
|
||||
mountOptions = fmt.Sprintf("nouuid,", mountOptions)
|
||||
}
|
||||
}
|
||||
|
||||
options = joinMountOptions(options, mountOptions)
|
||||
options = joinMountOptions(options, label.FormatMountLabel("", moptions.MountLabel))
|
||||
|
||||
if err := mount.Mount(info.DevName(), path, fstype, options); err != nil {
|
||||
return fmt.Errorf("devmapper: Error mounting '%s' on '%s': %s\n%v", info.DevName(), path, err, string(dmesg.Dmesg(256)))
|
||||
|
||||
5
vendor/github.com/containers/storage/drivers/devmapper/driver.go
generated
vendored
5
vendor/github.com/containers/storage/drivers/devmapper/driver.go
generated
vendored
@@ -9,8 +9,6 @@ import (
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/containers/storage/drivers"
|
||||
"github.com/containers/storage/pkg/devicemapper"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
@@ -18,6 +16,7 @@ import (
|
||||
"github.com/containers/storage/pkg/mount"
|
||||
"github.com/containers/storage/pkg/system"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -189,7 +188,7 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
|
||||
}
|
||||
|
||||
// Mount the device
|
||||
if err := d.DeviceSet.MountDevice(id, mp, options.MountLabel); err != nil {
|
||||
if err := d.DeviceSet.MountDevice(id, mp, options); err != nil {
|
||||
d.ctr.Decrement(mp)
|
||||
return "", err
|
||||
}
|
||||
|
||||
1
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
1
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
@@ -49,6 +49,7 @@ type MountOpts struct {
|
||||
// UidMaps & GidMaps are the User Namespace mappings to be assigned to content in the mount point
|
||||
UidMaps []idtools.IDMap
|
||||
GidMaps []idtools.IDMap
|
||||
Options []string
|
||||
}
|
||||
|
||||
// InitFunc initializes the storage driver.
|
||||
|
||||
4
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
4
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@@ -743,7 +743,9 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
|
||||
|
||||
workDir := path.Join(dir, "work")
|
||||
opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", strings.Join(absLowers, ":"), diffDir, workDir)
|
||||
if d.options.mountOptions != "" {
|
||||
if len(options.Options) > 0 {
|
||||
opts = fmt.Sprintf("%s,%s", strings.Join(options.Options, ","), opts)
|
||||
} else if d.options.mountOptions != "" {
|
||||
opts = fmt.Sprintf("%s,%s", d.options.mountOptions, opts)
|
||||
}
|
||||
mountData := label.FormatMountLabel(opts, options.MountLabel)
|
||||
|
||||
3
vendor/github.com/containers/storage/drivers/vfs/driver.go
generated
vendored
3
vendor/github.com/containers/storage/drivers/vfs/driver.go
generated
vendored
@@ -181,6 +181,9 @@ func (d *Driver) Remove(id string) error {
|
||||
// Get returns the directory for the given id.
|
||||
func (d *Driver) Get(id string, options graphdriver.MountOpts) (_ string, retErr error) {
|
||||
dir := d.dir(id)
|
||||
if len(options.Options) > 0 {
|
||||
return "", fmt.Errorf("vfs driver does not support mount options")
|
||||
}
|
||||
if st, err := os.Stat(dir); err != nil {
|
||||
return "", err
|
||||
} else if !st.IsDir() {
|
||||
|
||||
3
vendor/github.com/containers/storage/drivers/windows/windows.go
generated
vendored
3
vendor/github.com/containers/storage/drivers/windows/windows.go
generated
vendored
@@ -367,6 +367,9 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
|
||||
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, options.MountLabel)
|
||||
var dir string
|
||||
|
||||
if len(options.Options) > 0 {
|
||||
return "", fmt.Errorf("windows driver does not support mount options")
|
||||
}
|
||||
rID, err := d.resolveID(id)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
7
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
7
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
@@ -366,8 +366,13 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
|
||||
return mountpoint, nil
|
||||
}
|
||||
|
||||
mountOptions := d.options.mountOptions
|
||||
if len(options.Options) > 0 {
|
||||
mountOptions = strings.Join(options.Options, ",")
|
||||
}
|
||||
|
||||
filesystem := d.zfsPath(id)
|
||||
opts := label.FormatMountLabel(d.options.mountOptions, options.MountLabel)
|
||||
opts := label.FormatMountLabel(mountOptions, options.MountLabel)
|
||||
logrus.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, opts)
|
||||
|
||||
rootUID, rootGID, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
|
||||
|
||||
Reference in New Issue
Block a user