vendor latest c/common

Includes the default db backend changes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-10-10 14:24:24 +02:00
parent 040a4e4b1e
commit 8a52e638e6
31 changed files with 953 additions and 192 deletions

View File

@@ -212,6 +212,11 @@ func parseAAParserVersion(output string) (int, error) {
words := strings.Split(lines[0], " ")
version := words[len(words)-1]
// trim "-beta1" suffix from version="3.0.0-beta1" if exists
version = strings.SplitN(version, "-", 2)[0]
// also trim "~..." suffix used historically (https://gitlab.com/apparmor/apparmor/-/commit/bca67d3d27d219d11ce8c9cc70612bd637f88c10)
version = strings.SplitN(version, "~", 2)[0]
// split by major minor version
v := strings.Split(version, ".")
if len(v) == 0 || len(v) > 3 {

View File

@@ -30,24 +30,6 @@ const (
bindirPrefix = "$BINDIR"
)
// RuntimeStateStore is a constant indicating which state store implementation
// should be used by engine
type RuntimeStateStore int
const (
// InvalidStateStore is an invalid state store
InvalidStateStore RuntimeStateStore = iota
// InMemoryStateStore is an in-memory state that will not persist data
// on containers and pods between engine instances or after system
// reboot
InMemoryStateStore RuntimeStateStore = iota
// SQLiteStateStore is a state backed by a SQLite database
// It is presently disabled
SQLiteStateStore RuntimeStateStore = iota
// BoltDBStateStore is a state backed by a BoltDB database
BoltDBStateStore RuntimeStateStore = iota
)
var validImageVolumeModes = []string{_typeBind, "tmpfs", "ignore"}
// ProxyEnv is a list of Proxy Environment variables
@@ -483,13 +465,6 @@ type EngineConfig struct {
// readiness using the SD_NOTIFY mechanism.
SDNotify bool `toml:"-"`
// StateType is the type of the backing state store. Avoid using multiple
// values for this with the same containers/storage configuration on the
// same system. Different state types do not interact, and each will see a
// separate set of containers, which may cause conflicts in
// containers/storage. As such this is not exposed via the config file.
StateType RuntimeStateStore `toml:"-"`
// ServiceTimeout is the number of seconds to wait without a connection
// before the `podman system service` times out and exits
ServiceTimeout uint `toml:"service_timeout,omitempty,omitzero"`

View File

@@ -454,10 +454,14 @@ default_sysctls = [
# short-name aliases defined in containers-registries.conf(5).
#compat_api_enforce_docker_hub = true
# The database backend of Podman. Supported values are "boltdb" (default) and
# "sqlite". Please run `podman-system-reset` prior to changing the database
# The database backend of Podman. Supported values are "" (default), "boltdb"
# and "sqlite". An empty value means it will check whenever a boltdb already
# exists and use it when it does, otherwise it will use sqlite as default
# (e.g. new installs). This allows for backwards compatibility with older versions.
# Please run `podman-system-reset` prior to changing the database
# backend of an existing deployment, to make sure Podman can operate correctly.
#database_backend="boltdb"
#
#database_backend = ""
# Specify the keys sequence used to detach a container.
# Format is a single character [a-Z] or a comma separated sequence of

View File

@@ -29,10 +29,14 @@
#
#base_hosts_file = ""
# The database backend of Podman. Supported values are "boltdb" (default) and
# "sqlite". Please run `podman-system-reset` prior to changing the database
# The database backend of Podman. Supported values are "" (default), "boltdb"
# and "sqlite". An empty value means it will check whenever a boltdb already
# exists and use it when it does, otherwise it will use sqlite as default
# (e.g. new installs). This allows for backwards compatibility with older versions.
# Please run `podman-system-reset` prior to changing the database
# backend of an existing deployment, to make sure Podman can operate correctly.
#database_backend="boltdb"
#
#database_backend = ""
# List of default capabilities for containers. If it is empty or commented out,
# the default capabilities defined in the container engine will be added.

View File

@@ -13,6 +13,12 @@ const (
// SQLite backend.
DBBackendSQLite
// DBBackendDefault describes that no explicit backend has been set.
// It should default to sqlite unless there is already an existing boltdb,
// this allows for backwards compatibility on upgrades. The actual detection
// logic must live in podman as we only know there were to look for the file.
DBBackendDefault
stringBoltDB = "boltdb"
stringSQLite = "sqlite"
)
@@ -24,6 +30,8 @@ func (d DBBackend) String() string {
return stringBoltDB
case DBBackendSQLite:
return stringSQLite
case DBBackendDefault:
return ""
default:
return fmt.Sprintf("unsupported database backend: %d", d)
}
@@ -32,7 +40,7 @@ func (d DBBackend) String() string {
// Validate returns whether the DBBackend is supported.
func (d DBBackend) Validate() error {
switch d {
case DBBackendBoltDB, DBBackendSQLite:
case DBBackendBoltDB, DBBackendSQLite, DBBackendDefault:
return nil
default:
return fmt.Errorf("unsupported database backend: %d", d)
@@ -49,12 +57,9 @@ func ParseDBBackend(raw string) (DBBackend, error) {
return DBBackendBoltDB, nil
case stringSQLite:
return DBBackendSQLite, nil
case "":
return DBBackendDefault, nil
default:
return DBBackendUnsupported, fmt.Errorf("unsupported database backend: %q", raw)
}
}
// DBBackend returns the configured database backend.
func (c *Config) DBBackend() (DBBackend, error) {
return ParseDBBackend(c.Engine.DBBackend)
}

View File

@@ -120,8 +120,6 @@ const (
CgroupfsCgroupsManager = "cgroupfs"
// DefaultApparmorProfile specifies the default apparmor profile for the container.
DefaultApparmorProfile = apparmor.Profile
// DefaultDBBackend specifies the default database backend to be used by Podman.
DefaultDBBackend = DBBackendBoltDB
// DefaultHostsFile is the default path to the hosts file.
DefaultHostsFile = "/etc/hosts"
// SystemdCgroupsManager represents systemd native cgroup manager.
@@ -317,7 +315,6 @@ func defaultEngineConfig() (*EngineConfig, error) {
c.HooksDir = DefaultHooksDirs
c.ImageDefaultTransport = _defaultTransport
c.ImageVolumeMode = _defaultImageVolumeMode
c.StateType = BoltDBStateStore
c.ImageBuildFormat = "oci"
@@ -424,7 +421,6 @@ func defaultEngineConfig() (*EngineConfig, error) {
"/run/current-system/sw/bin/conmonrs",
}
c.PullPolicy = DefaultPullPolicy
c.DBBackend = stringBoltDB
c.RuntimeSupportsJSON = []string{
"crun",
"runc",