mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Mount shared alloc dir, modified API and tests
This commit is contained in:
18
client/allocdir/alloc_dir_linux.go
Normal file
18
client/allocdir/alloc_dir_linux.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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, "")
|
||||
}
|
||||
Reference in New Issue
Block a user