mirror of
https://github.com/containers/skopeo.git
synced 2025-09-17 15:30:38 +00:00
Vendor after merging mtrmac/image:docker-certs.d
This commit is contained in:
6
vendor/github.com/containers/storage/drivers/aufs/aufs.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/aufs/aufs.go
generated
vendored
@@ -372,6 +372,12 @@ func (a *Driver) Diff(id, parent string) (archive.Archive, error) {
|
||||
})
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (a *Driver) AdditionalImageStores() []string {
|
||||
var imageStores []string
|
||||
return imageStores
|
||||
}
|
||||
|
||||
type fileGetNilCloser struct {
|
||||
storage.FileGetter
|
||||
}
|
||||
|
6
vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/btrfs/btrfs.go
generated
vendored
@@ -518,3 +518,9 @@ func (d *Driver) Exists(id string) bool {
|
||||
_, err := os.Stat(dir)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (d *Driver) AdditionalImageStores() []string {
|
||||
var imageStores []string
|
||||
return imageStores
|
||||
}
|
||||
|
6
vendor/github.com/containers/storage/drivers/devmapper/driver.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/devmapper/driver.go
generated
vendored
@@ -224,3 +224,9 @@ func (d *Driver) Put(id string) error {
|
||||
func (d *Driver) Exists(id string) bool {
|
||||
return d.DeviceSet.HasDevice(id)
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (d *Driver) AdditionalImageStores() []string {
|
||||
var imageStores []string
|
||||
return imageStores
|
||||
}
|
||||
|
2
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
2
vendor/github.com/containers/storage/drivers/driver.go
generated
vendored
@@ -74,6 +74,8 @@ type ProtoDriver interface {
|
||||
// held by the driver, e.g., unmounting all layered filesystems
|
||||
// known to this driver.
|
||||
Cleanup() error
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
AdditionalImageStores() []string
|
||||
}
|
||||
|
||||
// Driver is the interface for layered/snapshot file system drivers.
|
||||
|
25
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
25
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
@@ -82,6 +83,7 @@ type Driver struct {
|
||||
uidMaps []idtools.IDMap
|
||||
gidMaps []idtools.IDMap
|
||||
ctr *graphdriver.RefCounter
|
||||
opts *overlayOptions
|
||||
}
|
||||
|
||||
var backingFs = "<unknown>"
|
||||
@@ -149,6 +151,7 @@ func InitWithName(name, home string, options []string, uidMaps, gidMaps []idtool
|
||||
uidMaps: uidMaps,
|
||||
gidMaps: gidMaps,
|
||||
ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
|
||||
opts: opts,
|
||||
}
|
||||
|
||||
return d, nil
|
||||
@@ -170,6 +173,7 @@ func InitAsOverlay2(home string, options []string, uidMaps, gidMaps []idtools.ID
|
||||
|
||||
type overlayOptions struct {
|
||||
overrideKernelCheck bool
|
||||
imageStores []string
|
||||
}
|
||||
|
||||
func parseOptions(options []string) (*overlayOptions, error) {
|
||||
@@ -186,6 +190,22 @@ func parseOptions(options []string) (*overlayOptions, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "overlay.imagestore":
|
||||
// Additional read only image stores to use for lower paths
|
||||
for _, store := range strings.Split(val, ",") {
|
||||
store = filepath.Clean(store)
|
||||
if !filepath.IsAbs(store) {
|
||||
return nil, fmt.Errorf("overlay: image path %q is not absolute. Can not be relative", store)
|
||||
}
|
||||
st, err := os.Stat(store)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("overlay: Can't stat imageStore dir %s: %v", store, err)
|
||||
}
|
||||
if !st.IsDir() {
|
||||
return nil, fmt.Errorf("overlay: image path %q must be a directory", store)
|
||||
}
|
||||
o.imageStores = append(o.imageStores, store)
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("overlay: Unknown option %s", key)
|
||||
}
|
||||
@@ -527,3 +547,8 @@ func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
||||
|
||||
return archive.OverlayChanges(layers, diffPath)
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (d *Driver) AdditionalImageStores() []string {
|
||||
return d.opts.imageStores
|
||||
}
|
||||
|
6
vendor/github.com/containers/storage/drivers/vfs/driver.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/vfs/driver.go
generated
vendored
@@ -143,3 +143,9 @@ func (d *Driver) Exists(id string) bool {
|
||||
_, err := os.Stat(d.dir(id))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (d *Driver) AdditionalImageStores() []string {
|
||||
var imageStores []string
|
||||
return imageStores
|
||||
}
|
||||
|
6
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
6
vendor/github.com/containers/storage/drivers/zfs/zfs.go
generated
vendored
@@ -403,3 +403,9 @@ func (d *Driver) Exists(id string) bool {
|
||||
defer d.Unlock()
|
||||
return d.filesystemsCache[d.zfsPath(id)] == true
|
||||
}
|
||||
|
||||
// AdditionalImageStores returns additional image stores supported by the driver
|
||||
func (d *Driver) AdditionalImageStores() []string {
|
||||
var imageStores []string
|
||||
return imageStores
|
||||
}
|
||||
|
288
vendor/github.com/containers/storage/store.go
generated
vendored
288
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
// register all of the built-in drivers
|
||||
_ "github.com/containers/storage/drivers/register"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
drivers "github.com/containers/storage/drivers"
|
||||
"github.com/containers/storage/pkg/archive"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
@@ -613,10 +615,6 @@ func (s *store) PutLayer(id, parent string, names []string, mountLabel string, w
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
@@ -628,12 +626,6 @@ func (s *store) PutLayer(id, parent string, names []string, mountLabel string, w
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
defer ristore.Touch()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
defer rcstore.Touch()
|
||||
@@ -676,11 +668,6 @@ func (s *store) CreateImage(id string, names []string, layer, metadata string, o
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
@@ -692,12 +679,6 @@ func (s *store) CreateImage(id string, names []string, layer, metadata string, o
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
defer rcstore.Touch()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
rcstore.Load()
|
||||
}
|
||||
if id == "" {
|
||||
id = stringid.GenerateRandomID()
|
||||
}
|
||||
@@ -862,20 +843,10 @@ func (s *store) Metadata(id string) (string, error) {
|
||||
}
|
||||
|
||||
func (s *store) ListImageBigData(id string) ([]string, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
@@ -886,20 +857,10 @@ func (s *store) ListImageBigData(id string) ([]string, error) {
|
||||
}
|
||||
|
||||
func (s *store) ImageBigDataSize(id, key string) (int64, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
@@ -910,20 +871,10 @@ func (s *store) ImageBigDataSize(id, key string) (int64, error) {
|
||||
}
|
||||
|
||||
func (s *store) ImageBigData(id, key string) ([]byte, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
@@ -958,29 +909,11 @@ func (s *store) SetImageBigData(id, key string, data []byte) error {
|
||||
}
|
||||
|
||||
func (s *store) ListContainerBigData(id string) ([]string, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -991,29 +924,10 @@ func (s *store) ListContainerBigData(id string) ([]string, error) {
|
||||
}
|
||||
|
||||
func (s *store) ContainerBigDataSize(id, key string) (int64, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1024,29 +938,10 @@ func (s *store) ContainerBigDataSize(id, key string) (int64, error) {
|
||||
}
|
||||
|
||||
func (s *store) ContainerBigData(id, key string) ([]byte, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1057,29 +952,10 @@ func (s *store) ContainerBigData(id, key string) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (s *store) SetContainerBigData(id, key string, data []byte) error {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1765,20 +1641,10 @@ func (s *store) Layers() ([]Layer, error) {
|
||||
}
|
||||
|
||||
func (s *store) Images() ([]Image, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
@@ -1789,29 +1655,11 @@ func (s *store) Images() ([]Image, error) {
|
||||
}
|
||||
|
||||
func (s *store) Containers() ([]Container, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1841,16 +1689,6 @@ func (s *store) Image(id string) (*Image, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
@@ -1900,29 +1738,10 @@ func (s *store) ImagesByTopLayer(id string) ([]*Image, error) {
|
||||
}
|
||||
|
||||
func (s *store) Container(id string) (*Container, error) {
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1933,10 +1752,6 @@ func (s *store) Container(id string) (*Container, error) {
|
||||
}
|
||||
|
||||
func (s *store) ContainerByLayer(id string) (*Container, error) {
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1951,11 +1766,6 @@ func (s *store) ContainerByLayer(id string) (*Container, error) {
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -1980,29 +1790,10 @@ func (s *store) ContainerByLayer(id string) (*Container, error) {
|
||||
}
|
||||
|
||||
func (s *store) ContainerDirectory(id string) (string, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -2023,29 +1814,11 @@ func (s *store) ContainerDirectory(id string) (string, error) {
|
||||
}
|
||||
|
||||
func (s *store) ContainerRunDirectory(id string) (string, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ristore, err := s.ImageStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
rcstore, err := s.ContainerStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
rlstore.Load()
|
||||
}
|
||||
ristore.Lock()
|
||||
defer ristore.Unlock()
|
||||
if modified, err := ristore.Modified(); modified || err != nil {
|
||||
ristore.Load()
|
||||
}
|
||||
rcstore.Lock()
|
||||
defer rcstore.Unlock()
|
||||
if modified, err := rcstore.Modified(); modified || err != nil {
|
||||
@@ -2187,11 +1960,64 @@ func stringSliceWithoutValue(slice []string, value string) []string {
|
||||
return modified
|
||||
}
|
||||
|
||||
const configFile = "/etc/containers/storage.conf"
|
||||
|
||||
// OptionsConfig represents the "storage.options" TOML config table.
|
||||
type OptionsConfig struct {
|
||||
// AdditionalImagesStores is the location of additional read/only
|
||||
// Image stores. Usually used to access Networked File System
|
||||
// for shared image content
|
||||
AdditionalImageStores []string `toml:"additionalimagestores"`
|
||||
}
|
||||
|
||||
// TOML-friendly explicit tables used for conversions.
|
||||
type tomlConfig struct {
|
||||
Storage struct {
|
||||
Driver string `toml:"driver"`
|
||||
RunRoot string `toml:"runroot"`
|
||||
GraphRoot string `toml:"graphroot"`
|
||||
Options struct{ OptionsConfig } `toml:"options"`
|
||||
} `toml:"storage"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
DefaultStoreOptions.RunRoot = "/var/run/containers/storage"
|
||||
DefaultStoreOptions.GraphRoot = "/var/lib/containers/storage"
|
||||
DefaultStoreOptions.GraphDriverName = os.Getenv("STORAGE_DRIVER")
|
||||
DefaultStoreOptions.GraphDriverOptions = strings.Split(os.Getenv("STORAGE_OPTS"), ",")
|
||||
DefaultStoreOptions.GraphDriverName = "overlay"
|
||||
|
||||
data, err := ioutil.ReadFile(configFile)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
fmt.Printf("Failed to read %s %v\n", configFile, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
config := new(tomlConfig)
|
||||
|
||||
if _, err := toml.Decode(string(data), config); err != nil {
|
||||
fmt.Printf("Failed to parse %s %v\n", configFile, err.Error())
|
||||
return
|
||||
}
|
||||
if config.Storage.Driver != "" {
|
||||
DefaultStoreOptions.GraphDriverName = config.Storage.Driver
|
||||
}
|
||||
if config.Storage.RunRoot != "" {
|
||||
DefaultStoreOptions.RunRoot = config.Storage.RunRoot
|
||||
}
|
||||
if config.Storage.GraphRoot != "" {
|
||||
DefaultStoreOptions.GraphRoot = config.Storage.GraphRoot
|
||||
}
|
||||
for _, s := range config.Storage.Options.AdditionalImageStores {
|
||||
DefaultStoreOptions.GraphDriverOptions = append(DefaultStoreOptions.GraphDriverOptions, fmt.Sprintf("%s.imagestore=%s", config.Storage.Driver, s))
|
||||
}
|
||||
|
||||
if os.Getenv("STORAGE_DRIVER") != "" {
|
||||
DefaultStoreOptions.GraphDriverName = os.Getenv("STORAGE_DRIVER")
|
||||
}
|
||||
if os.Getenv("STORAGE_OPTS") != "" {
|
||||
DefaultStoreOptions.GraphDriverOptions = append(DefaultStoreOptions.GraphDriverOptions, strings.Split(os.Getenv("STORAGE_OPTS"), ",")...)
|
||||
}
|
||||
if len(DefaultStoreOptions.GraphDriverOptions) == 1 && DefaultStoreOptions.GraphDriverOptions[0] == "" {
|
||||
DefaultStoreOptions.GraphDriverOptions = nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user