forked from pool/podman
Accepting request 1058898 from devel:microos
OBS-URL: https://build.opensuse.org/request/show/1058898 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/podman?expand=0&rev=102
This commit is contained in:
commit
9bb26caaf8
264
0002-Make-the-priority-for-picking-the-storage-driver-con.patch
Normal file
264
0002-Make-the-priority-for-picking-the-storage-driver-con.patch
Normal file
@ -0,0 +1,264 @@
|
||||
From 575166520c8f7e9c46b63bc2b47721512613614b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||
Date: Tue, 3 Jan 2023 16:34:25 +0100
|
||||
Subject: [PATCH 1/2] Make the priority for picking the storage driver
|
||||
configurable
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes https://github.com/containers/storage/issues/1457
|
||||
|
||||
Co-authored-by: Valentin Rothberg <vrothberg@redhat.com>
|
||||
Signed-off-by: Dan Čermák <dcermak@suse.com>
|
||||
---
|
||||
.../containers/storage/drivers/driver.go | 18 +++-
|
||||
vendor/github.com/containers/storage/store.go | 89 ++++++++++---------
|
||||
.../containers/storage/types/options.go | 14 ++-
|
||||
3 files changed, 71 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/vendor/github.com/containers/storage/drivers/driver.go b/vendor/github.com/containers/storage/drivers/driver.go
|
||||
index 7d96ebe54..68d1956b8 100644
|
||||
--- a/vendor/github.com/containers/storage/drivers/driver.go
|
||||
+++ b/vendor/github.com/containers/storage/drivers/driver.go
|
||||
@@ -312,6 +312,7 @@ func getBuiltinDriver(name, home string, options Options) (Driver, error) {
|
||||
type Options struct {
|
||||
Root string
|
||||
RunRoot string
|
||||
+ DriverPriority []string
|
||||
DriverOptions []string
|
||||
UIDMaps []idtools.IDMap
|
||||
GIDMaps []idtools.IDMap
|
||||
@@ -327,9 +328,18 @@ func New(name string, config Options) (Driver, error) {
|
||||
|
||||
// Guess for prior driver
|
||||
driversMap := scanPriorDrivers(config.Root)
|
||||
- for _, name := range priority {
|
||||
- if name == "vfs" {
|
||||
- // don't use vfs even if there is state present.
|
||||
+
|
||||
+ // use the supplied priority list unless it is empty
|
||||
+ prioList := config.DriverPriority
|
||||
+ if len(prioList) == 0 {
|
||||
+ prioList = priority
|
||||
+ }
|
||||
+
|
||||
+ for _, name := range prioList {
|
||||
+ if name == "vfs" && len(config.DriverPriority) == 0 {
|
||||
+ // don't use vfs even if there is state present and vfs
|
||||
+ // has not been explicitly added to the override driver
|
||||
+ // priority list
|
||||
continue
|
||||
}
|
||||
if _, prior := driversMap[name]; prior {
|
||||
@@ -362,7 +372,7 @@ func New(name string, config Options) (Driver, error) {
|
||||
}
|
||||
|
||||
// Check for priority drivers first
|
||||
- for _, name := range priority {
|
||||
+ for _, name := range prioList {
|
||||
driver, err := getBuiltinDriver(name, config.Root, config)
|
||||
if err != nil {
|
||||
if isDriverNotSupported(err) {
|
||||
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
|
||||
index fb1faaa13..7dc8df948 100644
|
||||
--- a/vendor/github.com/containers/storage/store.go
|
||||
+++ b/vendor/github.com/containers/storage/store.go
|
||||
@@ -606,29 +606,30 @@ type ContainerOptions struct {
|
||||
}
|
||||
|
||||
type store struct {
|
||||
- lastLoaded time.Time
|
||||
- runRoot string
|
||||
- graphLock Locker
|
||||
- usernsLock Locker
|
||||
- graphRoot string
|
||||
- graphDriverName string
|
||||
- graphOptions []string
|
||||
- pullOptions map[string]string
|
||||
- uidMap []idtools.IDMap
|
||||
- gidMap []idtools.IDMap
|
||||
- autoUsernsUser string
|
||||
- additionalUIDs *idSet // Set by getAvailableIDs()
|
||||
- additionalGIDs *idSet // Set by getAvailableIDs()
|
||||
- autoNsMinSize uint32
|
||||
- autoNsMaxSize uint32
|
||||
- graphDriver drivers.Driver
|
||||
- layerStore LayerStore
|
||||
- roLayerStores []ROLayerStore
|
||||
- imageStore ImageStore
|
||||
- roImageStores []ROImageStore
|
||||
- containerStore ContainerStore
|
||||
- digestLockRoot string
|
||||
- disableVolatile bool
|
||||
+ lastLoaded time.Time
|
||||
+ runRoot string
|
||||
+ graphLock Locker
|
||||
+ usernsLock Locker
|
||||
+ graphRoot string
|
||||
+ graphDriverName string
|
||||
+ graphOptions []string
|
||||
+ graphDriverPriority []string
|
||||
+ pullOptions map[string]string
|
||||
+ uidMap []idtools.IDMap
|
||||
+ gidMap []idtools.IDMap
|
||||
+ autoUsernsUser string
|
||||
+ additionalUIDs *idSet // Set by getAvailableIDs()
|
||||
+ additionalGIDs *idSet // Set by getAvailableIDs()
|
||||
+ autoNsMinSize uint32
|
||||
+ autoNsMaxSize uint32
|
||||
+ graphDriver drivers.Driver
|
||||
+ layerStore LayerStore
|
||||
+ roLayerStores []ROLayerStore
|
||||
+ imageStore ImageStore
|
||||
+ roImageStores []ROImageStore
|
||||
+ containerStore ContainerStore
|
||||
+ digestLockRoot string
|
||||
+ disableVolatile bool
|
||||
}
|
||||
|
||||
// GetStore attempts to find an already-created Store object matching the
|
||||
@@ -724,21 +725,22 @@ func GetStore(options types.StoreOptions) (Store, error) {
|
||||
autoNsMaxSize = AutoUserNsMaxSize
|
||||
}
|
||||
s := &store{
|
||||
- runRoot: options.RunRoot,
|
||||
- graphLock: graphLock,
|
||||
- graphRoot: options.GraphRoot,
|
||||
- graphDriverName: options.GraphDriverName,
|
||||
- graphOptions: options.GraphDriverOptions,
|
||||
- uidMap: copyIDMap(options.UIDMap),
|
||||
- gidMap: copyIDMap(options.GIDMap),
|
||||
- autoUsernsUser: options.RootAutoNsUser,
|
||||
- autoNsMinSize: autoNsMinSize,
|
||||
- autoNsMaxSize: autoNsMaxSize,
|
||||
- additionalUIDs: nil,
|
||||
- additionalGIDs: nil,
|
||||
- usernsLock: usernsLock,
|
||||
- disableVolatile: options.DisableVolatile,
|
||||
- pullOptions: options.PullOptions,
|
||||
+ runRoot: options.RunRoot,
|
||||
+ graphLock: graphLock,
|
||||
+ graphRoot: options.GraphRoot,
|
||||
+ graphDriverName: options.GraphDriverName,
|
||||
+ graphDriverPriority: options.GraphDriverPriority,
|
||||
+ graphOptions: options.GraphDriverOptions,
|
||||
+ uidMap: copyIDMap(options.UIDMap),
|
||||
+ gidMap: copyIDMap(options.GIDMap),
|
||||
+ autoUsernsUser: options.RootAutoNsUser,
|
||||
+ autoNsMinSize: autoNsMinSize,
|
||||
+ autoNsMaxSize: autoNsMaxSize,
|
||||
+ additionalUIDs: nil,
|
||||
+ additionalGIDs: nil,
|
||||
+ usernsLock: usernsLock,
|
||||
+ disableVolatile: options.DisableVolatile,
|
||||
+ pullOptions: options.PullOptions,
|
||||
}
|
||||
if err := s.load(); err != nil {
|
||||
return nil, err
|
||||
@@ -868,11 +870,12 @@ func (s *store) getGraphDriver() (drivers.Driver, error) {
|
||||
return s.graphDriver, nil
|
||||
}
|
||||
config := drivers.Options{
|
||||
- Root: s.graphRoot,
|
||||
- RunRoot: s.runRoot,
|
||||
- DriverOptions: s.graphOptions,
|
||||
- UIDMaps: s.uidMap,
|
||||
- GIDMaps: s.gidMap,
|
||||
+ Root: s.graphRoot,
|
||||
+ RunRoot: s.runRoot,
|
||||
+ DriverOptions: s.graphOptions,
|
||||
+ DriverPriority: s.graphDriverPriority,
|
||||
+ UIDMaps: s.uidMap,
|
||||
+ GIDMaps: s.gidMap,
|
||||
}
|
||||
driver, err := drivers.New(s.graphDriverName, config)
|
||||
if err != nil {
|
||||
diff --git a/vendor/github.com/containers/storage/types/options.go b/vendor/github.com/containers/storage/types/options.go
|
||||
index 4c873b45f..4fbe512a9 100644
|
||||
--- a/vendor/github.com/containers/storage/types/options.go
|
||||
+++ b/vendor/github.com/containers/storage/types/options.go
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
type TomlConfig struct {
|
||||
Storage struct {
|
||||
Driver string `toml:"driver,omitempty"`
|
||||
+ DriverPriority []string `toml:"driver_priority,omitempty"`
|
||||
RunRoot string `toml:"runroot,omitempty"`
|
||||
GraphRoot string `toml:"graphroot,omitempty"`
|
||||
RootlessStoragePath string `toml:"rootless_storage_path,omitempty"`
|
||||
@@ -189,10 +190,16 @@ type StoreOptions struct {
|
||||
// RootlessStoragePath is the storage path for rootless users
|
||||
// default $HOME/.local/share/containers/storage
|
||||
RootlessStoragePath string `toml:"rootless_storage_path"`
|
||||
- // GraphDriverName is the underlying storage driver that we'll be
|
||||
- // using. It only needs to be specified the first time a Store is
|
||||
- // initialized for a given RunRoot and GraphRoot.
|
||||
+ // If the driver is not specified, the best suited driver will be picked
|
||||
+ // either from GraphDriverPriority, if specified, or from the platform
|
||||
+ // dependent priority list (in that order).
|
||||
GraphDriverName string `json:"driver,omitempty"`
|
||||
+ // GraphDriverPriority is a list of storage drivers that will be tried
|
||||
+ // to initialize the Store for a given RunRoot and GraphRoot unless a
|
||||
+ // GraphDriverName is set.
|
||||
+ // This list can be used to define a custom order in which the drivers
|
||||
+ // will be tried.
|
||||
+ GraphDriverPriority []string `json:"driver-priority,omitempty"`
|
||||
// GraphDriverOptions are driver-specific options.
|
||||
GraphDriverOptions []string `json:"driver-options,omitempty"`
|
||||
// UIDMap and GIDMap are used for setting up a container's root filesystem
|
||||
@@ -357,6 +364,7 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) erro
|
||||
if storeOptions.GraphDriverName == "" {
|
||||
logrus.Errorf("The storage 'driver' option must be set in %s to guarantee proper operation", configFile)
|
||||
}
|
||||
+ storeOptions.GraphDriverPriority = config.Storage.DriverPriority
|
||||
if config.Storage.RunRoot != "" {
|
||||
storeOptions.RunRoot = config.Storage.RunRoot
|
||||
}
|
||||
--
|
||||
2.39.0
|
||||
|
||||
|
||||
From de3c3805b23abf90ce1300cf78686411abc57644 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||
Date: Fri, 6 Jan 2023 08:22:57 +0100
|
||||
Subject: [PATCH 2/2] Only warn about 'driver' not being set if the priority
|
||||
list is unset
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently we would display an error when the user does not specify a `driver` in
|
||||
their config file. This has been present for historical reasons mostly to
|
||||
prevent users from accidentally getting the vfs
|
||||
driver (https://github.com/containers/storage/pull/1460#issuecomment-1370866271). Now
|
||||
that most systems support the overlay driver natively, we can reduce this to a
|
||||
warning and only warn about it if the driver_priority list is unset. If it is
|
||||
provided, then clearly the user or the distribution wanted for c/storage to pick
|
||||
a driver itself and the warning would be only confusing to users.
|
||||
|
||||
Signed-off-by: Dan Čermák <dcermak@suse.com>
|
||||
---
|
||||
vendor/github.com/containers/storage/types/options.go | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/vendor/github.com/containers/storage/types/options.go b/vendor/github.com/containers/storage/types/options.go
|
||||
index 4fbe512a9..e87f458cc 100644
|
||||
--- a/vendor/github.com/containers/storage/types/options.go
|
||||
+++ b/vendor/github.com/containers/storage/types/options.go
|
||||
@@ -361,10 +361,10 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) erro
|
||||
logrus.Warnf("Switching default driver from overlay2 to the equivalent overlay driver")
|
||||
storeOptions.GraphDriverName = overlayDriver
|
||||
}
|
||||
- if storeOptions.GraphDriverName == "" {
|
||||
- logrus.Errorf("The storage 'driver' option must be set in %s to guarantee proper operation", configFile)
|
||||
- }
|
||||
storeOptions.GraphDriverPriority = config.Storage.DriverPriority
|
||||
+ if storeOptions.GraphDriverName == "" && len(storeOptions.GraphDriverPriority) == 0 {
|
||||
+ logrus.Warnf("The storage 'driver' option should be set in %s. A driver was picked automatically.", configFile)
|
||||
+ }
|
||||
if config.Storage.RunRoot != "" {
|
||||
storeOptions.RunRoot = config.Storage.RunRoot
|
||||
}
|
||||
--
|
||||
2.39.0
|
||||
|
@ -0,0 +1,44 @@
|
||||
From 3f6a1954ff440959adcc44cc58372ed13ae2dbb3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||
Date: Fri, 13 Jan 2023 14:39:54 +0100
|
||||
Subject: [PATCH] Only override the graphdriver to vfs if the priority is unset
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is an amend to https://github.com/containers/storage/pull/1460
|
||||
|
||||
That PR was not addressing the case when the system wide config had the
|
||||
driver_priority option configured and the user had no config file of their
|
||||
own. Then `getRootlessStorageOpts` would be called and it would override the
|
||||
graph driver to "vfs".
|
||||
|
||||
With this commit we only override the graph driver if driver priority is
|
||||
empty. Otherwise we propagate the driver priority into the storage options, so
|
||||
that the driver autodetection works as expected.
|
||||
|
||||
Signed-off-by: Dan Čermák <dcermak@suse.com>
|
||||
---
|
||||
vendor/github.com/containers/storage/types/options.go | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vendor/github.com/containers/storage/types/options.go b/vendor/github.com/containers/storage/types/options.go
|
||||
index e87f458cc..eb7142ff2 100644
|
||||
--- a/vendor/github.com/containers/storage/types/options.go
|
||||
+++ b/vendor/github.com/containers/storage/types/options.go
|
||||
@@ -274,7 +274,11 @@ func getRootlessStorageOpts(rootlessUID int, systemOpts StoreOptions) (StoreOpti
|
||||
}
|
||||
}
|
||||
if opts.GraphDriverName == "" {
|
||||
- opts.GraphDriverName = "vfs"
|
||||
+ if len(systemOpts.GraphDriverPriority) == 0 {
|
||||
+ opts.GraphDriverName = "vfs"
|
||||
+ } else {
|
||||
+ opts.GraphDriverPriority = systemOpts.GraphDriverPriority
|
||||
+ }
|
||||
}
|
||||
|
||||
if os.Getenv("STORAGE_OPTS") != "" {
|
||||
--
|
||||
2.39.0
|
||||
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 17 10:42:42 UTC 2023 - Danish Prakash <danish.prakash@suse.com>
|
||||
|
||||
- add patch: 0003-Only-override-the-graphdriver-to-vfs-if-the-priority.patch
|
||||
(backport of https://github.com/containers/storage/pull/1468)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 13 12:46:24 UTC 2023 - Danish Prakash <danish.prakash@suse.com>
|
||||
|
||||
- Make the priority for picking the storage driver configurable (bsc#1197093)
|
||||
(backport of https://github.com/containers/storage/pull/1460)
|
||||
- add patch: 0002-Make-the-priority-for-picking-the-storage-driver-con.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 22 08:20:16 UTC 2022 - dcermak@suse.com
|
||||
|
||||
|
@ -29,6 +29,8 @@ Source1: podman.conf
|
||||
Source2: README.SUSE.SLES
|
||||
# hotfix for https://github.com/containers/podman/issues/16765
|
||||
Patch0: 0001-Revert-Default-missing-hostPort-to-containerPort-is-.patch
|
||||
Patch1: 0002-Make-the-priority-for-picking-the-storage-driver-con.patch
|
||||
Patch2: 0003-Only-override-the-graphdriver-to-vfs-if-the-priority.patch
|
||||
BuildRequires: bash-completion
|
||||
BuildRequires: cni
|
||||
BuildRequires: device-mapper-devel
|
||||
|
Loading…
Reference in New Issue
Block a user