summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-01-07 10:01:44 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-01-07 10:02:26 -0500
commitb367855d5f87bffc980cbce28b35363a4e21ba7c (patch)
tree3d0c1427903b2b4f2a3afa1fcb418b03d749cc48
parenta219431a317a2b6d9647ce81b7c845345e51b7da (diff)
downloadpodman-b367855d5f87bffc980cbce28b35363a4e21ba7c.tar.gz
podman-b367855d5f87bffc980cbce28b35363a4e21ba7c.tar.bz2
podman-b367855d5f87bffc980cbce28b35363a4e21ba7c.zip
Add the configuration file used to setup storage to podman info
Users have no idea what storage configuration file is used to setup storage, so adding this to podman info, should make it easier to discover. This requires a revendor of containers/storage Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--docs/podman-info.1.md1
-rw-r--r--libpod/info.go2
-rw-r--r--pkg/util/utils.go10
-rw-r--r--vendor/github.com/containers/storage/store.go5
4 files changed, 15 insertions, 3 deletions
diff --git a/docs/podman-info.1.md b/docs/podman-info.1.md
index 478f79467..836a2c420 100644
--- a/docs/podman-info.1.md
+++ b/docs/podman-info.1.md
@@ -61,6 +61,7 @@ registries:
- docker.io
- registry.access.redhat.com
store:
+ ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 37
GraphDriverName: overlay
diff --git a/libpod/info.go b/libpod/info.go
index 7044eba6a..a98f93897 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -13,6 +13,7 @@ import (
"time"
"github.com/containers/libpod/pkg/rootless"
+ "github.com/containers/libpod/pkg/util"
"github.com/containers/libpod/utils"
"github.com/containers/storage/pkg/system"
"github.com/pkg/errors"
@@ -115,6 +116,7 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
func (r *Runtime) storeInfo() (map[string]interface{}, error) {
// lets say storage driver in use, number of images, number of containers
info := map[string]interface{}{}
+ info["ConfigFile"] = util.StorageConfigFile()
info["GraphRoot"] = r.store.GraphRoot()
info["RunRoot"] = r.store.RunRoot()
info["GraphDriverName"] = r.store.GraphDriverName()
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index a6f52cb3e..20ba20a52 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -314,7 +314,7 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) {
return storageOpts, volumePath, err
}
- storageConf := filepath.Join(os.Getenv("HOME"), ".config/containers/storage.conf")
+ storageConf := StorageConfigFile()
if _, err := os.Stat(storageConf); err == nil {
storage.ReloadConfigurationFile(storageConf, &storageOpts)
} else if os.IsNotExist(err) {
@@ -334,3 +334,11 @@ func GetDefaultStoreOptions() (storage.StoreOptions, string, error) {
}
return storageOpts, volumePath, nil
}
+
+// StorageConfigFile returns the path to the storage config file used
+func StorageConfigFile() string {
+ if rootless.IsRootless() {
+ return filepath.Join(os.Getenv("HOME"), ".config/containers/storage.conf")
+ }
+ return storage.DefaultConfigFile
+}
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
index a166799c6..5877c3b06 100644
--- a/vendor/github.com/containers/storage/store.go
+++ b/vendor/github.com/containers/storage/store.go
@@ -2992,7 +2992,8 @@ func copyStringInterfaceMap(m map[string]interface{}) map[string]interface{} {
return ret
}
-const defaultConfigFile = "/etc/containers/storage.conf"
+// DefaultConfigFile path to the system wide storage.conf file
+const DefaultConfigFile = "/etc/containers/storage.conf"
// ThinpoolOptionsConfig represents the "storage.options.thinpool"
// TOML config table.
@@ -3237,7 +3238,7 @@ func init() {
DefaultStoreOptions.GraphRoot = "/var/lib/containers/storage"
DefaultStoreOptions.GraphDriverName = ""
- ReloadConfigurationFile(defaultConfigFile, &DefaultStoreOptions)
+ ReloadConfigurationFile(DefaultConfigFile, &DefaultStoreOptions)
}
func GetDefaultMountOptions() ([]string, error) {