mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
nspawn: check env var first, detect second
If we are going to use the env var to override the detection result anyway, there is not point in doing the detection, especially that it can fail.
This commit is contained in:
parent
5a46d55fc8
commit
98afd6af3a
@ -320,13 +320,6 @@ static int detect_unified_cgroup_hierarchy(void) {
|
|||||||
const char *e;
|
const char *e;
|
||||||
int r, all_unified, systemd_unified;
|
int r, all_unified, systemd_unified;
|
||||||
|
|
||||||
all_unified = cg_all_unified();
|
|
||||||
systemd_unified = cg_unified(SYSTEMD_CGROUP_CONTROLLER);
|
|
||||||
|
|
||||||
if (all_unified < 0 || systemd_unified < 0)
|
|
||||||
return log_error_errno(all_unified < 0 ? all_unified : systemd_unified,
|
|
||||||
"Failed to determine whether the unified cgroups hierarchy is used: %m");
|
|
||||||
|
|
||||||
/* Allow the user to control whether the unified hierarchy is used */
|
/* Allow the user to control whether the unified hierarchy is used */
|
||||||
e = getenv("UNIFIED_CGROUP_HIERARCHY");
|
e = getenv("UNIFIED_CGROUP_HIERARCHY");
|
||||||
if (e) {
|
if (e) {
|
||||||
@ -341,6 +334,13 @@ static int detect_unified_cgroup_hierarchy(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
all_unified = cg_all_unified();
|
||||||
|
systemd_unified = cg_unified(SYSTEMD_CGROUP_CONTROLLER);
|
||||||
|
|
||||||
|
if (all_unified < 0 || systemd_unified < 0)
|
||||||
|
return log_error_errno(all_unified < 0 ? all_unified : systemd_unified,
|
||||||
|
"Failed to determine whether the unified cgroups hierarchy is used: %m");
|
||||||
|
|
||||||
/* Otherwise inherit the default from the host system */
|
/* Otherwise inherit the default from the host system */
|
||||||
if (all_unified > 0)
|
if (all_unified > 0)
|
||||||
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL;
|
arg_unified_cgroup_hierarchy = CGROUP_UNIFIED_ALL;
|
||||||
|
Loading…
Reference in New Issue
Block a user