summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-08-05 12:31:32 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-08-05 14:50:29 -0400
commit234d8f9d284e160e009cb642cfe444d27e059a7a (patch)
treee380e4cf5d2f87da7ebcdfbe67ac04d03c57b6ec
parent44e229f24ea21a863bfb5ac23704be10f290b6cf (diff)
downloadpodman-234d8f9d284e160e009cb642cfe444d27e059a7a.tar.gz
podman-234d8f9d284e160e009cb642cfe444d27e059a7a.tar.bz2
podman-234d8f9d284e160e009cb642cfe444d27e059a7a.zip
Update to containers/storage v1.12.11
Picks up overlay caching fixes we need to resolve a BZ Signed-off-by: Matthew Heon <matthew.heon@pm.me>
-rw-r--r--vendor.conf2
-rw-r--r--vendor/github.com/containers/storage/drivers/aufs/aufs.go22
-rw-r--r--vendor/github.com/containers/storage/drivers/btrfs/btrfs.go10
-rw-r--r--vendor/github.com/containers/storage/drivers/devmapper/driver.go8
-rw-r--r--vendor/github.com/containers/storage/drivers/driver.go15
-rw-r--r--vendor/github.com/containers/storage/drivers/overlay/overlay.go124
-rw-r--r--vendor/github.com/containers/storage/drivers/vfs/driver.go8
-rw-r--r--vendor/github.com/containers/storage/drivers/windows/windows.go4
-rw-r--r--vendor/github.com/containers/storage/drivers/zfs/zfs.go10
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive.go9
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive_cgo.go17
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go16
-rw-r--r--vendor/github.com/containers/storage/store.go1
-rw-r--r--vendor/github.com/containers/storage/vendor.conf1
14 files changed, 189 insertions, 58 deletions
diff --git a/vendor.conf b/vendor.conf
index 370ab38a8..e03ef9ea4 100644
--- a/vendor.conf
+++ b/vendor.conf
@@ -19,7 +19,7 @@ github.com/containers/image v2.0.0
github.com/vbauerster/mpb v3.3.4
github.com/mattn/go-isatty v0.0.4
github.com/VividCortex/ewma v1.1.1
-github.com/containers/storage v1.12.10
+github.com/containers/storage v1.12.11
github.com/containers/psgo v1.3.0
github.com/coreos/go-systemd v17
github.com/coreos/pkg v4
diff --git a/vendor/github.com/containers/storage/drivers/aufs/aufs.go b/vendor/github.com/containers/storage/drivers/aufs/aufs.go
index 353d1707a..56bb081e9 100644
--- a/vendor/github.com/containers/storage/drivers/aufs/aufs.go
+++ b/vendor/github.com/containers/storage/drivers/aufs/aufs.go
@@ -83,7 +83,7 @@ type Driver struct {
// Init returns a new AUFS driver.
// An error is returned if AUFS is not supported.
-func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
+func Init(home string, options graphdriver.Options) (graphdriver.Driver, error) {
// Try to load the aufs kernel module
if err := supportsAufs(); err != nil {
@@ -91,7 +91,7 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
}
- fsMagic, err := graphdriver.GetFSMagic(root)
+ fsMagic, err := graphdriver.GetFSMagic(home)
if err != nil {
return nil, err
}
@@ -106,7 +106,7 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
}
var mountOptions string
- for _, option := range options {
+ for _, option := range options.DriverOptions {
key, val, err := parsers.ParseKeyValueOpt(option)
if err != nil {
return nil, err
@@ -126,36 +126,36 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
}
a := &Driver{
- root: root,
- uidMaps: uidMaps,
- gidMaps: gidMaps,
+ root: home,
+ uidMaps: options.UIDMaps,
+ gidMaps: options.GIDMaps,
pathCache: make(map[string]string),
ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicAufs)),
locker: locker.New(),
mountOptions: mountOptions,
}
- rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
+ rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
// Create the root aufs driver dir and return
// if it already exists
// If not populate the dir structure
- if err := idtools.MkdirAllAs(root, 0700, rootUID, rootGID); err != nil {
+ if err := idtools.MkdirAllAs(home, 0700, rootUID, rootGID); err != nil {
if os.IsExist(err) {
return a, nil
}
return nil, err
}
- if err := mountpk.MakePrivate(root); err != nil {
+ if err := mountpk.MakePrivate(home); err != nil {
return nil, err
}
// Populate the dir structure
for _, p := range paths {
- if err := idtools.MkdirAllAs(path.Join(root, p), 0700, rootUID, rootGID); err != nil {
+ if err := idtools.MkdirAllAs(path.Join(home, p), 0700, rootUID, rootGID); err != nil {
return nil, err
}
}
@@ -165,7 +165,7 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
})
for _, path := range []string{"mnt", "diff"} {
- p := filepath.Join(root, path)
+ p := filepath.Join(home, path)
entries, err := ioutil.ReadDir(p)
if err != nil {
logger.WithError(err).WithField("dir", p).Error("error reading dir entries")
diff --git a/vendor/github.com/containers/storage/drivers/btrfs/btrfs.go b/vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
index 30254d9fb..6f632a98d 100644
--- a/vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
+++ b/vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
@@ -49,7 +49,7 @@ type btrfsOptions struct {
// Init returns a new BTRFS driver.
// An error is returned if BTRFS is not supported.
-func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
+func Init(home string, options graphdriver.Options) (graphdriver.Driver, error) {
fsMagic, err := graphdriver.GetFSMagic(home)
if err != nil {
@@ -60,7 +60,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, errors.Wrapf(graphdriver.ErrPrerequisites, "%q is not on a btrfs filesystem", home)
}
- rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
+ rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
@@ -72,15 +72,15 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, err
}
- opt, userDiskQuota, err := parseOptions(options)
+ opt, userDiskQuota, err := parseOptions(options.DriverOptions)
if err != nil {
return nil, err
}
driver := &Driver{
home: home,
- uidMaps: uidMaps,
- gidMaps: gidMaps,
+ uidMaps: options.UIDMaps,
+ gidMaps: options.GIDMaps,
options: opt,
}
diff --git a/vendor/github.com/containers/storage/drivers/devmapper/driver.go b/vendor/github.com/containers/storage/drivers/devmapper/driver.go
index 13677c93a..f384a6242 100644
--- a/vendor/github.com/containers/storage/drivers/devmapper/driver.go
+++ b/vendor/github.com/containers/storage/drivers/devmapper/driver.go
@@ -34,8 +34,8 @@ type Driver struct {
}
// Init creates a driver with the given home and the set of options.
-func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
- deviceSet, err := NewDeviceSet(home, true, options, uidMaps, gidMaps)
+func Init(home string, options graphdriver.Options) (graphdriver.Driver, error) {
+ deviceSet, err := NewDeviceSet(home, true, options.DriverOptions, options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
@@ -47,8 +47,8 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
d := &Driver{
DeviceSet: deviceSet,
home: home,
- uidMaps: uidMaps,
- gidMaps: gidMaps,
+ uidMaps: options.UIDMaps,
+ gidMaps: options.GIDMaps,
ctr: graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()),
locker: locker.New(),
}
diff --git a/vendor/github.com/containers/storage/drivers/driver.go b/vendor/github.com/containers/storage/drivers/driver.go
index e8f8bd5a7..3b56fd2e1 100644
--- a/vendor/github.com/containers/storage/drivers/driver.go
+++ b/vendor/github.com/containers/storage/drivers/driver.go
@@ -54,7 +54,7 @@ type MountOpts struct {
}
// InitFunc initializes the storage driver.
-type InitFunc func(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (Driver, error)
+type InitFunc func(homedir string, options Options) (Driver, error)
// ProtoDriver defines the basic capabilities of a driver.
// This interface exists solely to be a minimum set of methods
@@ -203,7 +203,7 @@ func Register(name string, initFunc InitFunc) error {
// GetDriver initializes and returns the registered driver
func GetDriver(name string, config Options) (Driver, error) {
if initFunc, exists := drivers[name]; exists {
- return initFunc(filepath.Join(config.Root, name), config.DriverOptions, config.UIDMaps, config.GIDMaps)
+ return initFunc(filepath.Join(config.Root, name), config)
}
logrus.Errorf("Failed to GetDriver graph %s %s", name, config.Root)
@@ -211,9 +211,9 @@ func GetDriver(name string, config Options) (Driver, error) {
}
// getBuiltinDriver initializes and returns the registered driver, but does not try to load from plugins
-func getBuiltinDriver(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap) (Driver, error) {
+func getBuiltinDriver(name, home string, options Options) (Driver, error) {
if initFunc, exists := drivers[name]; exists {
- return initFunc(filepath.Join(home, name), options, uidMaps, gidMaps)
+ return initFunc(filepath.Join(home, name), options)
}
logrus.Errorf("Failed to built-in GetDriver graph %s %s", name, home)
return nil, errors.Wrapf(ErrNotSupported, "failed to built-in GetDriver graph %s %s", name, home)
@@ -222,6 +222,7 @@ func getBuiltinDriver(name, home string, options []string, uidMaps, gidMaps []id
// Options is used to initialize a graphdriver
type Options struct {
Root string
+ RunRoot string
DriverOptions []string
UIDMaps []idtools.IDMap
GIDMaps []idtools.IDMap
@@ -245,7 +246,7 @@ func New(name string, config Options) (Driver, error) {
if _, prior := driversMap[name]; prior {
// of the state found from prior drivers, check in order of our priority
// which we would prefer
- driver, err := getBuiltinDriver(name, config.Root, config.DriverOptions, config.UIDMaps, config.GIDMaps)
+ driver, err := getBuiltinDriver(name, config.Root, config)
if err != nil {
// unlike below, we will return error here, because there is prior
// state, and now it is no longer supported/prereq/compatible, so
@@ -273,7 +274,7 @@ func New(name string, config Options) (Driver, error) {
// Check for priority drivers first
for _, name := range priority {
- driver, err := getBuiltinDriver(name, config.Root, config.DriverOptions, config.UIDMaps, config.GIDMaps)
+ driver, err := getBuiltinDriver(name, config.Root, config)
if err != nil {
if isDriverNotSupported(err) {
continue
@@ -285,7 +286,7 @@ func New(name string, config Options) (Driver, error) {
// Check all registered drivers if no priority driver is found
for name, initFunc := range drivers {
- driver, err := initFunc(filepath.Join(config.Root, name), config.DriverOptions, config.UIDMaps, config.GIDMaps)
+ driver, err := initFunc(filepath.Join(config.Root, name), config)
if err != nil {
if isDriverNotSupported(err) {
continue
diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
index ef83b6c87..00327a92e 100644
--- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go
+++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
@@ -97,6 +97,7 @@ type overlayOptions struct {
type Driver struct {
name string
home string
+ runhome string
uidMaps []idtools.IDMap
gidMaps []idtools.IDMap
ctr *graphdriver.RefCounter
@@ -125,8 +126,8 @@ func init() {
// Init returns the a native diff driver for overlay filesystem.
// If overlay filesystem is not supported on the host, a wrapped graphdriver.ErrNotSupported is returned as error.
// If an overlay filesystem is not supported over an existing filesystem then a wrapped graphdriver.ErrIncompatibleFS is returned.
-func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
- opts, err := parseOptions(options)
+func Init(home string, options graphdriver.Options) (graphdriver.Driver, error) {
+ opts, err := parseOptions(options.DriverOptions)
if err != nil {
return nil, err
}
@@ -148,7 +149,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
}
}
- rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
+ rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
@@ -157,32 +158,72 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil && !os.IsExist(err) {
return nil, err
}
+ runhome := filepath.Join(options.RunRoot, filepath.Base(home))
+ if err := idtools.MkdirAllAs(runhome, 0700, rootUID, rootGID); err != nil && !os.IsExist(err) {
+ return nil, err
+ }
var usingMetacopy bool
var supportsDType bool
if opts.mountProgram != "" {
supportsDType = true
} else {
- supportsDType, err = supportsOverlay(home, fsMagic, rootUID, rootGID)
- if err != nil {
- os.Remove(filepath.Join(home, linkDir))
- os.Remove(home)
- patherr, ok := err.(*os.PathError)
- if ok && patherr.Err == syscall.ENOSPC {
+ feature := "overlay"
+ overlayCacheResult, overlayCacheText, err := cachedFeatureCheck(runhome, feature)
+ if err == nil {
+ if overlayCacheResult {
+ logrus.Debugf("cached value indicated that overlay is supported")
+ } else {
+ logrus.Debugf("cached value indicated that overlay is not supported")
+ }
+ supportsDType = overlayCacheResult
+ if !supportsDType {
+ return nil, errors.New(overlayCacheText)
+ }
+ } else {
+ supportsDType, err = supportsOverlay(home, fsMagic, rootUID, rootGID)
+ if err != nil {
+ os.Remove(filepath.Join(home, linkDir))
+ os.Remove(home)
+ patherr, ok := err.(*os.PathError)
+ if ok && patherr.Err == syscall.ENOSPC {
+ return nil, err
+ }
+ err = errors.Wrap(err, "kernel does not support overlay fs")
+ if err2 := cachedFeatureRecord(runhome, feature, false, err.Error()); err2 != nil {
+ return nil, errors.Wrapf(err2, "error recording overlay not being supported (%v)", err)
+ }
return nil, err
}
- return nil, errors.Wrap(err, "kernel does not support overlay fs")
+ if err = cachedFeatureRecord(runhome, feature, supportsDType, ""); err != nil {
+ return nil, errors.Wrap(err, "error recording overlay support status")
+ }
}
- usingMetacopy, err = doesMetacopy(home, opts.mountOptions)
+
+ feature = fmt.Sprintf("metacopy(%s)", opts.mountOptions)
+ metacopyCacheResult, _, err := cachedFeatureCheck(runhome, feature)
if err == nil {
- if usingMetacopy {
- logrus.Debugf("overlay test mount indicated that metacopy is being used")
+ if metacopyCacheResult {
+ logrus.Debugf("cached value indicated that metacopy is being used")
} else {
- logrus.Debugf("overlay test mount indicated that metacopy is not being used")
+ logrus.Debugf("cached value indicated that metacopy is not being used")
}
+ usingMetacopy = metacopyCacheResult
} else {
- logrus.Warnf("overlay test mount did not indicate whether or not metacopy is being used: %v", err)
- return nil, err
+ usingMetacopy, err = doesMetacopy(home, opts.mountOptions)
+ if err == nil {
+ if usingMetacopy {
+ logrus.Debugf("overlay test mount indicated that metacopy is being used")
+ } else {
+ logrus.Debugf("overlay test mount indicated that metacopy is not being used")
+ }
+ if err = cachedFeatureRecord(runhome, feature, usingMetacopy, ""); err != nil {
+ return nil, errors.Wrap(err, "error recording metacopy-being-used status")
+ }
+ } else {
+ logrus.Warnf("overlay test mount did not indicate whether or not metacopy is being used: %v", err)
+ return nil, err
+ }
}
}
@@ -201,8 +242,9 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
d := &Driver{
name: "overlay",
home: home,
- uidMaps: uidMaps,
- gidMaps: gidMaps,
+ runhome: runhome,
+ uidMaps: options.UIDMaps,
+ gidMaps: options.GIDMaps,
ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
supportsDType: supportsDType,
usingMetacopy: usingMetacopy,
@@ -293,6 +335,36 @@ func parseOptions(options []string) (*overlayOptions, error) {
return o, nil
}
+func cachedFeatureSet(feature string, set bool) string {
+ if set {
+ return fmt.Sprintf("%s-true", feature)
+ }
+ return fmt.Sprintf("%s-false", feature)
+}
+
+func cachedFeatureCheck(runhome, feature string) (supported bool, text string, err error) {
+ content, err := ioutil.ReadFile(filepath.Join(runhome, cachedFeatureSet(feature, true)))
+ if err == nil {
+ return true, string(content), nil
+ }
+ content, err = ioutil.ReadFile(filepath.Join(runhome, cachedFeatureSet(feature, false)))
+ if err == nil {
+ return false, string(content), nil
+ }
+ return false, "", err
+}
+
+func cachedFeatureRecord(runhome, feature string, supported bool, text string) (err error) {
+ f, err := os.Create(filepath.Join(runhome, cachedFeatureSet(feature, supported)))
+ if f != nil {
+ if text != "" {
+ fmt.Fprintf(f, "%s", text)
+ }
+ f.Close()
+ }
+ return err
+}
+
func supportsOverlay(home string, homeMagic graphdriver.FsMagic, rootUID, rootGID int) (supportsDType bool, err error) {
// We can try to modprobe overlay first
@@ -369,10 +441,24 @@ func (d *Driver) useNaiveDiff() bool {
useNaiveDiffOnly = true
return
}
+ feature := fmt.Sprintf("native-diff(%s)", d.options.mountOptions)
+ nativeDiffCacheResult, nativeDiffCacheText, err := cachedFeatureCheck(d.runhome, feature)
+ if err == nil {
+ if nativeDiffCacheResult {
+ logrus.Debugf("cached value indicated that native-diff is usable")
+ } else {
+ logrus.Debugf("cached value indicated that native-diff is not being used")
+ logrus.Warn(nativeDiffCacheText)
+ }
+ useNaiveDiffOnly = !nativeDiffCacheResult
+ return
+ }
if err := doesSupportNativeDiff(d.home, d.options.mountOptions); err != nil {
- logrus.Warnf("Not using native diff for overlay, this may cause degraded performance for building images: %v", err)
+ nativeDiffCacheText = fmt.Sprintf("Not using native diff for overlay, this may cause degraded performance for building images: %v", err)
+ logrus.Warn(nativeDiffCacheText)
useNaiveDiffOnly = true
}
+ cachedFeatureRecord(d.runhome, feature, !useNaiveDiffOnly, nativeDiffCacheText)
})
return useNaiveDiffOnly
}
diff --git a/vendor/github.com/containers/storage/drivers/vfs/driver.go b/vendor/github.com/containers/storage/drivers/vfs/driver.go
index 9e256858c..d9cc9483e 100644
--- a/vendor/github.com/containers/storage/drivers/vfs/driver.go
+++ b/vendor/github.com/containers/storage/drivers/vfs/driver.go
@@ -24,16 +24,16 @@ func init() {
// Init returns a new VFS driver.
// This sets the home directory for the driver and returns NaiveDiffDriver.
-func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
+func Init(home string, options graphdriver.Options) (graphdriver.Driver, error) {
d := &Driver{
homes: []string{home},
- idMappings: idtools.NewIDMappingsFromMaps(uidMaps, gidMaps),
+ idMappings: idtools.NewIDMappingsFromMaps(options.UIDMaps, options.GIDMaps),
}
rootIDs := d.idMappings.RootPair()
if err := idtools.MkdirAllAndChown(home, 0700, rootIDs); err != nil {
return nil, err
}
- for _, option := range options {
+ for _, option := range options.DriverOptions {
if strings.HasPrefix(option, "vfs.imagestore=") {
d.homes = append(d.homes, strings.Split(option[15:], ",")...)
continue
@@ -59,7 +59,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
}
}
if d.ostreeRepo != "" {
- rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
+ rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/containers/storage/drivers/windows/windows.go b/vendor/github.com/containers/storage/drivers/windows/windows.go
index c7df1c1fe..f0437a275 100644
--- a/vendor/github.com/containers/storage/drivers/windows/windows.go
+++ b/vendor/github.com/containers/storage/drivers/windows/windows.go
@@ -83,10 +83,10 @@ type Driver struct {
}
// InitFilter returns a new Windows storage filter driver.
-func InitFilter(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
+func InitFilter(home string, options graphdriver.Options) (graphdriver.Driver, error) {
logrus.Debugf("WindowsGraphDriver InitFilter at %s", home)
- for _, option := range options {
+ for _, option := range options.DriverOptions {
if strings.HasPrefix(option, "windows.mountopt=") {
return nil, fmt.Errorf("windows driver does not support mount options")
} else {
diff --git a/vendor/github.com/containers/storage/drivers/zfs/zfs.go b/vendor/github.com/containers/storage/drivers/zfs/zfs.go
index eaa9e8bc5..a2bf5565b 100644
--- a/vendor/github.com/containers/storage/drivers/zfs/zfs.go
+++ b/vendor/github.com/containers/storage/drivers/zfs/zfs.go
@@ -44,7 +44,7 @@ func (*Logger) Log(cmd []string) {
// Init returns a new ZFS driver.
// It takes base mount path and an array of options which are represented as key value pairs.
// Each option is in the for key=value. 'zfs.fsname' is expected to be a valid key in the options.
-func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
+func Init(base string, opt graphdriver.Options) (graphdriver.Driver, error) {
var err error
logger := logrus.WithField("storage-driver", "zfs")
@@ -61,7 +61,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri
}
defer file.Close()
- options, err := parseOptions(opt)
+ options, err := parseOptions(opt.DriverOptions)
if err != nil {
return nil, err
}
@@ -103,7 +103,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri
return nil, fmt.Errorf("BUG: zfs get all -t filesystem -rHp '%s' should contain '%s'", options.fsName, options.fsName)
}
- rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
+ rootUID, rootGID, err := idtools.GetRootUIDGID(opt.UIDMaps, opt.GIDMaps)
if err != nil {
return nil, fmt.Errorf("Failed to get root uid/guid: %v", err)
}
@@ -115,8 +115,8 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri
dataset: rootDataset,
options: options,
filesystemsCache: filesystemsCache,
- uidMaps: uidMaps,
- gidMaps: gidMaps,
+ uidMaps: opt.UIDMaps,
+ gidMaps: opt.GIDMaps,
ctr: graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()),
}
return graphdriver.NewNaiveDiffDriver(d, graphdriver.NewNaiveLayerIDMapUpdater(d)), nil
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive.go b/vendor/github.com/containers/storage/pkg/archive/archive.go
index 9cc717e5a..a90ae1e9e 100644
--- a/vendor/github.com/containers/storage/pkg/archive/archive.go
+++ b/vendor/github.com/containers/storage/pkg/archive/archive.go
@@ -98,6 +98,8 @@ const (
Gzip
// Xz is xz compression algorithm.
Xz
+ // Zstd is zstd compression algorithm.
+ Zstd
)
const (
@@ -141,6 +143,7 @@ func DetectCompression(source []byte) Compression {
Bzip2: {0x42, 0x5A, 0x68},
Gzip: {0x1F, 0x8B, 0x08},
Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00},
+ Zstd: {0x28, 0xb5, 0x2f, 0xfd},
} {
if len(source) < len(m) {
logrus.Debug("Len too short")
@@ -200,6 +203,8 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
<-chdone
return readBufWrapper.Close()
}), nil
+ case Zstd:
+ return zstdReader(buf)
default:
return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension())
}
@@ -217,6 +222,8 @@ func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, er
gzWriter := gzip.NewWriter(dest)
writeBufWrapper := p.NewWriteCloserWrapper(buf, gzWriter)
return writeBufWrapper, nil
+ case Zstd:
+ return zstdWriter(dest)
case Bzip2, Xz:
// archive/bzip2 does not support writing, and there is no xz support at all
// However, this is not a problem as docker only currently generates gzipped tars
@@ -324,6 +331,8 @@ func (compression *Compression) Extension() string {
return "tar.gz"
case Xz:
return "tar.xz"
+ case Zstd:
+ return "tar.zst"
}
return ""
}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive_cgo.go b/vendor/github.com/containers/storage/pkg/archive/archive_cgo.go
new file mode 100644
index 000000000..9faea5f01
--- /dev/null
+++ b/vendor/github.com/containers/storage/pkg/archive/archive_cgo.go
@@ -0,0 +1,17 @@
+// +build cgo
+
+package archive
+
+import (
+ "io"
+
+ "github.com/DataDog/zstd"
+)
+
+func zstdReader(buf io.Reader) (io.ReadCloser, error) {
+ return zstd.NewReader(buf), nil
+}
+
+func zstdWriter(dest io.Writer) (io.WriteCloser, error) {
+ return zstd.NewWriter(dest), nil
+}
diff --git a/vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go b/vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go
new file mode 100644
index 000000000..34ad1d2d1
--- /dev/null
+++ b/vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go
@@ -0,0 +1,16 @@
+// +build !cgo
+
+package archive
+
+import (
+ "fmt"
+ "io"
+)
+
+func zstdReader(buf io.Reader) (io.ReadCloser, error) {
+ return nil, fmt.Errorf("zstd not supported on this platform")
+}
+
+func zstdWriter(dest io.Writer) (io.WriteCloser, error) {
+ return nil, fmt.Errorf("zstd not supported on this platform")
+}
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
index d70848dc5..acfcef022 100644
--- a/vendor/github.com/containers/storage/store.go
+++ b/vendor/github.com/containers/storage/store.go
@@ -722,6 +722,7 @@ func (s *store) getGraphDriver() (drivers.Driver, error) {
}
config := drivers.Options{
Root: s.graphRoot,
+ RunRoot: s.runRoot,
DriverOptions: s.graphOptions,
UIDMaps: s.uidMap,
GIDMaps: s.gidMap,
diff --git a/vendor/github.com/containers/storage/vendor.conf b/vendor/github.com/containers/storage/vendor.conf
index 62a3f98ca..1677363d0 100644
--- a/vendor/github.com/containers/storage/vendor.conf
+++ b/vendor/github.com/containers/storage/vendor.conf
@@ -26,3 +26,4 @@ golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6
golang.org/x/sys 07c182904dbd53199946ba614a412c61d3c548f5
gotest.tools master
github.com/google/go-cmp master
+github.com/DataDog/zstd 1.x