mirror of
https://github.com/containers/podman.git
synced 2025-12-02 19:28:58 +08:00
Merge pull request #2078 from rhatdan/config.file
Add the configuration file used to setup storage to podman info
This commit is contained in:
@@ -61,6 +61,7 @@ registries:
|
||||
- docker.io
|
||||
- registry.access.redhat.com
|
||||
store:
|
||||
ConfigFile: /etc/containers/storage.conf
|
||||
ContainerStore:
|
||||
number: 37
|
||||
GraphDriverName: overlay
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
5
vendor/github.com/containers/storage/store.go
generated
vendored
5
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user