@@ -63,23 +63,23 @@ type Mounter struct {
63
63
// currently come from mount(8), e.g. "ro", "remount", "bind", etc. If no more option is
64
64
// required, call Mount with an empty string list or nil.
65
65
func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
66
-
// Path to mounter binary. Set to mount accessible via $PATH by default.
66
+
// Path to mounter binary if containerized mounter is needed. Otherwise, it is set to empty.
67
67
// All Linux distros are expected to be shipped with a mount utility that an support bind mounts.
68
-
mounterPath := defaultMountCommand
68
+
mounterPath := ""
69
69
bind, bindRemountOpts := isBind(options)
70
70
if bind {
71
-
err := doMount(mounterPath, source, target, fstype, []string{"bind"})
71
+
err := doMount(mounterPath, defaultMountCommand, source, target, fstype, []string{"bind"})
72
72
if err != nil {
73
73
return err
74
74
}
75
-
return doMount(mounterPath, source, target, fstype, bindRemountOpts)
75
+
return doMount(mounterPath, defaultMountCommand, source, target, fstype, bindRemountOpts)
76
76
}
77
77
// The list of filesystems that require containerized mounter on GCI image cluster
78
-
fsTypesNeedMounter := sets.NewString("nfs", "glusterfs")
78
+
fsTypesNeedMounter := sets.NewString("nfs", "glusterfs", "ceph", "cifs")
79
79
if fsTypesNeedMounter.Has(fstype) {
80
80
mounterPath = mounter.mounterPath
81
81
}
82
-
return doMount(mounterPath, source, target, fstype, options)
82
+
return doMount(mounterPath, defaultMountCommand, source, target, fstype, options)
83
83
}
84
84
85
85
// isBind detects whether a bind mount is being requested and makes the remount options to
@@ -107,10 +107,13 @@ func isBind(options []string) (bool, []string) {
107
107
return bind, bindRemountOpts
108
108
}
109
109
110
-
// doMount runs the mount command.
111
-
func doMount(mountCmd string, source string, target string, fstype string, options []string) error {
112
-
glog.V(4).Infof("Mounting %s %s %s %v with command: %q", source, target, fstype, options, mountCmd)
110
+
// doMount runs the mount command. mounterPath is the path to mounter binary if containerized mounter is used.
111
+
func doMount(mounterPath string, mountCmd string, source string, target string, fstype string, options []string) error {
113
112
mountArgs := makeMountArgs(source, target, fstype, options)
113
+
if len(mounterPath) > 0 {
114
+
mountArgs = append([]string{mountCmd}, mountArgs...)
115
+
mountCmd = mounterPath
116
+
}
114
117
115
118
glog.V(4).Infof("Mounting cmd (%s) with arguments (%s)", mountCmd, mountArgs)
116
119
command := exec.Command(mountCmd, mountArgs...)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4