mirror of
https://github.com/rancher/os.git
synced 2025-08-17 14:28:16 +00:00
Check user-docker backingFS
This commit is contained in:
parent
18b2fe50af
commit
bfd9baa280
@ -95,6 +95,11 @@ func dockerInitAction(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = checkZfsBackingFS(cfg.Rancher.Docker.StorageDriver, cfg.Rancher.Docker.Graph)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"bash",
|
"bash",
|
||||||
"-c",
|
"-c",
|
||||||
|
@ -3,11 +3,15 @@ package control
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/rancher/os/config"
|
"github.com/rancher/os/config"
|
||||||
"github.com/rancher/os/pkg/log"
|
"github.com/rancher/os/pkg/log"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func yes(question string) bool {
|
func yes(question string) bool {
|
||||||
@ -56,6 +60,25 @@ func symLinkEngineBinary(version string) []symlink {
|
|||||||
return baseSymlink
|
return baseSymlink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkZfsBackingFS(driver, dir string) error {
|
||||||
|
if driver != "zfs" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
mountInfo, err := ioutil.ReadFile("/proc/self/mountinfo")
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, mount := range strings.Split(string(mountInfo), "\n") {
|
||||||
|
if strings.Contains(mount, dir) && strings.Contains(mount, driver) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
}
|
||||||
|
return errors.Errorf("BackingFS: %s not match storage-driver: %s", dir, driver)
|
||||||
|
}
|
||||||
|
|
||||||
func checkGlobalCfg() bool {
|
func checkGlobalCfg() bool {
|
||||||
_, err := os.Stat("/proc/1/root/boot/global.cfg")
|
_, err := os.Stat("/proc/1/root/boot/global.cfg")
|
||||||
if err == nil || os.IsExist(err) {
|
if err == nil || os.IsExist(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user