summaryrefslogtreecommitdiff
path: root/libpod/config
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2019-12-13 13:51:39 -0500
committerMatthew Heon <mheon@redhat.com>2019-12-13 13:51:39 -0500
commit87194a6f79292d78e415f027ab2e2fa9233153cd (patch)
treeffbc13a09a28fc682cbfd2b864752f7474a2b416 /libpod/config
parent22849ff43d115f420a194bad7ace20b35eeec6b1 (diff)
downloadpodman-87194a6f79292d78e415f027ab2e2fa9233153cd.tar.gz
podman-87194a6f79292d78e415f027ab2e2fa9233153cd.tar.bz2
podman-87194a6f79292d78e415f027ab2e2fa9233153cd.zip
Fix F30-F31 migration for Podman 1.7.0
The earlier attempt to re-add config migration only worked with user-specified configs (podman run --config). This version works more in line with that we want - the first rootless config file will be changed from runc to crun. Verified on my system after an F31 migration - everything seems to be working well. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/config')
-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