summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhoenix The Fallen <thephoenixofthevoid@gmail.com>2021-03-24 22:53:53 +0300
committerPhoenix The Fallen <thephoenixofthevoid@gmail.com>2021-03-24 22:53:53 +0300
commitf2181141e1aea2bafef786d83b90eea54010854b (patch)
treeadff4fc974f5e3651ce243e48e33027bbc292fb7
parentaf91f27d85f4104267eea493f8588f8c6a2d01e3 (diff)
downloadpodman-f2181141e1aea2bafef786d83b90eea54010854b.tar.gz
podman-f2181141e1aea2bafef786d83b90eea54010854b.tar.bz2
podman-f2181141e1aea2bafef786d83b90eea54010854b.zip
[NO TESTS NEEDED] Fix rootless volume plugins
In a case of volume plugins with custom options. Signed-off-by: Phoenix The Fallen <thephoenixofthevoid@gmail.com>
-rw-r--r--libpod/options.go9
-rw-r--r--libpod/volume_internal_linux.go10
2 files changed, 6 insertions, 13 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 85862cc17..2d64abcdf 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1577,8 +1577,6 @@ func WithVolumeLabels(labels map[string]string) VolumeCreateOption {
}
// WithVolumeOptions sets the options of the volume.
-// If the "local" driver has been selected, options will be validated. There are
-// currently 3 valid options for the "local" driver - o, type, and device.
func WithVolumeOptions(options map[string]string) VolumeCreateOption {
return func(volume *Volume) error {
if volume.valid {
@@ -1587,13 +1585,6 @@ func WithVolumeOptions(options map[string]string) VolumeCreateOption {
volume.config.Options = make(map[string]string)
for key, value := range options {
- switch key {
- case "type", "device", "o", "UID", "GID":
- volume.config.Options[key] = value
- default:
- return errors.Wrapf(define.ErrInvalidArg, "unrecognized volume option %q is not supported with local driver", key)
- }
-
volume.config.Options[key] = value
}
diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go
index 67ac41874..92391de1d 100644
--- a/libpod/volume_internal_linux.go
+++ b/libpod/volume_internal_linux.go
@@ -32,8 +32,10 @@ func (v *Volume) mount() error {
return nil
}
- // We cannot mount volumes as rootless.
- if rootless.IsRootless() {
+ // We cannot mount 'local' volumes as rootless.
+ if !v.UsesVolumeDriver() && rootless.IsRootless() {
+ // This check should only be applied to 'local' driver
+ // so Volume Drivers must be excluded
return errors.Wrapf(define.ErrRootless, "cannot mount volumes without root privileges")
}
@@ -137,8 +139,8 @@ func (v *Volume) unmount(force bool) error {
return nil
}
- // We cannot unmount volumes as rootless.
- if rootless.IsRootless() {
+ // We cannot unmount 'local' volumes as rootless.
+ if !v.UsesVolumeDriver() && rootless.IsRootless() {
// If force is set, just clear the counter and bail without
// error, so we can remove volumes from the state if they are in
// an awkward configuration.