1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

Create mount points for non-swap mounts; fixes #1506

This commit is contained in:
gizmotronic
2017-04-20 00:01:10 -05:00
parent 5078c80c36
commit b1d9732f65
4 changed files with 72 additions and 18 deletions

View File

@@ -71,6 +71,25 @@ func ApplyConsole(cfg *rancherConfig.CloudConfig) {
if len(mount) != 4 {
log.Errorf("Unable to mount %s: must specify exactly four arguments", mount[1])
}
if mount[2] == "nfs" || mount[2] == "nfs4" {
if err := os.MkdirAll(mount[1], 0755); err != nil {
log.Errorf("Unable to create mount point %s: %v", mount[1], err)
continue
}
cmdArgs := []string{mount[0], mount[1], "-t", mount[2]}
if mount[3] != "" {
cmdArgs = append(cmdArgs, "-o", mount[3])
}
cmd := exec.Command("mount", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Errorf("Failed to mount %s: %v", mount[1], err)
}
continue
}
device := util.ResolveDevice(mount[0])
if mount[2] == "swap" {
@@ -84,17 +103,7 @@ func ApplyConsole(cfg *rancherConfig.CloudConfig) {
continue
}
cmdArgs := []string{device, mount[1]}
if mount[2] != "" {
cmdArgs = append(cmdArgs, "-t", mount[2])
}
if mount[3] != "" {
cmdArgs = append(cmdArgs, "-o", mount[3])
}
cmd := exec.Command("mount", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
if err := util.Mount(device, mount[1], mount[2], mount[3]); err != nil {
log.Errorf("Failed to mount %s: %v", mount[1], err)
}
}