Skip to content

Commit e523d09

Browse files
Merge pull request #9808 from thephoenixofthevoid/issue-9650-fixed
[NO TESTS NEEDED] Fix rootless volume plugins
2 parents ebb57df + f218114 commit e523d09

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

libpod/options.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,6 @@ func WithVolumeLabels(labels map[string]string) VolumeCreateOption {
15771577
}
15781578

15791579
// WithVolumeOptions sets the options of the volume.
1580-
// If the "local" driver has been selected, options will be validated. There are
1581-
// currently 3 valid options for the "local" driver - o, type, and device.
15821580
func WithVolumeOptions(options map[string]string) VolumeCreateOption {
15831581
return func(volume *Volume) error {
15841582
if volume.valid {
@@ -1587,13 +1585,6 @@ func WithVolumeOptions(options map[string]string) VolumeCreateOption {
15871585

15881586
volume.config.Options = make(map[string]string)
15891587
for key, value := range options {
1590-
switch key {
1591-
case "type", "device", "o", "UID", "GID":
1592-
volume.config.Options[key] = value
1593-
default:
1594-
return errors.Wrapf(define.ErrInvalidArg, "unrecognized volume option %q is not supported with local driver", key)
1595-
}
1596-
15971588
volume.config.Options[key] = value
15981589
}
15991590

libpod/volume_internal_linux.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ func (v *Volume) mount() error {
3232
return nil
3333
}
3434

35-
// We cannot mount volumes as rootless.
36-
if rootless.IsRootless() {
35+
// We cannot mount 'local' volumes as rootless.
36+
if !v.UsesVolumeDriver() && rootless.IsRootless() {
37+
// This check should only be applied to 'local' driver
38+
// so Volume Drivers must be excluded
3739
return errors.Wrapf(define.ErrRootless, "cannot mount volumes without root privileges")
3840
}
3941

@@ -137,8 +139,8 @@ func (v *Volume) unmount(force bool) error {
137139
return nil
138140
}
139141

140-
// We cannot unmount volumes as rootless.
141-
if rootless.IsRootless() {
142+
// We cannot unmount 'local' volumes as rootless.
143+
if !v.UsesVolumeDriver() && rootless.IsRootless() {
142144
// If force is set, just clear the counter and bail without
143145
// error, so we can remove volumes from the state if they are in
144146
// an awkward configuration.

0 commit comments

Comments
 (0)