!337 do not mkdir of isulad if no controller found
From: @wangfengtu Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
0a2994d613
56
0001-do-not-mkdir-of-isulad-if-no-controller-found.patch
Normal file
56
0001-do-not-mkdir-of-isulad-if-no-controller-found.patch
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
From 9837be14200fecb32db0337652e60532f1adb7be Mon Sep 17 00:00:00 2001
|
||||||
|
From: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
Date: Mon, 23 May 2022 17:06:19 +0800
|
||||||
|
Subject: [PATCH] do not mkdir of isulad if no controller found
|
||||||
|
|
||||||
|
If selinux disable the capibility DAC_OVERRIDE,
|
||||||
|
mkdir isulad may fail when run container.
|
||||||
|
|
||||||
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
---
|
||||||
|
src/daemon/common/sysinfo.c | 22 ++++++++++++++++++++++
|
||||||
|
1 file changed, 22 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/common/sysinfo.c b/src/daemon/common/sysinfo.c
|
||||||
|
index e60377dd..6fb4ec38 100644
|
||||||
|
--- a/src/daemon/common/sysinfo.c
|
||||||
|
+++ b/src/daemon/common/sysinfo.c
|
||||||
|
@@ -1303,6 +1303,21 @@ out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __ANDROID__
|
||||||
|
+static bool cgroup2_no_controller() {
|
||||||
|
+ char *controllers_str = NULL;
|
||||||
|
+
|
||||||
|
+ controllers_str = util_read_content_from_file(CGROUP2_CONTROLLERS_PATH);
|
||||||
|
+ if (controllers_str == NULL || strlen(controllers_str) == 0 || strcmp(controllers_str, "\n") == 0) {
|
||||||
|
+ free(controllers_str);
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(controllers_str);
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static int make_sure_cgroup2_isulad_path_exist()
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
@@ -1315,6 +1330,13 @@ static int make_sure_cgroup2_isulad_path_exist()
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __ANDROID__
|
||||||
|
+ if (cgroup2_no_controller()) {
|
||||||
|
+ DEBUG("no cgroup controller found");
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
ret = mkdir(CGROUP_ISULAD_PATH, DEFAULT_CGROUP_DIR_MODE);
|
||||||
|
if (ret != 0 && (errno != EEXIST || !util_dir_exists(CGROUP_ISULAD_PATH))) {
|
||||||
|
return -1;
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
%global _version 2.0.14
|
%global _version 2.0.14
|
||||||
%global _release 1
|
%global _release 2
|
||||||
%global is_systemd 1
|
%global is_systemd 1
|
||||||
%global enable_shimv2 1
|
%global enable_shimv2 1
|
||||||
%global is_embedded 1
|
%global is_embedded 1
|
||||||
@ -13,6 +13,7 @@ URL: https://gitee.com/openeuler/iSulad
|
|||||||
Source: https://gitee.com/openeuler/iSulad/repository/archive/v%{version}.tar.gz
|
Source: https://gitee.com/openeuler/iSulad/repository/archive/v%{version}.tar.gz
|
||||||
BuildRoot: {_tmppath}/iSulad-%{version}
|
BuildRoot: {_tmppath}/iSulad-%{version}
|
||||||
|
|
||||||
|
Patch0001: 0001-do-not-mkdir-of-isulad-if-no-controller-found.patch
|
||||||
|
|
||||||
%ifarch x86_64 aarch64
|
%ifarch x86_64 aarch64
|
||||||
Provides: libhttpclient.so()(64bit)
|
Provides: libhttpclient.so()(64bit)
|
||||||
@ -240,6 +241,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 24 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.14-2
|
||||||
|
- Type: enhancement
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: do not mkdir of isulad if no controller found
|
||||||
|
|
||||||
* Mon May 23 2022 haozi007 <liuhao27@huawei.com> - 2.0.14-1
|
* Mon May 23 2022 haozi007 <liuhao27@huawei.com> - 2.0.14-1
|
||||||
- Type: enhancement
|
- Type: enhancement
|
||||||
- ID: NA
|
- ID: NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user