Skip to content

Commit

Permalink
Append mount options from K8S to the mount command options flag value.
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatsc committed Sep 3, 2019
1 parent 7d27d99 commit 99f1cf8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions driver/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ func Mount(source, target, fsType string, opts []string) error {
cmd := "mount"
var options []string
options = append(options, "-o")
if len(opts) > 0 {
options = append(options, strings.Join(opts, ","))
}
options = append(options, "bind")
opts = append(opts, "bind")
options = append(options, strings.Join(opts, ","))
options = append(options, source)
options = append(options, target)
glog.Infof("Executing mount command '%s %s'", cmd, strings.Join(options, " "))
if out, err := exec.Command(cmd, options...).CombinedOutput(); err != nil {
return fmt.Errorf("failed mount: %v cmd: '%s %s' command output: %q", err, cmd, target, string(out))
return fmt.Errorf("failed mount: %v cmd: '%s %s %s' command output: %q", err, cmd, options, target, string(out))
}
return nil
}
Expand Down

0 comments on commit 99f1cf8

Please sign in to comment.