From 2c38720f644f7c03b1553bd8dd91a5ed4a44d0eb Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 8 Nov 2017 15:11:10 -0500 Subject: [PATCH] overlay, vfs: Accept options without the driver name prefix In the overlay and vfs drivers, accept option names which we'd recognize, if they had the driver name as a prefix, as aliases for their proper names. Signed-off-by: Nalin Dahyabhai --- drivers/overlay/overlay.go | 6 +++--- drivers/vfs/driver.go | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/overlay/overlay.go b/drivers/overlay/overlay.go index ae601f4314..d224406e75 100644 --- a/drivers/overlay/overlay.go +++ b/drivers/overlay/overlay.go @@ -227,20 +227,20 @@ func parseOptions(options []string) (*overlayOptions, error) { } key = strings.ToLower(key) switch key { - case "overlay.override_kernel_check", "overlay2.override_kernel_check": + case ".override_kernel_check", "overlay.override_kernel_check", "overlay2.override_kernel_check": logrus.Debugf("overlay: override_kernelcheck=%s", val) o.overrideKernelCheck, err = strconv.ParseBool(val) if err != nil { return nil, err } - case "overlay.size", "overlay2.size": + case ".size", "overlay.size", "overlay2.size": logrus.Debugf("overlay: size=%s", val) size, err := units.RAMInBytes(val) if err != nil { return nil, err } o.quota.Size = uint64(size) - case "overlay.imagestore", "overlay2.imagestore": + case ".imagestore", "overlay.imagestore", "overlay2.imagestore": logrus.Debugf("overlay: imagestore=%s", val) // Additional read only image stores to use for lower paths for _, store := range strings.Split(val, ",") { diff --git a/drivers/vfs/driver.go b/drivers/vfs/driver.go index cf8eca9143..ae62207d17 100644 --- a/drivers/vfs/driver.go +++ b/drivers/vfs/driver.go @@ -36,6 +36,11 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap for _, option := range options { if strings.HasPrefix(option, "vfs.imagestore=") { d.homes = append(d.homes, strings.Split(option[15:], ",")...) + continue + } + if strings.HasPrefix(option, ".imagestore=") { + d.homes = append(d.homes, strings.Split(option[12:], ",")...) + continue } } return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil