mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 08:25:43 +03:00
19 lines
396 B
Go
19 lines
396 B
Go
package allocdir
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"syscall"
|
|
)
|
|
|
|
// Bind mounts the shared directory into the task directory. Must be root to
|
|
// run.
|
|
func (d *AllocDir) mountSharedDir(taskDir string) error {
|
|
taskLoc := filepath.Join(taskDir, SharedAllocName)
|
|
if err := os.Mkdir(taskLoc, 0777); err != nil {
|
|
return err
|
|
}
|
|
|
|
return syscall.Mount(d.SharedDir, taskLoc, "", syscall.MS_BIND, "")
|
|
}
|