aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-02-21 09:24:34 -0500
committerMatthew Heon <matthew.heon@pm.me>2019-02-26 09:37:00 -0500
commitda70c9db6fb92c69d722d51873840c4e54dbe86d (patch)
tree7749b59ef1ffe84dfc281b267d17fef522677012 /libpod
parent8a5e1038766b34f8cb4fbe53829ebb0dc8c0ca0a (diff)
downloadpodman-da70c9db6fb92c69d722d51873840c4e54dbe86d.tar.gz
podman-da70c9db6fb92c69d722d51873840c4e54dbe86d.tar.bz2
podman-da70c9db6fb92c69d722d51873840c4e54dbe86d.zip
When location of c/storage root changes, set VolumePath
We want named volumes to be created in a subdirectory of the c/storage graph root, the same as the libpod root directory is now. As such, we need to adjust its location when the graph root changes location. Also, make a change to how we set the default. There's no need to explicitly set it every time we initialize via an option - that might conflict with WithStorageConfig setting it based on graph root changes. Instead, just initialize it in the default config like our other settings. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/options.go4
-rw-r--r--libpod/runtime.go6
2 files changed, 9 insertions, 1 deletions
diff --git a/libpod/options.go b/libpod/options.go
index e22c81f91..675ebffda 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -47,6 +47,10 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
rt.config.StaticDir = filepath.Join(config.GraphRoot, "libpod")
rt.configuredFrom.libpodStaticDirSet = true
+ // Also set libpod volume path, so we are a subdirectory
+ // of the c/storage store by default
+ rt.config.VolumePath = filepath.Join(config.GraphRoot, "volumes")
+
setField = true
}
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 52f4523ba..762cea32f 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -123,7 +123,10 @@ type RuntimeConfig struct {
// Not included in on-disk config, use the dedicated containers/storage
// configuration file instead
StorageConfig storage.StoreOptions `toml:"-"`
- VolumePath string `toml:"volume_path"`
+ // VolumePath is the default location that named volumes will be created
+ // under. This convention is followed by the default volume driver, but
+ // may not be by other drivers.
+ VolumePath string `toml:"volume_path"`
// ImageDefaultTransport is the default transport method used to fetch
// images
ImageDefaultTransport string `toml:"image_default_transport"`
@@ -238,6 +241,7 @@ var (
defaultRuntimeConfig = RuntimeConfig{
// Leave this empty so containers/storage will use its defaults
StorageConfig: storage.StoreOptions{},
+ VolumePath: filepath.Join(storage.DefaultStoreOptions.GraphRoot, "volumes"),
ImageDefaultTransport: DefaultTransport,
StateType: BoltDBStateStore,
OCIRuntime: "runc",