diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-28 07:19:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-28 07:19:34 -0700 |
commit | ef1b58e6f28d21959196d29d5e9ab065d4e9a818 (patch) | |
tree | 691ecc024dfedff5695e426a8f3a6c077cfc34b8 /libpod/runtime.go | |
parent | e7a2eecf5f3975edfb92cd2cacff0d34ef45f808 (diff) | |
parent | a5443a532b0fc6bd787cbb472c0ad2f75447c9df (diff) | |
download | podman-ef1b58e6f28d21959196d29d5e9ab065d4e9a818.tar.gz podman-ef1b58e6f28d21959196d29d5e9ab065d4e9a818.tar.bz2 podman-ef1b58e6f28d21959196d29d5e9ab065d4e9a818.zip |
Merge pull request #2789 from vrothberg/vendor
vendor buildah, image, storage, cni
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index a4fc9e493..f7b166513 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -248,11 +248,16 @@ type runtimeConfiguredFrom struct { noPivotRoot bool } -var ( - defaultRuntimeConfig = RuntimeConfig{ +func defaultRuntimeConfig() (RuntimeConfig, error) { + storeOpts, err := storage.DefaultStoreOptions(rootless.IsRootless(), rootless.GetRootlessUID()) + if err != nil { + return RuntimeConfig{}, err + } + + return RuntimeConfig{ // Leave this empty so containers/storage will use its defaults StorageConfig: storage.StoreOptions{}, - VolumePath: filepath.Join(storage.DefaultStoreOptions.GraphRoot, "volumes"), + VolumePath: filepath.Join(storeOpts.GraphRoot, "volumes"), ImageDefaultTransport: DefaultTransport, StateType: BoltDBStateStore, OCIRuntime: "runc", @@ -281,7 +286,7 @@ var ( }, InitPath: DefaultInitPath, CgroupManager: SystemdCgroupsManager, - StaticDir: filepath.Join(storage.DefaultStoreOptions.GraphRoot, "libpod"), + StaticDir: filepath.Join(storeOpts.GraphRoot, "libpod"), TmpDir: "", MaxLogSize: -1, NoPivotRoot: false, @@ -292,8 +297,8 @@ var ( EnablePortReservation: true, EnableLabeling: true, NumLocks: 2048, - } -) + }, nil +} func getDefaultTmpDir() (string, error) { if !rootless.IsRootless() { @@ -354,12 +359,17 @@ func newRuntimeFromConfig(userConfigPath string, options ...RuntimeOption) (runt if err != nil { return nil, err } - if err := JSONDeepCopy(defaultRuntimeConfig, runtime.config); err != nil { + + defRunConf, err := defaultRuntimeConfig() + if err != nil { + return nil, err + } + if err := JSONDeepCopy(defRunConf, runtime.config); err != nil { return nil, errors.Wrapf(err, "error copying runtime default config") } runtime.config.TmpDir = tmpDir - storageConf, err := util.GetDefaultStoreOptions() + storageConf, err := storage.DefaultStoreOptions(rootless.IsRootless(), rootless.GetRootlessUID()) if err != nil { return nil, errors.Wrapf(err, "error retrieving storage config") } @@ -508,7 +518,10 @@ func newRuntimeFromConfig(userConfigPath string, options ...RuntimeOption) (runt } if rootlessConfigPath != "" { // storage.conf - storageConfFile := util.StorageConfigFile() + storageConfFile, err := storage.DefaultConfigFile(rootless.IsRootless()) + if err != nil { + return nil, err + } if _, err := os.Stat(storageConfFile); os.IsNotExist(err) { if err := util.WriteStorageConfigFile(&runtime.config.StorageConfig, storageConfFile); err != nil { return nil, errors.Wrapf(err, "cannot write config file %s", storageConfFile) |