зеркало из https://github.com/microsoft/docker.git
try to load aufs module, disply error on failure
This commit is contained in:
Родитель
27be5aec74
Коммит
ac49a797b4
16
image.go
16
image.go
|
@ -7,7 +7,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -92,7 +94,19 @@ func MountAUFS(ro []string, rw string, target string) error {
|
||||||
roBranches += fmt.Sprintf("%v=ro:", layer)
|
roBranches += fmt.Sprintf("%v=ro:", layer)
|
||||||
}
|
}
|
||||||
branches := fmt.Sprintf("br:%v:%v", rwBranch, roBranches)
|
branches := fmt.Sprintf("br:%v:%v", rwBranch, roBranches)
|
||||||
return mount("none", target, "aufs", 0, branches)
|
|
||||||
|
//if error, try to load aufs kernel module
|
||||||
|
if err := mount("none", target, "aufs", 0, branches); err != nil {
|
||||||
|
log.Printf("Kernel does not support AUFS, trying to load the AUFS module with modprobe...")
|
||||||
|
if err := exec.Command("modprobe", "aufs").Run(); err != nil {
|
||||||
|
return fmt.Errorf("Unable to load the AUFS module")
|
||||||
|
}
|
||||||
|
log.Printf("...module loaded.")
|
||||||
|
if err := mount("none", target, "aufs", 0, branches); err != nil {
|
||||||
|
return fmt.Errorf("Unable to mount using aufs")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (image *Image) Mount(root, rw string) error {
|
func (image *Image) Mount(root, rw string) error {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче