aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-12-13 21:19:34 +0100
committerGitHub <noreply@github.com>2019-12-13 21:19:34 +0100
commit885967faaa97b23b358472e054d46e57253c4af7 (patch)
treeffbc13a09a28fc682cbfd2b864752f7474a2b416 /libpod
parent22849ff43d115f420a194bad7ace20b35eeec6b1 (diff)
parent87194a6f79292d78e415f027ab2e2fa9233153cd (diff)
downloadpodman-885967faaa97b23b358472e054d46e57253c4af7.tar.gz
podman-885967faaa97b23b358472e054d46e57253c4af7.tar.bz2
podman-885967faaa97b23b358472e054d46e57253c4af7.zip
Merge pull request #4699 from mheon/fix_f31_migration
Fix F30-F31 migration for Podman 1.7.0
Diffstat (limited to 'libpod')
-rw-r--r--libpod/config/config.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/libpod/config/config.go b/libpod/config/config.go
index 0e867a50e..6240bccb0 100644
--- a/libpod/config/config.go
+++ b/libpod/config/config.go
@@ -448,20 +448,27 @@ func NewConfig(userConfigPath string) (*Config, error) {
if err != nil {
return nil, errors.Wrapf(err, "error reading user config %q", userConfigPath)
}
- if err := cgroupV2Check(userConfigPath, config); err != nil {
- return nil, errors.Wrapf(err, "error rewriting configuration file %s", userConfigPath)
- }
}
// Now, check if the user can access system configs and merge them if needed.
if configs, err := systemConfigs(); err != nil {
return nil, errors.Wrapf(err, "error finding config on system")
} else {
+ migrated := false
for _, path := range configs {
systemConfig, err := readConfigFromFile(path)
if err != nil {
return nil, errors.Wrapf(err, "error reading system config %q", path)
}
+ // Handle CGroups v2 configuration migration.
+ // Migrate only the first config, and do it before
+ // merging.
+ if !migrated {
+ if err := cgroupV2Check(path, systemConfig); err != nil {
+ return nil, errors.Wrapf(err, "error rewriting configuration file %s", userConfigPath)
+ }
+ migrated = true
+ }
// Merge the it into the config. Any unset field in config will be
// over-written by the systemConfig.
if err := config.mergeConfig(systemConfig); err != nil {
@@ -564,6 +571,7 @@ func (c *Config) checkCgroupsAndLogger() {
// TODO Once runc has support for cgroups, this function should be removed.
func cgroupV2Check(configPath string, tmpConfig *Config) error {
if !tmpConfig.CgroupCheck && rootless.IsRootless() {
+ logrus.Debugf("Rewriting %s for CGroup v2 upgrade", configPath)
cgroupsV2, err := cgroups.IsCgroup2UnifiedMode()
if err != nil {
return err