summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-12-02 15:21:35 -0500
committerMatthew Heon <mheon@redhat.com>2018-12-02 15:21:35 -0500
commit562fa57dc9f497db772baa03bfa052082db68646 (patch)
tree47016e6dd700b37a896732ac83b6a6b9ad849b2d /libpod/options.go
parent92ff83f5b9dd00ff91dc8c3d6b48f1e0b5c5f3e2 (diff)
downloadpodman-562fa57dc9f497db772baa03bfa052082db68646.tar.gz
podman-562fa57dc9f497db772baa03bfa052082db68646.tar.bz2
podman-562fa57dc9f497db772baa03bfa052082db68646.zip
Move rootless storage config into libpod
Previous commits ensured that we would use database-configured paths if not explicitly overridden. However, our runtime generation did unconditionally override storage config, which made this useless. Move rootless storage configuration setup to libpod, and change storage setup so we only override if a setting is explicitly set, so we can still override what we want. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 6783e2a39..661bd8d91 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -29,18 +29,18 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
return ErrRuntimeFinalized
}
- rt.config.StorageConfig.RunRoot = config.RunRoot
if config.RunRoot != "" {
+ rt.config.StorageConfig.RunRoot = config.RunRoot
rt.configuredFrom.storageRunRootSet = true
}
- rt.config.StorageConfig.GraphRoot = config.GraphRoot
if config.GraphRoot != "" {
+ rt.config.StorageConfig.GraphRoot = config.GraphRoot
rt.configuredFrom.storageGraphRootSet = true
}
- rt.config.StorageConfig.GraphDriverName = config.GraphDriverName
if config.GraphDriverName != "" {
+ rt.config.StorageConfig.GraphDriverName = config.GraphDriverName
rt.configuredFrom.storageGraphDriverSet = true
}
@@ -51,14 +51,20 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
rt.configuredFrom.libpodStaticDirSet = true
}
- rt.config.StorageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
- copy(rt.config.StorageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ if config.GraphDriverOptions != nil {
+ rt.config.StorageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
+ copy(rt.config.StorageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ }
- rt.config.StorageConfig.UIDMap = make([]idtools.IDMap, len(config.UIDMap))
- copy(rt.config.StorageConfig.UIDMap, config.UIDMap)
+ if config.UIDMap != nil {
+ rt.config.StorageConfig.UIDMap = make([]idtools.IDMap, len(config.UIDMap))
+ copy(rt.config.StorageConfig.UIDMap, config.UIDMap)
+ }
- rt.config.StorageConfig.GIDMap = make([]idtools.IDMap, len(config.GIDMap))
- copy(rt.config.StorageConfig.GIDMap, config.GIDMap)
+ if config.GIDMap != nil {
+ rt.config.StorageConfig.GIDMap = make([]idtools.IDMap, len(config.GIDMap))
+ copy(rt.config.StorageConfig.GIDMap, config.GIDMap)
+ }
return nil
}