nspawn: also fall back to legacy cgroup hierarchy for old containers
Current systemd version detection routine cannot detect systemd 230, only systmed >= 231. This means that we'll still use the legacy hierarchy in some cases where we wouldn't have too. If somebody figures out a nice way to detect systemd 230 this can be later improved.
This commit is contained in:
parent
0fd9563fde
commit
a8725a06e6
|
@ -342,10 +342,18 @@ static int detect_unified_cgroup_hierarchy(const char *directory) {
|
|||
"Failed to determine whether the unified cgroups hierarchy is used: %m");
|
||||
|
||||
/* Otherwise inherit the default from the host system */
|
||||
if (all_unified > 0)
|
||||
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL;
|
||||
else if (systemd_unified > 0) {
|
||||
/* mixed cgroup hierarchy support was added in 232 */
|
||||
if (all_unified > 0) {
|
||||
/* Unified cgroup hierarchy support was added in 230. Unfortunately the detection
|
||||
* routine only detects 231, so we'll have a false negative here for 230. */
|
||||
r = systemd_installation_has_version(directory, 230);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine systemd version in container: %m");
|
||||
if (r > 0)
|
||||
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL;
|
||||
else
|
||||
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_NONE;
|
||||
} else if (systemd_unified > 0) {
|
||||
/* Mixed cgroup hierarchy support was added in 232 */
|
||||
r = systemd_installation_has_version(directory, 232);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine systemd version in container: %m");
|
||||
|
|
Loading…
Reference in a new issue