Use fewer modprobes
Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
This commit is contained in:
parent
e4cc3adf81
commit
074eca1d79
3 changed files with 26 additions and 10 deletions
|
@ -540,8 +540,14 @@ func xfsSupported() error {
|
|||
return err // error text is descriptive enough
|
||||
}
|
||||
|
||||
// Check if kernel supports xfs filesystem or not.
|
||||
exec.Command("modprobe", "xfs").Run()
|
||||
mountTarget, err := ioutil.TempDir("", "supportsXFS")
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error checking for xfs support")
|
||||
}
|
||||
|
||||
/* The mounting will fail--after the module has been loaded.*/
|
||||
defer os.RemoveAll(mountTarget)
|
||||
unix.Mount("none", mountTarget, "xfs", 0, "")
|
||||
|
||||
f, err := os.Open("/proc/filesystems")
|
||||
if err != nil {
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
@ -201,9 +200,15 @@ func parseOptions(options []string) (*overlayOptions, error) {
|
|||
}
|
||||
|
||||
func supportsOverlay() error {
|
||||
// We can try to modprobe overlay first before looking at
|
||||
// proc/filesystems for when overlay is supported
|
||||
exec.Command("modprobe", "overlay").Run()
|
||||
// Access overlay filesystem so that Linux loads it (if possible).
|
||||
mountTarget, err := ioutil.TempDir("", "supportsOverlay")
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithField("storage-driver", "overlay2").Error("could not create temporary directory, so assuming that 'overlay' is not supported")
|
||||
return graphdriver.ErrNotSupported
|
||||
}
|
||||
/* The mounting will fail--after the module has been loaded.*/
|
||||
defer os.RemoveAll(mountTarget)
|
||||
unix.Mount("overlay", mountTarget, "overlay", 0, "")
|
||||
|
||||
f, err := os.Open("/proc/filesystems")
|
||||
if err != nil {
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
@ -273,9 +272,15 @@ func parseOptions(options []string) (*overlayOptions, error) {
|
|||
}
|
||||
|
||||
func supportsOverlay() error {
|
||||
// We can try to modprobe overlay first before looking at
|
||||
// proc/filesystems for when overlay is supported
|
||||
exec.Command("modprobe", "overlay").Run()
|
||||
// Access overlay filesystem so that Linux loads it (if possible).
|
||||
mountTarget, err := ioutil.TempDir("", "supportsOverlay2")
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithField("storage-driver", "overlay2").Error("could not create temporary directory, so assuming that 'overlay' is not supported")
|
||||
return graphdriver.ErrNotSupported
|
||||
}
|
||||
/* The mounting will fail--after the module has been loaded.*/
|
||||
defer os.RemoveAll(mountTarget)
|
||||
unix.Mount("overlay", mountTarget, "overlay", 0, "")
|
||||
|
||||
f, err := os.Open("/proc/filesystems")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue