Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve messages on unsupported storage drivers #70

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/aufs/aufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (

rsystem "github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
)

var (
Expand Down Expand Up @@ -81,7 +82,7 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap

// Try to load the aufs kernel module
if err := supportsAufs(); err != nil {
return nil, graphdriver.ErrNotSupported
return nil, errors.Wrapf(graphdriver.ErrNotSupported, "aufs")
}

fsMagic, err := graphdriver.GetFSMagic(root)
Expand Down
11 changes: 5 additions & 6 deletions drivers/devmapper/deviceset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package devmapper
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
Expand All @@ -29,8 +28,8 @@ import (
"github.com/containers/storage/pkg/mount"
"github.com/containers/storage/pkg/parsers"
"github.com/docker/go-units"

"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
)

var (
Expand Down Expand Up @@ -1474,7 +1473,7 @@ func determineDriverCapabilities(version string) error {
versionSplit := strings.Split(version, ".")
major, err := strconv.Atoi(versionSplit[0])
if err != nil {
return graphdriver.ErrNotSupported
return errors.Wrapf(graphdriver.ErrNotSupported, "devicemapper")
}

if major > 4 {
Expand All @@ -1488,7 +1487,7 @@ func determineDriverCapabilities(version string) error {

minor, err := strconv.Atoi(versionSplit[1])
if err != nil {
return graphdriver.ErrNotSupported
return errors.Wrapf(graphdriver.ErrNotSupported, "devicemapper")
}

/*
Expand Down Expand Up @@ -1655,11 +1654,11 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
version, err := devicemapper.GetDriverVersion()
if err != nil {
// Can't even get driver version, assume not supported
return graphdriver.ErrNotSupported
return errors.Wrapf(graphdriver.ErrNotSupported, "devicemapper")
}

if err := determineDriverCapabilities(version); err != nil {
return graphdriver.ErrNotSupported
return errors.Wrapf(graphdriver.ErrNotSupported, "devicemapper")
}

if err := devices.enableDeferredRemovalDeletion(); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions drivers/driver.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package graphdriver

import (
"errors"
"fmt"
"os"
"path/filepath"
Expand All @@ -12,6 +11,7 @@ import (

"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/idtools"
"github.com/pkg/errors"
)

// FsMagic unsigned id of the filesystem in use.
Expand Down Expand Up @@ -144,7 +144,7 @@ func GetDriver(name, home string, options []string, uidMaps, gidMaps []idtools.I
return pluginDriver, nil
}
logrus.Errorf("Failed to GetDriver graph %s %s", name, home)
return nil, ErrNotSupported
return nil, errors.Wrapf(ErrNotSupported, name)
}

// getBuiltinDriver initializes and returns the registered driver, but does not try to load from plugins
Expand All @@ -153,7 +153,7 @@ func getBuiltinDriver(name, home string, options []string, uidMaps, gidMaps []id
return initFunc(filepath.Join(home, name), options, uidMaps, gidMaps)
}
logrus.Errorf("Failed to built-in GetDriver graph %s %s", name, home)
return nil, ErrNotSupported
return nil, errors.Wrapf(ErrNotSupported, name)
}

// New creates the driver and initializes it at the specified root.
Expand Down
9 changes: 4 additions & 5 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package overlay

import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
Expand All @@ -25,8 +24,8 @@ import (
"github.com/containers/storage/pkg/mount"
"github.com/containers/storage/pkg/parsers"
"github.com/containers/storage/pkg/parsers/kernel"

"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
)

var (
Expand Down Expand Up @@ -102,7 +101,7 @@ func InitWithName(name, home string, options []string, uidMaps, gidMaps []idtool
}

if err := supportsOverlay(); err != nil {
return nil, graphdriver.ErrNotSupported
return nil, errors.Wrapf(graphdriver.ErrNotSupported, "overlay")
}

// require kernel 4.0.0 to ensure multiple lower dirs are supported
Expand All @@ -112,7 +111,7 @@ func InitWithName(name, home string, options []string, uidMaps, gidMaps []idtool
}
if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 4, Major: 0, Minor: 0}) < 0 {
if !opts.overrideKernelCheck {
return nil, graphdriver.ErrNotSupported
return nil, errors.Wrapf(graphdriver.ErrNotSupported, "overlay")
}
logrus.Warnf("Using pre-4.0.0 kernel for overlay, mount failures may require kernel update")
}
Expand Down Expand Up @@ -231,7 +230,7 @@ func supportsOverlay() error {
}
}
logrus.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.")
return graphdriver.ErrNotSupported
return errors.Wrapf(graphdriver.ErrNotSupported, "overlay")
}

func (d *Driver) String() string {
Expand Down
6 changes: 5 additions & 1 deletion drivers/plugin_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

package graphdriver

import (
"github.com/pkg/errors"
)

func lookupPlugin(name, home string, opts []string) (Driver, error) {
return nil, ErrNotSupported
return nil, errors.Wrapf(ErrNotSupported, "plugin")
}