Skip to content

Commit

Permalink
configuration: new option skip_mount_home
Browse files Browse the repository at this point in the history
It is needed to use an OSTree repository (either directly or as a parent
repository) that is not under the storage home directory.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 22, 2018
1 parent a45772a commit ec3d1cb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/containers-storage.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ Specifies the maximum number of retries XFS should attempt to complete IO when E
**ostree_repo=""**
Tell storage drivers to use the specified OSTree repository. Some storage drivers, such as overlay, might use

**skip_mount_home=""**
Tell storage drivers to not create a PRIVATE bind mount on their home directory.

# HISTORY
May 2017, Originally compiled by Dan Walsh <[email protected]>
Format copied from crio.conf man page created by Aleksa Sarai <[email protected]>
13 changes: 11 additions & 2 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type overlayOptions struct {
imageStores []string
quota quota.Quota
ostreeRepo string
skipMountHome bool
}

// Driver contains information about the home directory and the list of active mounts that are created using this driver.
Expand Down Expand Up @@ -157,8 +158,10 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, errors.Wrap(err, "kernel does not support overlay fs")
}

if err := mount.MakePrivate(home); err != nil {
return nil, err
if !opts.skipMountHome {
if err := mount.MakePrivate(home); err != nil {
return nil, err
}
}

if opts.ostreeRepo != "" {
Expand Down Expand Up @@ -243,6 +246,12 @@ func parseOptions(options []string) (*overlayOptions, error) {
return nil, fmt.Errorf("overlay: ostree_repo specified but support for ostree is missing")
}
o.ostreeRepo = val
case "overlay2.skip_mount_home", "overlay.skip_mount_home", ".skip_mount_home":
logrus.Debugf("overlay: skip_mount_home=%s", val)
o.skipMountHome, err = strconv.ParseBool(val)
if err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("overlay: Unknown option %s", key)
}
Expand Down
4 changes: 4 additions & 0 deletions storage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,7 @@ override_kernel_check = "false"

# If specified, use OSTree to deduplicate files with the overlay backend
ostree_repo = ""

# Set to skip a PRIVATE bind mount on the storage home directory. Only supported by
# certain container storage drivers
skip_mount_home = "false"
6 changes: 6 additions & 0 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2989,6 +2989,9 @@ type OptionsConfig struct {
Thinpool struct{ ThinpoolOptionsConfig } `toml:"thinpool"`
// OSTree repository
OstreeRepo string `toml:"ostree_repo"`

// Do not create a bind mount on the storage home
SkipMountHome string `toml:"skip_mount_home"`
}

// TOML-friendly explicit tables used for conversions.
Expand Down Expand Up @@ -3082,6 +3085,9 @@ func init() {
if config.Storage.Options.OstreeRepo != "" {
DefaultStoreOptions.GraphDriverOptions = append(DefaultStoreOptions.GraphDriverOptions, fmt.Sprintf("%s.ostree_repo=%s", config.Storage.Driver, config.Storage.Options.OstreeRepo))
}
if config.Storage.Options.SkipMountHome != "" {
DefaultStoreOptions.GraphDriverOptions = append(DefaultStoreOptions.GraphDriverOptions, fmt.Sprintf("%s.skip_mount_home=%s", config.Storage.Driver, config.Storage.Options.SkipMountHome))
}
if config.Storage.Options.OverrideKernelCheck != "" {
DefaultStoreOptions.GraphDriverOptions = append(DefaultStoreOptions.GraphDriverOptions, fmt.Sprintf("%s.override_kernel_check=%s", config.Storage.Driver, config.Storage.Options.OverrideKernelCheck))
}
Expand Down

0 comments on commit ec3d1cb

Please sign in to comment.