diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-27 14:25:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 14:25:16 +0100 |
commit | 70d3cc2e73caf64fc978c1349da45c9a5551b210 (patch) | |
tree | a635aca13ac0e3aa95a784ae21b2ce37f19acd10 /pkg/util | |
parent | f7f266e3618c6e4a9aa2c2c8c29ea40cf7087b0c (diff) | |
parent | f68a243f8ee4d36990a50fa490dc427520dc8a14 (diff) | |
download | podman-70d3cc2e73caf64fc978c1349da45c9a5551b210.tar.gz podman-70d3cc2e73caf64fc978c1349da45c9a5551b210.tar.bz2 podman-70d3cc2e73caf64fc978c1349da45c9a5551b210.zip |
Merge pull request #2454 from mheon/all_your_defaults_belong_to_libpod
Move all storage configuration defaults into libpod
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/utils.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go index db8a3d5bb..a4576191b 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -259,15 +259,6 @@ func GetRootlessStorageOpts() (storage.StoreOptions, error) { return opts, nil } -// GetRootlessVolumePath returns where all the name volumes will be created in rootless mode -func GetRootlessVolumePath() (string, error) { - dataDir, _, err := GetRootlessDirInfo() - if err != nil { - return "", err - } - return filepath.Join(dataDir, "containers", "storage", "volumes"), nil -} - type tomlOptionsConfig struct { MountProgram string `toml:"mount_program"` } @@ -297,25 +288,18 @@ func getTomlStorage(storeOptions *storage.StoreOptions) *tomlConfig { return config } -// GetDefaultStoreOptions returns the storage ops for containers and the volume path -// for the volume API -// It also returns the path where all named volumes will be created using the volume API -func GetDefaultStoreOptions() (storage.StoreOptions, string, error) { +// GetDefaultStoreOptions returns the default storage ops for containers +func GetDefaultStoreOptions() (storage.StoreOptions, error) { var ( defaultRootlessRunRoot string defaultRootlessGraphRoot string err error ) storageOpts := storage.DefaultStoreOptions - volumePath := filepath.Join(storageOpts.GraphRoot, "volumes") if rootless.IsRootless() { storageOpts, err = GetRootlessStorageOpts() if err != nil { - return storageOpts, volumePath, err - } - volumePath, err = GetRootlessVolumePath() - if err != nil { - return storageOpts, volumePath, err + return storageOpts, err } } @@ -332,7 +316,7 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) { os.MkdirAll(filepath.Dir(storageConf), 0755) file, err := os.OpenFile(storageConf, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) if err != nil { - return storageOpts, volumePath, errors.Wrapf(err, "cannot open %s", storageConf) + return storageOpts, errors.Wrapf(err, "cannot open %s", storageConf) } tomlConfiguration := getTomlStorage(&storageOpts) @@ -353,7 +337,7 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) { } } } - return storageOpts, volumePath, nil + return storageOpts, nil } // StorageConfigFile returns the path to the storage config file used |