summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-12-11 05:55:51 -0800
committerGitHub <noreply@github.com>2018-12-11 05:55:51 -0800
commit132fc26929961d472073455d0a1355661801dc52 (patch)
treeedffbef95797cdd0aa2dca22a7c79ceb929c0ccf
parentcb1a901f2698c5d388c7896c3eacaddd9954966a (diff)
parenta044e3aa239fdc06edad3dfc65c25c13b54117d0 (diff)
downloadpodman-132fc26929961d472073455d0a1355661801dc52.tar.gz
podman-132fc26929961d472073455d0a1355661801dc52.tar.bz2
podman-132fc26929961d472073455d0a1355661801dc52.zip
Merge pull request #1966 from mheon/ensure_storage_opts_init
Ensure storage options are properly initialized
-rw-r--r--libpod/options.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 352e6a506..9aa657ddd 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -29,9 +29,12 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
return ErrRuntimeFinalized
}
+ setField := false
+
if config.RunRoot != "" {
rt.config.StorageConfig.RunRoot = config.RunRoot
rt.configuredFrom.storageRunRootSet = true
+ setField = true
}
if config.GraphRoot != "" {
@@ -42,16 +45,20 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
// of the c/storage store by default
rt.config.StaticDir = filepath.Join(config.GraphRoot, "libpod")
rt.configuredFrom.libpodStaticDirSet = true
+
+ setField = true
}
if config.GraphDriverName != "" {
rt.config.StorageConfig.GraphDriverName = config.GraphDriverName
rt.configuredFrom.storageGraphDriverSet = true
+ setField = true
}
if config.GraphDriverOptions != nil {
rt.config.StorageConfig.GraphDriverOptions = make([]string, len(config.GraphDriverOptions))
copy(rt.config.StorageConfig.GraphDriverOptions, config.GraphDriverOptions)
+ setField = true
}
if config.UIDMap != nil {
@@ -64,6 +71,18 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
copy(rt.config.StorageConfig.GIDMap, config.GIDMap)
}
+ // If any one of runroot, graphroot, graphdrivername,
+ // or graphdriveroptions are set, then GraphRoot and RunRoot
+ // must be set
+ if setField {
+ if rt.config.StorageConfig.GraphRoot == "" {
+ rt.config.StorageConfig.GraphRoot = storage.DefaultStoreOptions.GraphRoot
+ }
+ if rt.config.StorageConfig.RunRoot == "" {
+ rt.config.StorageConfig.RunRoot = storage.DefaultStoreOptions.RunRoot
+ }
+ }
+
return nil
}
}