summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-30 21:18:49 +0100
committerGitHub <noreply@github.com>2019-10-30 21:18:49 +0100
commit32266d155fe156ef562d8fed27112d5644fd8c77 (patch)
tree91cce182791bbbc4e8d89ad179ea7b4eab5a68ac /libpod
parent9ba8dae0bfa5a5e894cf80e2ed114f6ca4bceb60 (diff)
parent3e891c1b6036f9df050cad8bf3517c7d9f82876e (diff)
downloadpodman-32266d155fe156ef562d8fed27112d5644fd8c77.tar.gz
podman-32266d155fe156ef562d8fed27112d5644fd8c77.tar.bz2
podman-32266d155fe156ef562d8fed27112d5644fd8c77.zip
Merge pull request #4305 from mheon/fix_volume_mount
Wait for `mount` command to finish when mounting volume
Diffstat (limited to 'libpod')
-rw-r--r--libpod/volume_internal_linux.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go
index 4c0332018..70eccbecb 100644
--- a/libpod/volume_internal_linux.go
+++ b/libpod/volume_internal_linux.go
@@ -3,8 +3,8 @@
package libpod
import (
- "io/ioutil"
"os/exec"
+ "strings"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/rootless"
@@ -72,16 +72,10 @@ func (v *Volume) mount() error {
mountArgs = append(mountArgs, volDevice, v.config.MountPoint)
mountCmd := exec.Command(mountPath, mountArgs...)
- errPipe, err := mountCmd.StderrPipe()
- if err != nil {
- return errors.Wrapf(err, "error getting stderr pipe for mount")
- }
- if err := mountCmd.Start(); err != nil {
- out, err2 := ioutil.ReadAll(errPipe)
- if err2 != nil {
- return errors.Wrapf(err2, "error reading mount STDERR")
- }
- return errors.Wrapf(errors.New(string(out)), "error mounting volume %s", v.Name())
+ logrus.Debugf("Running mount command: %s %s", mountPath, strings.Join(mountArgs, " "))
+ if output, err := mountCmd.CombinedOutput(); err != nil {
+ logrus.Debugf("Mount failed with %v", err)
+ return errors.Wrapf(errors.Errorf(string(output)), "error mounting volume %s", v.Name())
}
logrus.Debugf("Mounted volume %s", v.Name())