代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/iSulad 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From fe11b34a3c2843ea2198b310160b182d63aeb63b Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Tue, 2 Apr 2024 11:22:09 +0800
Subject: [PATCH 40/43] fix cpurt init bug for systemd-cgroup
Signed-off-by: jikai <jikai11@huawei.com>
---
src/daemon/common/cgroup/cgroup.c | 13 +++++++------
src/daemon/executor/container_cb/execution.c | 13 +++++++------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/daemon/common/cgroup/cgroup.c b/src/daemon/common/cgroup/cgroup.c
index d3f1445a..007dbb70 100644
--- a/src/daemon/common/cgroup/cgroup.c
+++ b/src/daemon/common/cgroup/cgroup.c
@@ -146,17 +146,18 @@ char *common_convert_cgroup_path(const char *cgroup_path)
return NULL;
}
- // for cgroup fs cgroup path, return directly
- if (!util_has_suffix(cgroup_path, ".slice")) {
- return util_strdup_s(cgroup_path);
- }
-
// for systemd cgroup, cgroup_path should have the form slice:prefix:id,
// convert it to a true path, such as from test-a.slice:isulad:id
// to test.slice/test-a.slice/isulad-id.scope
arr = util_string_split_n(cgroup_path, ':', 3);
if (arr == NULL || util_array_len((const char **)arr) != 3) {
- ERROR("Invalid systemd cgroup parent");
+ // not a systemd cgroup, return cgroup path directly
+ return util_strdup_s(cgroup_path);
+ }
+
+ // for cgroup fs cgroup path, return directly
+ if (!util_has_suffix(arr[0], ".slice")) {
+ ERROR("Invalid systemd cgroup path: %s", cgroup_path);
return NULL;
}
diff --git a/src/daemon/executor/container_cb/execution.c b/src/daemon/executor/container_cb/execution.c
index 88c6b354..4bf3621d 100644
--- a/src/daemon/executor/container_cb/execution.c
+++ b/src/daemon/executor/container_cb/execution.c
@@ -435,11 +435,12 @@ static int cpurt_controller_init(const char *id, const host_config *host_spec)
}
if (conf_get_systemd_cgroup()) {
- // currently it is the same as docker, yet it is unclear that
- // if systemd cgroup is used and cgroup parent is set to a slice rather than system.slice
- // should iSulad set cpu.rt_runtime_us and cpu.rt_period_us for the parent path?
- // in fact, even if system.slice is used,
- // cpu.rt_runtime_us and cpu.rt_period_us might still needed to be set manually
+ __isula_auto_free char *converted_cgroup = common_convert_cgroup_path(cgroups_path);
+ if (converted_cgroup == NULL) {
+ ERROR("Failed to convert cgroup path");
+ return -1;
+ }
+
__isula_auto_free char *init_cgroup = common_get_init_cgroup_path("cpu");
if (init_cgroup == NULL) {
ERROR("Failed to get init cgroup");
@@ -451,7 +452,7 @@ static int cpurt_controller_init(const char *id, const host_config *host_spec)
ERROR("Failed to get own cgroup");
return -1;
}
- char *new_cgroups_path = util_path_join(init_cgroup, cgroups_path);
+ char *new_cgroups_path = util_path_join(init_cgroup, converted_cgroup);
if (new_cgroups_path == NULL) {
ERROR("Failed to join path");
return -1;
--
2.34.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。