Skip to content

Commit

Permalink
[NO TESTS NEEDED] Fix rootless volume plugins
Browse files Browse the repository at this point in the history
In a case of volume plugins with custom options.

Signed-off-by: Phoenix The Fallen <[email protected]>
  • Loading branch information
thephoenixofthevoid committed Mar 23, 2021
1 parent 900db7c commit f7d223a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libpod/volume_internal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit f7d223a

Please sign in to comment.