From 27b002f4a02e2d9f6eded9004b82cb81f121264f Mon Sep 17 00:00:00 2001 From: Drew Hubl Date: Mon, 24 Jul 2017 01:23:45 -0600 Subject: [PATCH] Improve zfs init log message for zfs Signed-off-by: Drew Hubl Signed-off-by: Brian Goff --- daemon/graphdriver/zfs/zfs_linux.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/daemon/graphdriver/zfs/zfs_linux.go b/daemon/graphdriver/zfs/zfs_linux.go index 71d6d3cb4d..62ef63528a 100644 --- a/daemon/graphdriver/zfs/zfs_linux.go +++ b/daemon/graphdriver/zfs/zfs_linux.go @@ -1,21 +1,22 @@ package zfs import ( - "fmt" - "github.com/docker/docker/daemon/graphdriver" "github.com/sirupsen/logrus" - "golang.org/x/sys/unix" ) -func checkRootdirFs(rootdir string) error { - var buf unix.Statfs_t - if err := unix.Statfs(rootdir, &buf); err != nil { - return fmt.Errorf("Failed to access '%s': %s", rootdir, err) +func checkRootdirFs(rootDir string) error { + fsMagic, err := graphdriver.GetFSMagic(rootDir) + if err != nil { + return err + } + backingFS := "unknown" + if fsName, ok := graphdriver.FsNames[fsMagic]; ok { + backingFS = fsName } - if graphdriver.FsMagic(buf.Type) != graphdriver.FsMagicZfs { - logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir) + if fsMagic != graphdriver.FsMagicZfs { + logrus.WithField("root", rootDir).WithField("backingFS", backingFS).WithField("driver", "zfs").Error("No zfs dataset found for root") return graphdriver.ErrPrerequisites }