upgrade from upstream
Signed-off-by: jikai <jikai11@huawei.com>
This commit is contained in:
parent
efb8058ee7
commit
24bec3c29b
@ -1,7 +1,7 @@
|
||||
From 9497e03709a035805effd96eaa21f6c221a79e94 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Fri, 19 Jan 2024 17:12:30 +0800
|
||||
Subject: [PATCH 1/6] code improve for sandbox.cc
|
||||
Subject: [PATCH 01/43] code improve for sandbox.cc
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -23,5 +23,5 @@ index 359cfbad..7b6496ed 100644
|
||||
ERROR("Failed to get sandbox config json for sandbox: '%s'", m_id.c_str());
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 71f8d4accbec5153b362281bbaf9a516ccd083f5 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Mon, 22 Jan 2024 15:55:16 +0800
|
||||
Subject: [PATCH 2/6] fix compile error with protobuf 25.1 and grpc 1.60.x
|
||||
Subject: [PATCH 02/43] fix compile error with protobuf 25.1 and grpc 1.60.x
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -251,5 +251,5 @@ index f43b0f97..5a7cb2ea 100644
|
||||
add_test(NAME ${EXE} COMMAND ${EXE} --gtest_output=xml:${EXE}-Results.xml)
|
||||
set_tests_properties(${EXE} PROPERTIES TIMEOUT 120)
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From cd018d3c1ebff2a328912d99fc43c9a7e4f60704 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Thu, 25 Jan 2024 11:24:59 +0800
|
||||
Subject: [PATCH 3/6] bugfix for mount point remains under special
|
||||
Subject: [PATCH 03/43] bugfix for mount point remains under special
|
||||
circumstances
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
@ -119,5 +119,5 @@ index 0a7309c9..e4c302bc 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 7f13d95572040d30b70edbfac3c4b7350ee8855c Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Fri, 26 Jan 2024 12:59:45 +0800
|
||||
Subject: [PATCH 4/6] do not cleanup if the directory does not exist
|
||||
Subject: [PATCH 04/43] do not cleanup if the directory does not exist
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -67,5 +67,5 @@ index 08151f42..16dba630 100644
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 69dcd191afbdea5a178fb96a21e28537c2fc6a75 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Sat, 27 Jan 2024 11:16:37 +0800
|
||||
Subject: [PATCH 5/6] module only deletes the temporary files it creates
|
||||
Subject: [PATCH 05/43] module only deletes the temporary files it creates
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -147,5 +147,5 @@ index 751a8727..aed3057a 100644
|
||||
ERROR("image tmp work path too long");
|
||||
ret = -1;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From b290e7fb553c5cc6746c9dcfe4896098f74bc7d7 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 30 Jan 2024 12:35:58 +0800
|
||||
Subject: [PATCH 6/6] skip devmapper ut
|
||||
Subject: [PATCH 06/43] skip devmapper ut
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -22,5 +22,5 @@ index c1d26ff1..9bb984cd 100755
|
||||
|
||||
# build fuzz
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From ed4b71b2027a6e9fdf15931fe93aa9e0bb3dc79d Mon Sep 17 00:00:00 2001
|
||||
From: leizhongkai <leizhongkai@huawei.com>
|
||||
Date: Wed, 31 Jan 2024 18:17:52 +0800
|
||||
Subject: [PATCH 07/26] update annotations and add ci cases
|
||||
Subject: [PATCH 07/43] update annotations and add ci cases
|
||||
|
||||
Signed-off-by: leizhongkai <leizhongkai@huawei.com>
|
||||
---
|
||||
@ -170,5 +170,5 @@ index cc49d85f..62e340b1 100644
|
||||
+}
|
||||
+
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From fe3413bb8ebae90f29ce3cc02373f3fc2b5d2fd2 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Mon, 22 Jan 2024 20:19:29 +0800
|
||||
Subject: [PATCH 08/26] bug fix for device/cgroup/ulimt oci update
|
||||
Subject: [PATCH 08/43] bug fix for device/cgroup/ulimt oci update
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -180,5 +180,5 @@ index 62e340b1..464b4fb4 100644
|
||||
oci_runtime_spec *load_oci_config(const char *rootpath, const char *name)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 82dd5a1db70fdb3f4934a3f9c0ee290ce5bee1b2 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Sat, 27 Jan 2024 15:30:05 +0800
|
||||
Subject: [PATCH 09/26] improve dt for oci spec update
|
||||
Subject: [PATCH 09/43] improve dt for oci spec update
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -277,5 +277,5 @@ index ad903a3f..47e4ca6e 100644
|
||||
struct capabilities_lens {
|
||||
size_t bounding_len;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 44d15a7451a922ca7266b756d3f9a83908199cb3 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Tue, 23 Jan 2024 10:35:59 +0800
|
||||
Subject: [PATCH 10/26] open run container with dev volume testcase
|
||||
Subject: [PATCH 10/43] open run container with dev volume testcase
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
@ -26,5 +26,5 @@ index 545d5099..04bf437a 100755
|
||||
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 3dc12d7806fda8d5ceee183595e993079bee4056 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Fri, 12 Jan 2024 17:38:09 +0800
|
||||
Subject: [PATCH 11/26] add cpu usage nano cores for sandbox
|
||||
Subject: [PATCH 11/43] add cpu usage nano cores for sandbox
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -77,5 +77,5 @@ index 2bd28007..c3d98b8c 100644
|
||||
void GetFilterPodSandbox(const runtime::v1::PodSandboxStatsFilter *filter,
|
||||
std::vector<std::string> &podSandboxIDs, Errors &error);
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 384cf7870c155d41f742b1928a4cb1b56aa46c94 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Tue, 6 Feb 2024 20:05:05 +0800
|
||||
Subject: [PATCH 12/26] sleep some time in ServiceWorkThread to prevent the CPU
|
||||
Subject: [PATCH 12/43] sleep some time in ServiceWorkThread to prevent the CPU
|
||||
from being occupied all the time
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
@ -23,5 +23,5 @@ index 6319a67f..a8d89b36 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 2df7a67ad2cb0249b18ca5eba46f9aab8f72038f Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Sun, 18 Feb 2024 11:32:55 +0800
|
||||
Subject: [PATCH 13/26] restore name for rename failed
|
||||
Subject: [PATCH 13/43] restore name for rename failed
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -25,5 +25,5 @@ index 2a71e82a..c02cc830 100644
|
||||
|
||||
static int container_rename(container_t *cont, const char *new_name)
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From fd4c80b8de768d7132cef0720cd46167173a653b Mon Sep 17 00:00:00 2001
|
||||
From: xuxuepeng <xuxuepeng1@huawei.com>
|
||||
Date: Mon, 19 Feb 2024 01:05:18 +0000
|
||||
Subject: [PATCH 14/26] !2371 Allow iSulad to pull/load image with symlink *
|
||||
Subject: [PATCH 14/43] !2371 Allow iSulad to pull/load image with symlink *
|
||||
Allow iSulad to pull/load image with symlink
|
||||
|
||||
---
|
||||
@ -41,5 +41,5 @@ index e4c302bc..52b51162 100644
|
||||
a = archive_read_new();
|
||||
if (a == NULL) {
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From fb76605985166c4d2172270c8d633ed26d62f698 Mon Sep 17 00:00:00 2001
|
||||
From: xuxuepeng <xuxuepeng1@huawei.com>
|
||||
Date: Mon, 19 Feb 2024 23:52:47 +0800
|
||||
Subject: [PATCH 15/26] Replace http-parser dependency with lcr
|
||||
Subject: [PATCH 15/43] Replace http-parser dependency with lcr
|
||||
|
||||
Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com>
|
||||
---
|
||||
@ -423,5 +423,5 @@ index 885375f2..d851ba96 100644
|
||||
|
||||
#include "isula_libutils/log.h"
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From e4facfcd2947b5277789d58a452090b61ca2d383 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 21 Feb 2024 15:04:27 +0800
|
||||
Subject: [PATCH 16/26] add more detailed log information for load sandbox
|
||||
Subject: [PATCH 16/43] add more detailed log information for load sandbox
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -22,5 +22,5 @@ index d3db4fb4..cee444f4 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 0099190e7f18e890185e36c5a657e9ce95179bc8 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Fri, 1 Mar 2024 15:04:09 +0800
|
||||
Subject: [PATCH 17/26] bugfix for the concurrency competition between the
|
||||
Subject: [PATCH 17/43] bugfix for the concurrency competition between the
|
||||
reuse layer and the creation layer
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
@ -79,5 +79,5 @@ index aed3057a..66fa0076 100644
|
||||
// parent_chain_id = NULL means no parent chain match from now on, so no longer need
|
||||
// to get layers by compressed digest to reuse layer.
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 2af906d42a155a7b779dce017a2779b96dba2b61 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Fri, 1 Mar 2024 15:04:35 +0800
|
||||
Subject: [PATCH 18/26] add concurrent load test
|
||||
Subject: [PATCH 18/43] add concurrent load test
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -69,5 +69,5 @@ index 52b713d4..a2cada5f 100755
|
||||
|
||||
show_result ${ans} "${curr_path}/${0}"
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 96dfd32ee5d9a133ad63af13723402f10cd7cf7b Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Mon, 11 Mar 2024 15:50:45 +0800
|
||||
Subject: [PATCH 19/26] get the realpath of the host path for archive when cp
|
||||
Subject: [PATCH 19/43] get the realpath of the host path for archive when cp
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -59,5 +59,5 @@ index bbe4c3b2..fe514acc 100644
|
||||
ERROR("Can not archive path: %s", path);
|
||||
goto cleanup;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From c67760ce928f67d9a8beeaf2e2d51c8f2239f69e Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Tue, 12 Mar 2024 11:15:26 +0800
|
||||
Subject: [PATCH 20/26] bugfix for wrong goto branch
|
||||
Subject: [PATCH 20/43] bugfix for wrong goto branch
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -31,5 +31,5 @@ index fe514acc..13343922 100644
|
||||
|
||||
DEBUG("chroot tar stream srcdir(%s) srcbase(%s) rebase(%s)", srcdir, srcbase, rebase);
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 0ef23c6caae4a97228705574b0c8f3445c6e65dc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E8=AE=B8=E7=BA=A2=E5=BC=BA?= <277922995@qq.com>
|
||||
Date: Wed, 13 Mar 2024 17:00:16 +0800
|
||||
Subject: [PATCH 21/26] bugfix for wrong dynamic allocation object type
|
||||
Subject: [PATCH 21/43] bugfix for wrong dynamic allocation object type
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -25,5 +25,5 @@ index e7aa81b8..871f5f39 100644
|
||||
ERROR("Out of memory");
|
||||
return -1;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From ed569ccbf7e5029e83c40521255e0e406f285bae Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Fri, 12 Jan 2024 11:31:59 +0800
|
||||
Subject: [PATCH 22/26] add swap usage in cri
|
||||
Subject: [PATCH 22/43] add swap usage in cri
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -76,5 +76,5 @@ index 2c92cc59..745154bb 100644
|
||||
if (blkio == NULL) {
|
||||
return;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 16a0cf7e9c2c059cb5537f48a022e63df457f186 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Sat, 2 Mar 2024 11:49:08 +0800
|
||||
Subject: [PATCH 23/26] add benchmark, result of perf test in cri
|
||||
Subject: [PATCH 23/43] add benchmark, result of perf test in cri
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -252,5 +252,5 @@ index 00000000..54ee24f5
|
||||
+crictl --runtime-endpoint $runtime rmp -af
|
||||
+rm -rf $tmpdir
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 167af3ce0cff3906c9976b249432d41167b15eb2 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Thu, 11 Jan 2024 17:06:57 +0800
|
||||
Subject: [PATCH 24/26] add support for systemd cgroup driver
|
||||
Subject: [PATCH 24/43] add support for systemd cgroup driver
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -519,5 +519,5 @@ index 464b4fb4..b4d2b0f6 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From f5f100f5b244be2debebe815aaed3afad8950daf Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 6 Feb 2024 17:33:17 +0800
|
||||
Subject: [PATCH 25/26] add ci cases for systemd cgroup driver
|
||||
Subject: [PATCH 25/43] add ci cases for systemd cgroup driver
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -215,5 +215,5 @@ index 47e4ca6e..6c42216d 100644
|
||||
{
|
||||
parser_error err = nullptr;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From b93647205db5c4a5d74fb245c9b1e15ca1ffd3fe Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Sat, 16 Mar 2024 09:35:22 +0800
|
||||
Subject: [PATCH 26/26] move systemd_cgroup CI test to manual cases
|
||||
Subject: [PATCH 26/43] move systemd_cgroup CI test to manual cases
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -14,5 +14,5 @@ similarity index 100%
|
||||
rename from CI/test_cases/container_cases/systemd_cgroup.sh
|
||||
rename to CI/test_cases/manual_cases/systemd_cgroup.sh
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 7c7cd82619ed1f7e36d34da1afc2b417a90b3040 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Tue, 23 Jan 2024 17:18:51 +0800
|
||||
Subject: [PATCH 27/34] =?UTF-8?q?=E3=80=90feature=E3=80=91add=20support=20?=
|
||||
Subject: [PATCH 27/43] =?UTF-8?q?=E3=80=90feature=E3=80=91add=20support=20?=
|
||||
=?UTF-8?q?for=20cgroup=20v2=20metrics?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
@ -1080,5 +1080,5 @@ index 64f41496..1c084595 100644
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 835185f7c4739993c2ca26d737bb0a45277ad932 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Wed, 20 Mar 2024 15:48:42 +0800
|
||||
Subject: [PATCH 28/34] use supervisor to notify sandbox exit event
|
||||
Subject: [PATCH 28/43] use supervisor to notify sandbox exit event
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -250,5 +250,5 @@ index bef884fb..8189efd6 100644
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From c26604ff3150babae729890c549f2784212073a1 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 20 Mar 2024 15:53:56 +0800
|
||||
Subject: [PATCH 29/34] refactor cgroup module
|
||||
Subject: [PATCH 29/43] refactor cgroup module
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -2534,5 +2534,5 @@ index 7ed8e837..88c6b354 100644
|
||||
ERROR("Failed to get cpu rt controller mnt root path");
|
||||
return -1;
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 59e7ea0f16e83e0bdbc39bdc41d1ade8d3db885e Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Thu, 22 Feb 2024 09:52:30 +0800
|
||||
Subject: [PATCH 30/34] adaptor unit test for cgroup module
|
||||
Subject: [PATCH 30/43] adaptor unit test for cgroup module
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -347,5 +347,5 @@ index cc309352..27d07330 100644
|
||||
${CMAKE_BINARY_DIR}/conf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 8e11a1eea62cb8061f1613379ff83bd9a721fa50 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 31 Jan 2024 18:10:46 +0800
|
||||
Subject: [PATCH 31/34] cgroup v2 does not support isulad setting cpu_rt
|
||||
Subject: [PATCH 31/43] cgroup v2 does not support isulad setting cpu_rt
|
||||
options
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
@ -67,5 +67,5 @@ index 5fb55689..619e36d1 100644
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 1ab0f4608fb749b50aa6f8d8188db23aa8a6e1ac Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Thu, 1 Feb 2024 10:48:45 +0800
|
||||
Subject: [PATCH 32/34] add test that isulad cannot set cpu_rt parameters when
|
||||
Subject: [PATCH 32/43] add test that isulad cannot set cpu_rt parameters when
|
||||
adding cgroup v2
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
@ -26,5 +26,5 @@ index bdc43a5e..23d3baed 100755
|
||||
isula pull ${image}
|
||||
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From f62df3dedbbe11bb56e6da7dd610c573fd3ed828 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Mon, 25 Mar 2024 10:01:56 +0800
|
||||
Subject: [PATCH 33/34] fix sandbox container bool value uninitialized
|
||||
Subject: [PATCH 33/43] fix sandbox container bool value uninitialized
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
@ -22,5 +22,5 @@ index 7b34cc7f..a8090d5a 100644
|
||||
nret = snprintf(bundle, sizeof(bundle), "%s/%s", cont->root_path, id);
|
||||
if (nret < 0 || (size_t)nret >= sizeof(bundle)) {
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 411483ad9b2a0c50190f9b56779d41889c895014 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 27 Mar 2024 10:29:11 +0800
|
||||
Subject: [PATCH 34/34] bugfix for cpurt.sh
|
||||
Subject: [PATCH 34/43] bugfix for cpurt.sh
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
@ -43,5 +43,5 @@ index 23d3baed..64dcd81f 100755
|
||||
done
|
||||
|
||||
--
|
||||
2.25.1
|
||||
2.34.1
|
||||
|
||||
|
||||
868
0035-monitor-cgroup-oom-killed-event-and-update-to-cri-of.patch
Normal file
868
0035-monitor-cgroup-oom-killed-event-and-update-to-cri-of.patch
Normal file
@ -0,0 +1,868 @@
|
||||
From 947cf87a87ec49409ae509e5142b8134454d1547 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Thu, 28 Mar 2024 12:51:09 +0000
|
||||
Subject: [PATCH 35/43] monitor cgroup oom killed event and update to cri of
|
||||
container
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
src/daemon/common/cgroup/cgroup.c | 91 +++++++++-
|
||||
src/daemon/common/cgroup/cgroup.h | 5 +
|
||||
src/daemon/common/cgroup/cgroup_common.h | 13 ++
|
||||
src/daemon/common/cgroup/cgroup_v1.c | 160 ++++++++++++++++++
|
||||
src/daemon/common/cgroup/cgroup_v2.c | 138 ++++++++++++++-
|
||||
.../v1/v1_cri_container_manager_service.cc | 3 +
|
||||
src/daemon/modules/api/container_api.h | 5 +-
|
||||
.../container/container_events_handler.c | 12 +-
|
||||
.../modules/container/container_state.c | 15 ++
|
||||
.../modules/container/restore/restore.c | 10 +-
|
||||
.../modules/container/supervisor/supervisor.c | 54 +++++-
|
||||
src/daemon/modules/events/collector.c | 7 +-
|
||||
.../modules/service/service_container.c | 11 +-
|
||||
13 files changed, 498 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/common/cgroup/cgroup.c b/src/daemon/common/cgroup/cgroup.c
|
||||
index 837b514a..d3f1445a 100644
|
||||
--- a/src/daemon/common/cgroup/cgroup.c
|
||||
+++ b/src/daemon/common/cgroup/cgroup.c
|
||||
@@ -133,4 +133,93 @@ char *common_get_own_cgroup_path(const char *subsystem)
|
||||
}
|
||||
|
||||
return g_cgroup_ops.get_own_cgroup_path(subsystem);
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
+
|
||||
+char *common_convert_cgroup_path(const char *cgroup_path)
|
||||
+{
|
||||
+ char *token = NULL;
|
||||
+ char result[PATH_MAX + 1] = {0};
|
||||
+ __isula_auto_array_t char **arr = NULL;
|
||||
+
|
||||
+ if (cgroup_path == NULL) {
|
||||
+ ERROR("Invalid NULL 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");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ token = strchr(arr[0], '-');
|
||||
+ while (token != NULL) {
|
||||
+ *token = '\0';
|
||||
+ if (strlen(arr[0]) > PATH_MAX || strlen(result) + 1 + strlen(".slice") >
|
||||
+ PATH_MAX - strlen(arr[0])) {
|
||||
+ ERROR("Invalid systemd cgroup parent: exceeds max length of path");
|
||||
+ *token = '-';
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (result[0] != '\0') {
|
||||
+ strcat(result, "/");
|
||||
+ }
|
||||
+ strcat(result, arr[0]);
|
||||
+ strcat(result, ".slice");
|
||||
+ *token = '-';
|
||||
+ token = strchr(token + 1, '-');
|
||||
+ }
|
||||
+
|
||||
+ // Add /arr[0]/arr[1]-arr[2].scope, 3 include two slashes and one dash
|
||||
+ if (strlen(cgroup_path) > PATH_MAX || strlen(result) + 3 + strlen(".scope") >
|
||||
+ PATH_MAX - strlen(arr[0] - strlen(arr[1]) - strlen(arr[2]))) {
|
||||
+ ERROR("Invalid systemd cgroup parent: exceeds max length of path");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ (void)strcat(result, "/");
|
||||
+ (void)strcat(result, arr[0]);
|
||||
+ (void)strcat(result, "/");
|
||||
+ (void)strcat(result, arr[1]);
|
||||
+ (void)strcat(result, "-");
|
||||
+ (void)strcat(result, arr[2]);
|
||||
+ (void)strcat(result, ".scope");
|
||||
+
|
||||
+ return util_strdup_s(result);
|
||||
+}
|
||||
+
|
||||
+cgroup_oom_handler_info_t *common_get_cgroup_oom_handler(int fd, const char *name, const char *cgroup_path, const char *exit_fifo)
|
||||
+{
|
||||
+ if (g_cgroup_ops.get_cgroup_oom_handler == NULL) {
|
||||
+ ERROR("Unimplmented get_cgroup_oom_handler op");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return g_cgroup_ops.get_cgroup_oom_handler(fd, name, cgroup_path, exit_fifo);
|
||||
+}
|
||||
+
|
||||
+void common_free_cgroup_oom_handler_info(cgroup_oom_handler_info_t *info)
|
||||
+{
|
||||
+ if (info == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (info->oom_event_fd >= 0) {
|
||||
+ close(info->oom_event_fd);
|
||||
+ }
|
||||
+ if (info->cgroup_file_fd >= 0) {
|
||||
+ close(info->cgroup_file_fd);
|
||||
+ }
|
||||
+
|
||||
+ free(info->name);
|
||||
+ free(info->cgroup_memory_event_path);
|
||||
+ free(info);
|
||||
+}
|
||||
diff --git a/src/daemon/common/cgroup/cgroup.h b/src/daemon/common/cgroup/cgroup.h
|
||||
index 1efc3ca6..8c76d99d 100644
|
||||
--- a/src/daemon/common/cgroup/cgroup.h
|
||||
+++ b/src/daemon/common/cgroup/cgroup.h
|
||||
@@ -41,6 +41,11 @@ int common_get_cgroup_mnt_and_root_path(const char *subsystem, char **mountpoint
|
||||
char *common_get_init_cgroup_path(const char *subsystem);
|
||||
char *common_get_own_cgroup_path(const char *subsystem);
|
||||
|
||||
+char *common_convert_cgroup_path(const char *cgroup_path);
|
||||
+
|
||||
+cgroup_oom_handler_info_t *common_get_cgroup_oom_handler(int fd, const char *name, const char *cgroup_path, const char *exit_fifo);
|
||||
+void common_free_cgroup_oom_handler_info(cgroup_oom_handler_info_t *info);
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff --git a/src/daemon/common/cgroup/cgroup_common.h b/src/daemon/common/cgroup/cgroup_common.h
|
||||
index 2a0935cb..e3912bf0 100644
|
||||
--- a/src/daemon/common/cgroup/cgroup_common.h
|
||||
+++ b/src/daemon/common/cgroup/cgroup_common.h
|
||||
@@ -116,6 +116,17 @@ typedef struct {
|
||||
cgroup_pids_metrics_t cgpids_metrics;
|
||||
} cgroup_metrics_t;
|
||||
|
||||
+#define CGROUP_OOM_HANDLE_CONTINUE false
|
||||
+#define CGROUP_OOM_HANDLE_CLOSE true
|
||||
+
|
||||
+typedef struct _cgroup_oom_handler_info_t {
|
||||
+ int oom_event_fd;
|
||||
+ int cgroup_file_fd;
|
||||
+ char *name;
|
||||
+ char *cgroup_memory_event_path;
|
||||
+ bool (*oom_event_handler)(int, void *);
|
||||
+} cgroup_oom_handler_info_t;
|
||||
+
|
||||
typedef struct {
|
||||
int (*get_cgroup_version)(void);
|
||||
int (*get_cgroup_info)(cgroup_mem_info_t *meminfo, cgroup_cpu_info_t *cpuinfo,
|
||||
@@ -128,6 +139,8 @@ typedef struct {
|
||||
|
||||
char *(*get_init_cgroup_path)(const char *subsystem);
|
||||
char *(*get_own_cgroup_path)(const char *subsystem);
|
||||
+
|
||||
+ cgroup_oom_handler_info_t *(*get_cgroup_oom_handler)(int fd, const char *name, const char *cgroup_path, const char *exit_fifo);
|
||||
} cgroup_ops;
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/src/daemon/common/cgroup/cgroup_v1.c b/src/daemon/common/cgroup/cgroup_v1.c
|
||||
index 51cf7512..41f3110a 100644
|
||||
--- a/src/daemon/common/cgroup/cgroup_v1.c
|
||||
+++ b/src/daemon/common/cgroup/cgroup_v1.c
|
||||
@@ -12,14 +12,20 @@
|
||||
* Create: 2023-03-29
|
||||
* Description: provide cgroup v1 functions
|
||||
******************************************************************************/
|
||||
+#ifndef _GNU_SOURCE
|
||||
+#define _GNU_SOURCE
|
||||
+#endif
|
||||
+
|
||||
#include "cgroup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <sys/eventfd.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "sysinfo.h"
|
||||
#include "err_msg.h"
|
||||
+#include "events_sender_api.h"
|
||||
|
||||
#define CGROUP_HUGETLB_LIMIT "hugetlb.%s.limit_in_bytes"
|
||||
#define CGROUP_MOUNT_PATH_PREFIX "/sys/fs/cgroup/"
|
||||
@@ -1045,6 +1051,159 @@ static char *common_get_cgroup_path(const char *path, const char *subsystem)
|
||||
return res;
|
||||
}
|
||||
|
||||
+static bool oom_cb_cgroup_v1(int fd, void *cbdata)
|
||||
+{
|
||||
+ cgroup_oom_handler_info_t *info = (cgroup_oom_handler_info_t *)cbdata;
|
||||
+ /* Try to read cgroup.event_control and known if the cgroup was removed
|
||||
+ * if the cgroup was removed and only one event received,
|
||||
+ * we know that it is a cgroup removal event rather than an oom event
|
||||
+ */
|
||||
+ bool cgroup_removed = false;
|
||||
+ if (info == NULL) {
|
||||
+ ERROR("Invalide callback data");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (access(info->cgroup_memory_event_path, F_OK) < 0) {
|
||||
+ DEBUG("Cgroup event path was removed");
|
||||
+ cgroup_removed = true;
|
||||
+ }
|
||||
+
|
||||
+ uint64_t event_count;
|
||||
+ ssize_t num_read = util_read_nointr(fd, &event_count, sizeof(uint64_t));
|
||||
+ if (num_read < 0) {
|
||||
+ ERROR("Failed to read oom event from eventfd");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (num_read == 0) {
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (num_read != sizeof(uint64_t)) {
|
||||
+ ERROR("Failed to read full oom event from eventfd");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (event_count == 0) {
|
||||
+ ERROR("Unexpected event count when reading for oom event");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (event_count == 1 && cgroup_removed) {
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ INFO("OOM event detected");
|
||||
+ (void)isulad_monitor_send_container_event(info->name, OOM, -1, 0, NULL, NULL);
|
||||
+
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+}
|
||||
+
|
||||
+static char *get_memory_cgroup_path_v1(const char *cgroup_path)
|
||||
+{
|
||||
+ int nret = 0;
|
||||
+ __isula_auto_free char *converted_cgroup_path = NULL;
|
||||
+ __isula_auto_free char *mnt = NULL;
|
||||
+ __isula_auto_free char *root = NULL;
|
||||
+ char fpath[PATH_MAX] = { 0 };
|
||||
+
|
||||
+ converted_cgroup_path = common_convert_cgroup_path(cgroup_path);
|
||||
+ if (converted_cgroup_path == NULL) {
|
||||
+ ERROR("Failed to transfer cgroup path");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ nret = get_cgroup_mnt_and_root_path_v1("memory", &mnt, &root);
|
||||
+ if (nret != 0 || mnt == NULL || root == NULL) {
|
||||
+ ERROR("Can not find cgroup mnt and root path for subsystem 'memory'");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ // When iSulad is run inside docker, the root is based of the host cgroup.
|
||||
+ // Replace root to "/"
|
||||
+ if (strncmp(root, "/docker/", strlen("/docker/")) == 0) {
|
||||
+ root[1] = '\0';
|
||||
+ }
|
||||
+
|
||||
+ nret = snprintf(fpath, sizeof(fpath), "%s/%s", mnt, root);
|
||||
+ if (nret < 0 || (size_t)nret >= sizeof(fpath)) {
|
||||
+ ERROR("Failed to print string");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return util_path_join(fpath, converted_cgroup_path);
|
||||
+}
|
||||
+
|
||||
+static cgroup_oom_handler_info_t *get_cgroup_oom_handler_v1(int fd, const char *name, const char *cgroup_path, const char *exit_fifo)
|
||||
+{
|
||||
+ __isula_auto_free char *memory_cgroup_path = NULL;
|
||||
+ __isula_auto_free char *memory_cgroup_oom_control_path = NULL;
|
||||
+ __isula_auto_free char *data = NULL;
|
||||
+ __isula_auto_close int cgroup_event_control_fd = -1;
|
||||
+ if (name == NULL || cgroup_path == NULL || exit_fifo == NULL) {
|
||||
+ ERROR("Invalid arguments");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ cgroup_oom_handler_info_t *info = util_common_calloc_s(sizeof(cgroup_oom_handler_info_t));
|
||||
+ if (info == NULL) {
|
||||
+ ERROR("Out of memory");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ info->name = util_strdup_s(name);
|
||||
+ info->cgroup_file_fd = -1;
|
||||
+ info->oom_event_fd = -1;
|
||||
+ info->oom_event_handler = oom_cb_cgroup_v1;
|
||||
+
|
||||
+ memory_cgroup_path = get_memory_cgroup_path_v1(cgroup_path);
|
||||
+ if (memory_cgroup_path == NULL) {
|
||||
+ ERROR("Failed to get memory cgroup path");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ info->cgroup_memory_event_path = util_path_join(memory_cgroup_path, "cgroup.event_control");
|
||||
+ if (info->cgroup_memory_event_path == NULL) {
|
||||
+ ERROR("Failed to join memory cgroup file path");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ cgroup_event_control_fd = util_open(info->cgroup_memory_event_path, O_WRONLY | O_CLOEXEC, 0);
|
||||
+ if (cgroup_event_control_fd < 0) {
|
||||
+ ERROR("Failed to open %s", info->cgroup_memory_event_path);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ memory_cgroup_oom_control_path = util_path_join(memory_cgroup_path, "memory.oom_control");
|
||||
+ if (memory_cgroup_oom_control_path == NULL) {
|
||||
+ ERROR("Failed to join memory cgroup file path");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ info->cgroup_file_fd = util_open(memory_cgroup_oom_control_path, O_RDONLY | O_CLOEXEC, 0);
|
||||
+ if (info->cgroup_file_fd < 0) {
|
||||
+ ERROR("Failed to open %s", memory_cgroup_oom_control_path);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ info->oom_event_fd = eventfd(0, EFD_CLOEXEC);
|
||||
+ if (info->oom_event_fd < 0) {
|
||||
+ ERROR("Failed to create oom eventfd");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (asprintf(&data, "%d %d", info->oom_event_fd, info->cgroup_file_fd) < 0 ||
|
||||
+ util_write_nointr(cgroup_event_control_fd, data, strlen(data)) < 0) {
|
||||
+ ERROR("Failed to write to cgroup.event_control");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ return info;
|
||||
+cleanup:
|
||||
+ common_free_cgroup_oom_handler_info(info);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
char *get_init_cgroup_path_v1(const char *subsystem)
|
||||
{
|
||||
return common_get_cgroup_path("/proc/1/cgroup", subsystem);
|
||||
@@ -1071,5 +1230,6 @@ int cgroup_v1_ops_init(cgroup_ops *ops)
|
||||
ops->get_cgroup_mnt_and_root_path = get_cgroup_mnt_and_root_path_v1;
|
||||
ops->get_init_cgroup_path = get_init_cgroup_path_v1;
|
||||
ops->get_own_cgroup_path = get_own_cgroup_v1;
|
||||
+ ops->get_cgroup_oom_handler = get_cgroup_oom_handler_v1;
|
||||
return 0;
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/daemon/common/cgroup/cgroup_v2.c b/src/daemon/common/cgroup/cgroup_v2.c
|
||||
index 65cf90d8..a36258f0 100644
|
||||
--- a/src/daemon/common/cgroup/cgroup_v2.c
|
||||
+++ b/src/daemon/common/cgroup/cgroup_v2.c
|
||||
@@ -17,12 +17,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/inotify.h>
|
||||
|
||||
#include <isula_libutils/auto_cleanup.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "path.h"
|
||||
#include "sysinfo.h"
|
||||
+#include "events_sender_api.h"
|
||||
|
||||
// Cgroup V2 Item Definition
|
||||
#define CGROUP2_CPU_WEIGHT "cpu.weight"
|
||||
@@ -408,10 +410,143 @@ static int get_cgroup_metrics_v2(const char *cgroup_path, cgroup_metrics_t *cgro
|
||||
|
||||
static int get_cgroup_mnt_and_root_v2(const char *subsystem, char **mountpoint, char **root)
|
||||
{
|
||||
- *mountpoint = util_strdup_s(CGROUP_ISULAD_PATH);
|
||||
+ if (mountpoint != NULL) {
|
||||
+ *mountpoint = util_strdup_s(CGROUP_ISULAD_PATH);
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static bool oom_cb_cgroup_v2(int fd, void *cbdata)
|
||||
+{
|
||||
+ const size_t events_size = sizeof(struct inotify_event) + NAME_MAX + 1;
|
||||
+ char events[events_size];
|
||||
+ cgroup_oom_handler_info_t *info = (cgroup_oom_handler_info_t *)cbdata;
|
||||
+
|
||||
+ if (info == NULL) {
|
||||
+ ERROR("Invalid callback data");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ ssize_t num_read = util_read_nointr(fd, &events, events_size);
|
||||
+ if (num_read < 0) {
|
||||
+ ERROR("Failed to read oom event from eventfd in v2");
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ if (((struct inotify_event *)events)->mask & ( IN_DELETE | IN_DELETE_SELF)) {
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ __isula_auto_file FILE *fp = fopen(info->cgroup_memory_event_path, "re");
|
||||
+ if (fp == NULL) {
|
||||
+ ERROR("Failed to open cgroups file: %s", info->cgroup_memory_event_path);
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ __isula_auto_free char *line = NULL;
|
||||
+ size_t len = 0;
|
||||
+ ssize_t read;
|
||||
+ while ((read = getline(&line, &len, fp)) != -1) {
|
||||
+ int count;
|
||||
+ const char *oom_str = "oom ";
|
||||
+ const char *oom_kill_str = "oom_kill ";
|
||||
+ const int oom_len = strlen(oom_str), oom_kill_len = strlen(oom_kill_str);
|
||||
+
|
||||
+ if (read >= oom_kill_len + 2 && memcmp(line, oom_kill_str, oom_kill_len) == 0) {
|
||||
+ len = oom_kill_len;
|
||||
+ } else if (read >= oom_len + 2 && memcmp(line, oom_str, oom_len) == 0) {
|
||||
+ len = oom_len;
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // to make use of util_safe_int, it requires it ends with '\0'
|
||||
+ line[strcspn(line, "\n")] = '\0';
|
||||
+ if (util_safe_int(&line[len], &count) < 0) {
|
||||
+ ERROR("Failed to parse: %s", &line[len]);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (count == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ INFO("OOM event detected in cgroup v2");
|
||||
+ (void)isulad_monitor_send_container_event(info->name, OOM, -1, 0, NULL, NULL);
|
||||
+
|
||||
+ return CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ }
|
||||
+
|
||||
+ return CGROUP_OOM_HANDLE_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static char *get_real_cgroup_path_v2(const char *cgroup_path)
|
||||
+{
|
||||
+ __isula_auto_free char *converted_cgroup_path = NULL;
|
||||
+ converted_cgroup_path = common_convert_cgroup_path(cgroup_path);
|
||||
+ if (converted_cgroup_path == NULL) {
|
||||
+ ERROR("Failed to convert cgroup path");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return util_path_join(CGROUP_MOUNTPOINT, converted_cgroup_path);
|
||||
+}
|
||||
+
|
||||
+cgroup_oom_handler_info_t *get_cgroup_oom_handler_v2(int fd, const char *name, const char *cgroup_path, const char *exit_fifo)
|
||||
+{
|
||||
+ __isula_auto_free char *real_cgroup_path = NULL;
|
||||
+ if (name == NULL || cgroup_path == NULL || exit_fifo == NULL) {
|
||||
+ ERROR("Invalid arguments");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ cgroup_oom_handler_info_t *info = util_common_calloc_s(sizeof(cgroup_oom_handler_info_t));
|
||||
+ if (info == NULL) {
|
||||
+ ERROR("Out of memory");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ info->name = util_strdup_s(name);
|
||||
+ info->oom_event_fd = -1;
|
||||
+ info->cgroup_file_fd = -1;
|
||||
+ info->oom_event_handler = oom_cb_cgroup_v2;
|
||||
+
|
||||
+ real_cgroup_path = get_real_cgroup_path_v2(cgroup_path);
|
||||
+ if (real_cgroup_path == NULL) {
|
||||
+ ERROR("Failed to transfer cgroup path: %s", cgroup_path);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ info->cgroup_memory_event_path = util_path_join(real_cgroup_path, "memory.events");
|
||||
+ if (info->cgroup_memory_event_path == NULL) {
|
||||
+ ERROR("Failed to join path");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if ((info->oom_event_fd = inotify_init()) < 0) {
|
||||
+ ERROR("Failed to init inotify fd");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (inotify_add_watch(info->oom_event_fd, info->cgroup_memory_event_path, IN_MODIFY) < 0) {
|
||||
+ ERROR("Failed to watch inotify fd for %s", info->cgroup_memory_event_path);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ // watch exit fifo for container exit, so we can close the inotify fd
|
||||
+ // because inotify cannot watch cgroup file delete event
|
||||
+ if (inotify_add_watch(info->oom_event_fd, exit_fifo, IN_DELETE | IN_DELETE_SELF) < 0) {
|
||||
+ ERROR("Failed to watch inotify fd for %s", exit_fifo);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ return info;
|
||||
+
|
||||
+cleanup:
|
||||
+ common_free_cgroup_oom_handler_info(info);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
int get_cgroup_version_v2()
|
||||
{
|
||||
return CGROUP_VERSION_2;
|
||||
@@ -426,5 +561,6 @@ int cgroup_v2_ops_init(cgroup_ops *ops)
|
||||
ops->get_cgroup_info = get_cgroup_info_v2;
|
||||
ops->get_cgroup_metrics = get_cgroup_metrics_v2;
|
||||
ops->get_cgroup_mnt_and_root_path = get_cgroup_mnt_and_root_v2;
|
||||
+ ops->get_cgroup_oom_handler = get_cgroup_oom_handler_v2;
|
||||
return 0;
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
index 47a33c2c..cac5c0ba 100644
|
||||
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||||
@@ -1055,6 +1055,9 @@ void ContainerManagerService::UpdateBaseStatusFromInspect(
|
||||
} else { // Case 3
|
||||
state = runtime::v1::CONTAINER_CREATED;
|
||||
}
|
||||
+ if (inspect->state->oom_killed) {
|
||||
+ reason = "OOMKilled";
|
||||
+ }
|
||||
if (inspect->state->error != nullptr) {
|
||||
message = inspect->state->error;
|
||||
}
|
||||
diff --git a/src/daemon/modules/api/container_api.h b/src/daemon/modules/api/container_api.h
|
||||
index 43d66d64..830fd696 100644
|
||||
--- a/src/daemon/modules/api/container_api.h
|
||||
+++ b/src/daemon/modules/api/container_api.h
|
||||
@@ -221,6 +221,8 @@ void container_state_set_restarting(container_state_t *s, int exit_code);
|
||||
void container_state_set_paused(container_state_t *s);
|
||||
void container_state_reset_paused(container_state_t *s);
|
||||
|
||||
+void container_state_set_oom_killed(container_state_t *s);
|
||||
+
|
||||
void container_state_set_dead(container_state_t *s);
|
||||
|
||||
void container_state_increase_restart_count(container_state_t *s);
|
||||
@@ -269,8 +271,7 @@ bool container_is_valid_state_string(const char *state);
|
||||
|
||||
void container_update_health_monitor(const char *container_id);
|
||||
|
||||
-extern int container_supervisor_add_exit_monitor(int fd, const pid_ppid_info_t *pid_info, const char *name,
|
||||
- const char *runtime, bool sandbox_container);
|
||||
+extern int container_supervisor_add_exit_monitor(int fd, const char *exit_fifo, const pid_ppid_info_t *pid_info, const container_t *cont);
|
||||
|
||||
extern char *container_exit_fifo_create(const char *cont_state_path);
|
||||
|
||||
diff --git a/src/daemon/modules/container/container_events_handler.c b/src/daemon/modules/container/container_events_handler.c
|
||||
index b84f1ad5..109a628c 100644
|
||||
--- a/src/daemon/modules/container/container_events_handler.c
|
||||
+++ b/src/daemon/modules/container/container_events_handler.c
|
||||
@@ -114,7 +114,7 @@ static int container_state_changed(container_t *cont, const struct isulad_events
|
||||
bool has_been_manually_stopped = false;
|
||||
|
||||
/* only handle Exit event */
|
||||
- if (events->type != EVENTS_TYPE_STOPPED1) {
|
||||
+ if (events->type != EVENTS_TYPE_STOPPED1 && events->type != EVENTS_TYPE_OOM) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,6 +187,16 @@ static int container_state_changed(container_t *cont, const struct isulad_events
|
||||
}
|
||||
|
||||
break;
|
||||
+
|
||||
+ case EVENTS_TYPE_OOM: {
|
||||
+ container_lock(cont);
|
||||
+ container_state_set_oom_killed(cont->state);
|
||||
+ if (container_state_to_disk(cont)) {
|
||||
+ WARN("Failed to save container \"%s\" to disk", id);
|
||||
+ }
|
||||
+ container_unlock(cont);
|
||||
+ break;
|
||||
+ }
|
||||
default:
|
||||
/* ignore garbage */
|
||||
break;
|
||||
diff --git a/src/daemon/modules/container/container_state.c b/src/daemon/modules/container/container_state.c
|
||||
index f31959fa..452a2b26 100644
|
||||
--- a/src/daemon/modules/container/container_state.c
|
||||
+++ b/src/daemon/modules/container/container_state.c
|
||||
@@ -154,6 +154,7 @@ void container_state_set_running(container_state_t *s, const pid_ppid_info_t *pi
|
||||
state->paused = false;
|
||||
}
|
||||
state->exit_code = 0;
|
||||
+ state->oom_killed = false;
|
||||
|
||||
if (pid_info != NULL) {
|
||||
state->pid = pid_info->pid;
|
||||
@@ -222,6 +223,19 @@ void container_state_set_paused(container_state_t *s)
|
||||
container_state_unlock(s);
|
||||
}
|
||||
|
||||
+void container_state_set_oom_killed(container_state_t *s)
|
||||
+{
|
||||
+ if (s == NULL || s->state == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ container_state_lock(s);
|
||||
+
|
||||
+ s->state->oom_killed = true;
|
||||
+
|
||||
+ container_state_unlock(s);
|
||||
+}
|
||||
+
|
||||
/* state reset paused */
|
||||
void container_state_reset_paused(container_state_t *s)
|
||||
{
|
||||
@@ -573,6 +587,7 @@ container_inspect_state *container_state_to_inspect_state(container_state_t *s)
|
||||
state->running = s->state->running;
|
||||
state->paused = s->state->paused;
|
||||
state->restarting = s->state->restarting;
|
||||
+ state->oom_killed = s->state->oom_killed;
|
||||
state->pid = s->state->pid;
|
||||
|
||||
state->exit_code = s->state->exit_code;
|
||||
diff --git a/src/daemon/modules/container/restore/restore.c b/src/daemon/modules/container/restore/restore.c
|
||||
index 76868e28..52f68d21 100644
|
||||
--- a/src/daemon/modules/container/restore/restore.c
|
||||
+++ b/src/daemon/modules/container/restore/restore.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <isula_libutils/container_config_v2.h>
|
||||
#include <isula_libutils/host_config.h>
|
||||
#include <isula_libutils/log.h>
|
||||
+#include <isula_libutils/auto_cleanup.h>
|
||||
|
||||
#include "isulad_config.h"
|
||||
|
||||
@@ -44,6 +45,8 @@
|
||||
#include "utils_file.h"
|
||||
#include "utils_timestamp.h"
|
||||
#include "id_name_manager.h"
|
||||
+#include "cgroup.h"
|
||||
+#include "specs_api.h"
|
||||
|
||||
/* restore supervisor */
|
||||
static int restore_supervisor(const container_t *cont)
|
||||
@@ -55,9 +58,7 @@ static int restore_supervisor(const container_t *cont)
|
||||
char *exit_fifo = NULL;
|
||||
char *id = cont->common_config->id;
|
||||
char *statepath = cont->state_path;
|
||||
- char *runtime = cont->runtime;
|
||||
pid_ppid_info_t pid_info = { 0 };
|
||||
- bool sandbox_container = false;
|
||||
|
||||
nret = snprintf(container_state, sizeof(container_state), "%s/%s", statepath, id);
|
||||
if (nret < 0 || (size_t)nret >= sizeof(container_state)) {
|
||||
@@ -91,11 +92,8 @@ static int restore_supervisor(const container_t *cont)
|
||||
pid_info.ppid = cont->state->state->p_pid;
|
||||
pid_info.start_time = cont->state->state->start_time;
|
||||
pid_info.pstart_time = cont->state->state->p_start_time;
|
||||
-#ifdef ENABLE_CRI_API_V1
|
||||
- sandbox_container = is_sandbox_container(cont->common_config->sandbox_info);
|
||||
-#endif
|
||||
|
||||
- if (container_supervisor_add_exit_monitor(exit_fifo_fd, &pid_info, id, runtime, sandbox_container)) {
|
||||
+ if (container_supervisor_add_exit_monitor(exit_fifo_fd, exit_fifo, &pid_info, cont)) {
|
||||
ERROR("Failed to add exit monitor to supervisor");
|
||||
ret = -1;
|
||||
goto out;
|
||||
diff --git a/src/daemon/modules/container/supervisor/supervisor.c b/src/daemon/modules/container/supervisor/supervisor.c
|
||||
index 63289283..1b7da383 100644
|
||||
--- a/src/daemon/modules/container/supervisor/supervisor.c
|
||||
+++ b/src/daemon/modules/container/supervisor/supervisor.c
|
||||
@@ -41,6 +41,8 @@
|
||||
#ifdef ENABLE_CRI_API_V1
|
||||
#include "sandbox_ops.h"
|
||||
#endif
|
||||
+#include "cgroup.h"
|
||||
+#include "specs_api.h"
|
||||
|
||||
pthread_mutex_t g_supervisor_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
struct epoll_descr g_supervisor_descr;
|
||||
@@ -269,24 +271,52 @@ static int supervisor_exit_cb(int fd, uint32_t events, void *cbdata, struct epol
|
||||
return EPOLL_LOOP_HANDLE_CONTINUE;
|
||||
}
|
||||
|
||||
+static int oom_handle_cb(int fd, uint32_t events, void *cbdata, struct epoll_descr *descr)
|
||||
+{
|
||||
+ cgroup_oom_handler_info_t *oom_handler_info = (cgroup_oom_handler_info_t *)cbdata;
|
||||
+ bool close_oom_handler = CGROUP_OOM_HANDLE_CLOSE;
|
||||
+ // supervisor only handle one oom event, so we remove the handler directly
|
||||
+ if (oom_handler_info != NULL && oom_handler_info->oom_event_handler != NULL) {
|
||||
+ close_oom_handler = oom_handler_info->oom_event_handler(fd, oom_handler_info);
|
||||
+ }
|
||||
+
|
||||
+ if (close_oom_handler == CGROUP_OOM_HANDLE_CLOSE) {
|
||||
+ supervisor_handler_lock();
|
||||
+ epoll_loop_del_handler(&g_supervisor_descr, fd);
|
||||
+ supervisor_handler_unlock();
|
||||
+
|
||||
+ common_free_cgroup_oom_handler_info(oom_handler_info);
|
||||
+ }
|
||||
+
|
||||
+ return EPOLL_LOOP_HANDLE_CONTINUE;
|
||||
+}
|
||||
+
|
||||
/* supervisor add exit monitor */
|
||||
-int container_supervisor_add_exit_monitor(int fd, const pid_ppid_info_t *pid_info, const char *name,
|
||||
- const char *runtime, bool sandbox_container)
|
||||
+int container_supervisor_add_exit_monitor(int fd, const char *exit_fifo, const pid_ppid_info_t *pid_info, const container_t *cont)
|
||||
{
|
||||
int ret = 0;
|
||||
struct supervisor_handler_data *data = NULL;
|
||||
+ cgroup_oom_handler_info_t *oom_handler_info = NULL;
|
||||
+ __isula_auto_free char *cgroup_path = NULL;
|
||||
|
||||
if (fd < 0) {
|
||||
ERROR("Invalid exit fifo fd");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (pid_info == NULL || name == NULL || runtime == NULL) {
|
||||
+ if (pid_info == NULL || cont == NULL || cont->common_config == NULL) {
|
||||
ERROR("Invalid input arguments");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ cgroup_path = merge_container_cgroups_path(cont->common_config->id, cont->hostconfig);
|
||||
+ if (cgroup_path == NULL) {
|
||||
+ ERROR("Failed to get cgroup path");
|
||||
+ close(fd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
data = util_common_calloc_s(sizeof(struct supervisor_handler_data));
|
||||
if (data == NULL) {
|
||||
ERROR("Memory out");
|
||||
@@ -295,15 +325,26 @@ int container_supervisor_add_exit_monitor(int fd, const pid_ppid_info_t *pid_inf
|
||||
}
|
||||
|
||||
data->fd = fd;
|
||||
- data->name = util_strdup_s(name);
|
||||
- data->runtime = util_strdup_s(runtime);
|
||||
- data->is_sandbox_container = sandbox_container;
|
||||
+ data->name = util_strdup_s(cont->common_config->id);
|
||||
+ data->runtime = util_strdup_s(cont->runtime);
|
||||
+#ifdef ENABLE_CRI_API_V1
|
||||
+ data->is_sandbox_container = is_sandbox_container(cont->common_config->sandbox_info);
|
||||
+#endif
|
||||
data->pid_info.pid = pid_info->pid;
|
||||
data->pid_info.start_time = pid_info->start_time;
|
||||
data->pid_info.ppid = pid_info->ppid;
|
||||
data->pid_info.pstart_time = pid_info->pstart_time;
|
||||
+ oom_handler_info = common_get_cgroup_oom_handler(fd, cont->common_config->id, cgroup_path, exit_fifo);
|
||||
|
||||
supervisor_handler_lock();
|
||||
+ if (oom_handler_info != NULL) {
|
||||
+ ret = epoll_loop_add_handler(&g_supervisor_descr, oom_handler_info->oom_event_fd, oom_handle_cb, oom_handler_info);
|
||||
+ if (ret != 0) {
|
||||
+ ERROR("Failed to add handler for oom event");
|
||||
+ goto err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ret = epoll_loop_add_handler(&g_supervisor_descr, fd, supervisor_exit_cb, data);
|
||||
if (ret != 0) {
|
||||
ERROR("Failed to add handler for exit fifo");
|
||||
@@ -314,6 +355,7 @@ int container_supervisor_add_exit_monitor(int fd, const pid_ppid_info_t *pid_inf
|
||||
|
||||
err:
|
||||
supervisor_handler_data_free(data);
|
||||
+ common_free_cgroup_oom_handler_info(oom_handler_info);
|
||||
out:
|
||||
supervisor_handler_unlock();
|
||||
return ret;
|
||||
diff --git a/src/daemon/modules/events/collector.c b/src/daemon/modules/events/collector.c
|
||||
index fb4a7fea..af688742 100644
|
||||
--- a/src/daemon/modules/events/collector.c
|
||||
+++ b/src/daemon/modules/events/collector.c
|
||||
@@ -133,6 +133,9 @@ static container_events_type_t lcrsta2Evetype(int value)
|
||||
case THAWED:
|
||||
et = EVENTS_TYPE_THAWED;
|
||||
break;
|
||||
+ case OOM:
|
||||
+ et = EVENTS_TYPE_OOM;
|
||||
+ break;
|
||||
default:
|
||||
et = EVENTS_TYPE_EXIT;
|
||||
break;
|
||||
@@ -822,8 +825,8 @@ static int post_event_to_events_hander(const struct isulad_events_format *events
|
||||
return -1;
|
||||
}
|
||||
|
||||
- /* only post STOPPED event to events_hander */
|
||||
- if (events->type != EVENTS_TYPE_STOPPED1) {
|
||||
+ /* only post STOPPED event and OOM event to events_hander */
|
||||
+ if (events->type != EVENTS_TYPE_STOPPED1 && events->type != EVENTS_TYPE_OOM) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c
|
||||
index a8090d5a..eb7ce4f4 100644
|
||||
--- a/src/daemon/modules/service/service_container.c
|
||||
+++ b/src/daemon/modules/service/service_container.c
|
||||
@@ -275,14 +275,13 @@ static void clean_resources_on_failure(const container_t *cont, const char *engi
|
||||
return;
|
||||
}
|
||||
|
||||
-static int do_post_start_on_success(const char *id, const char *runtime, bool sandbox_container,
|
||||
- const char *pidfile, int exit_fifo_fd,
|
||||
- const pid_ppid_info_t *pid_info)
|
||||
+static int do_post_start_on_success(container_t *cont, int exit_fifo_fd,
|
||||
+ const char *exit_fifo, const pid_ppid_info_t *pid_info)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
// exit_fifo_fd was closed in container_supervisor_add_exit_monitor
|
||||
- if (container_supervisor_add_exit_monitor(exit_fifo_fd, pid_info, id, runtime, sandbox_container)) {
|
||||
+ if (container_supervisor_add_exit_monitor(exit_fifo_fd, exit_fifo, pid_info, cont)) {
|
||||
ERROR("Failed to add exit monitor to supervisor");
|
||||
ret = -1;
|
||||
}
|
||||
@@ -750,7 +749,6 @@ static int do_start_container(container_t *cont, const char *console_fifos[], bo
|
||||
oci_runtime_spec *oci_spec = NULL;
|
||||
rt_create_params_t create_params = { 0 };
|
||||
rt_start_params_t start_params = { 0 };
|
||||
- bool sandbox_container = false;
|
||||
|
||||
nret = snprintf(bundle, sizeof(bundle), "%s/%s", cont->root_path, id);
|
||||
if (nret < 0 || (size_t)nret >= sizeof(bundle)) {
|
||||
@@ -899,7 +897,6 @@ static int do_start_container(container_t *cont, const char *console_fifos[], bo
|
||||
if (cont->common_config->sandbox_info != NULL) {
|
||||
create_params.task_addr = cont->common_config->sandbox_info->task_address;
|
||||
}
|
||||
- sandbox_container = is_sandbox_container(cont->common_config->sandbox_info);
|
||||
#endif
|
||||
|
||||
if (runtime_create(id, runtime, &create_params) != 0) {
|
||||
@@ -924,7 +921,7 @@ static int do_start_container(container_t *cont, const char *console_fifos[], bo
|
||||
|
||||
ret = runtime_start(id, runtime, &start_params, pid_info);
|
||||
if (ret == 0) {
|
||||
- if (do_post_start_on_success(id, runtime, sandbox_container, pidfile, exit_fifo_fd, pid_info) != 0) {
|
||||
+ if (do_post_start_on_success(cont, exit_fifo_fd, exit_fifo, pid_info) != 0) {
|
||||
ERROR("Failed to do post start on runtime start success");
|
||||
ret = -1;
|
||||
goto clean_resources;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
279
0036-add-ci-cases-for-oomkilled-monitor.patch
Normal file
279
0036-add-ci-cases-for-oomkilled-monitor.patch
Normal file
@ -0,0 +1,279 @@
|
||||
From 0111a575f829b946068dcb11286f0d84363cfc3d Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Thu, 28 Mar 2024 12:51:53 +0000
|
||||
Subject: [PATCH 36/43] add ci cases for oomkilled monitor
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
CI/test_cases/container_cases/inspect.sh | 14 ++++++++
|
||||
test/cgroup/cpu/CMakeLists.txt | 2 ++
|
||||
.../image/oci/oci_config_merge/CMakeLists.txt | 1 +
|
||||
test/image/oci/registry/CMakeLists.txt | 1 +
|
||||
test/mocks/sender_mock.cc | 34 +++++++++++++++++++
|
||||
test/mocks/sender_mock.h | 31 +++++++++++++++++
|
||||
test/network/network_ns/CMakeLists.txt | 1 +
|
||||
test/runtime/isula/CMakeLists.txt | 1 +
|
||||
test/runtime/lcr/CMakeLists.txt | 1 +
|
||||
test/specs/specs/CMakeLists.txt | 1 +
|
||||
test/specs/specs_extend/CMakeLists.txt | 1 +
|
||||
test/specs/verify/CMakeLists.txt | 1 +
|
||||
test/volume/CMakeLists.txt | 3 +-
|
||||
13 files changed, 91 insertions(+), 1 deletion(-)
|
||||
create mode 100644 test/mocks/sender_mock.cc
|
||||
create mode 100644 test/mocks/sender_mock.h
|
||||
|
||||
diff --git a/CI/test_cases/container_cases/inspect.sh b/CI/test_cases/container_cases/inspect.sh
|
||||
index cde9ea1f..b4f4a785 100755
|
||||
--- a/CI/test_cases/container_cases/inspect.sh
|
||||
+++ b/CI/test_cases/container_cases/inspect.sh
|
||||
@@ -27,6 +27,7 @@ function test_inspect_spec()
|
||||
{
|
||||
local ret=0
|
||||
local image="busybox"
|
||||
+ local ubuntu_image="ubuntu"
|
||||
local test="container inspect test => (${FUNCNAME[@]})"
|
||||
|
||||
msg_info "${test} starting..."
|
||||
@@ -37,6 +38,12 @@ function test_inspect_spec()
|
||||
isula images | grep busybox
|
||||
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
|
||||
|
||||
+ isula pull ${ubuntu_image}
|
||||
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${ubuntu_image}" && return ${FAILURE}
|
||||
+
|
||||
+ isula images | grep ubuntu
|
||||
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${ubuntu_image}" && ((ret++))
|
||||
+
|
||||
containername=test_inspect
|
||||
|
||||
isula create --name $containername --ipc host --pid host --uts host --restart=on-failure:10 --hook-spec ${test_data_path}/test-hookspec.json --cpu-shares 100 --memory 5MB --memory-reservation 4MB --cpu-period 1000000 --cpu-quota 200000 --cpuset-cpus 1 --cpuset-mems 0 --kernel-memory 50M --pids-limit=10000 --volume /home:/root --env a=1 $image /bin/sh ls
|
||||
@@ -139,6 +146,13 @@ function test_inspect_spec()
|
||||
|
||||
isula rm -f $containername
|
||||
|
||||
+ isula run -it -m 4m --name $containername $ubuntu_image perl -e 'for ($i = 0; $i < 100000000; $i++) { $a .= " " x 1024 }'
|
||||
+
|
||||
+ isula inspect -f "{{json .State.OOMKilled}} {{.Name}}" $containername 2>&1 | sed -n '1p' | grep "true"
|
||||
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check container with image: ${ubuntu_image}" && ((ret++))
|
||||
+
|
||||
+ isula rm -f $containername
|
||||
+
|
||||
msg_info "${test} finished with return ${ret}..."
|
||||
return ${ret}
|
||||
}
|
||||
diff --git a/test/cgroup/cpu/CMakeLists.txt b/test/cgroup/cpu/CMakeLists.txt
|
||||
index 30bfc417..9c3cfa12 100644
|
||||
--- a/test/cgroup/cpu/CMakeLists.txt
|
||||
+++ b/test/cgroup/cpu/CMakeLists.txt
|
||||
@@ -13,6 +13,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/command_parser.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/daemon_arguments.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
cgroup_cpu_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
@@ -23,6 +24,7 @@ target_include_directories(${EXE} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common/cgroup
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/api
|
||||
${CMAKE_BINARY_DIR}/conf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/config
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd
|
||||
diff --git a/test/image/oci/oci_config_merge/CMakeLists.txt b/test/image/oci/oci_config_merge/CMakeLists.txt
|
||||
index d13ec738..ffd3999d 100644
|
||||
--- a/test/image/oci/oci_config_merge/CMakeLists.txt
|
||||
+++ b/test/image/oci/oci_config_merge/CMakeLists.txt
|
||||
@@ -35,6 +35,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/containers_store_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/namespace_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/container_unix_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/sender_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/spec/parse_volume.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/spec/specs.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/spec/parse_volume.c
|
||||
diff --git a/test/image/oci/registry/CMakeLists.txt b/test/image/oci/registry/CMakeLists.txt
|
||||
index 5b5bc3f5..6166c2d0 100644
|
||||
--- a/test/image/oci/registry/CMakeLists.txt
|
||||
+++ b/test/image/oci/registry/CMakeLists.txt
|
||||
@@ -44,6 +44,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/storage_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/oci_image_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/http_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/sender_mock.cc
|
||||
registry_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/mocks/sender_mock.cc b/test/mocks/sender_mock.cc
|
||||
new file mode 100644
|
||||
index 00000000..26028d7f
|
||||
--- /dev/null
|
||||
+++ b/test/mocks/sender_mock.cc
|
||||
@@ -0,0 +1,34 @@
|
||||
+/******************************************************************************
|
||||
+ * Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
+ * iSulad licensed under the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
+ * PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ * Author: jikai
|
||||
+ * Create: 2024-03-29
|
||||
+ * Description: provide collector mock
|
||||
+ ******************************************************************************/
|
||||
+
|
||||
+#include "sender_mock.h"
|
||||
+
|
||||
+namespace {
|
||||
+MockEventSender *g_sender_mock = nullptr;
|
||||
+}
|
||||
+
|
||||
+void MockEventSender_SetMock(MockEventSender *mock)
|
||||
+{
|
||||
+ g_sender_mock = mock;
|
||||
+}
|
||||
+
|
||||
+int isulad_monitor_send_container_event(const char *name, runtime_state_t state, int pid, int exit_code,
|
||||
+ const char *args, const char *extra_annations)
|
||||
+{
|
||||
+ if (g_sender_mock != nullptr) {
|
||||
+ return g_sender_mock->IsuladMonitorEventSendContainerEvent(name, state, pid, exit_code, args, extra_annations);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/test/mocks/sender_mock.h b/test/mocks/sender_mock.h
|
||||
new file mode 100644
|
||||
index 00000000..f4fe75f0
|
||||
--- /dev/null
|
||||
+++ b/test/mocks/sender_mock.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+/******************************************************************************
|
||||
+ * Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
|
||||
+ * iSulad licensed under the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You may obtain a copy of Mulan PSL v2 at:
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
+ * PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ * Author: jikai
|
||||
+ * Create: 2024-03-30
|
||||
+ * Description: provide sender mock
|
||||
+ ******************************************************************************/
|
||||
+
|
||||
+#ifndef _ISULAD_TEST_MOCKS_SENDER_MOCK_H
|
||||
+#define _ISULAD_TEST_MOCKS_SENDER_MOCK_H
|
||||
+
|
||||
+#include <gmock/gmock.h>
|
||||
+#include "events_sender_api.h"
|
||||
+
|
||||
+class MockEventSender {
|
||||
+public:
|
||||
+ MOCK_METHOD6(IsuladMonitorEventSendContainerEvent, int(const char *name, runtime_state_t state, int pid, int exit_code,
|
||||
+ const char *args, const char *extra_annations));
|
||||
+};
|
||||
+
|
||||
+void MockEventSender_SetMock(MockEventSender *mock);
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
diff --git a/test/network/network_ns/CMakeLists.txt b/test/network/network_ns/CMakeLists.txt
|
||||
index 71b8039d..6f3f36a0 100644
|
||||
--- a/test/network/network_ns/CMakeLists.txt
|
||||
+++ b/test/network/network_ns/CMakeLists.txt
|
||||
@@ -43,6 +43,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/selinux_label_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/storage_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
network_ns_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/runtime/isula/CMakeLists.txt b/test/runtime/isula/CMakeLists.txt
|
||||
index c1f0a5cc..15636623 100644
|
||||
--- a/test/runtime/isula/CMakeLists.txt
|
||||
+++ b/test/runtime/isula/CMakeLists.txt
|
||||
@@ -31,6 +31,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime/isula/isula_rt_ops.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
isula_rt_ops_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/runtime/lcr/CMakeLists.txt b/test/runtime/lcr/CMakeLists.txt
|
||||
index c3b93d67..5b2ed11a 100644
|
||||
--- a/test/runtime/lcr/CMakeLists.txt
|
||||
+++ b/test/runtime/lcr/CMakeLists.txt
|
||||
@@ -29,6 +29,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/namespace_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/container_unix_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
|
||||
lcr_rt_ops_ut.cc)
|
||||
diff --git a/test/specs/specs/CMakeLists.txt b/test/specs/specs/CMakeLists.txt
|
||||
index 45f688f9..12c11f51 100644
|
||||
--- a/test/specs/specs/CMakeLists.txt
|
||||
+++ b/test/specs/specs/CMakeLists.txt
|
||||
@@ -43,6 +43,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/storage_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/image_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
specs_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/specs/specs_extend/CMakeLists.txt b/test/specs/specs_extend/CMakeLists.txt
|
||||
index 1b737089..2fd37e1c 100644
|
||||
--- a/test/specs/specs_extend/CMakeLists.txt
|
||||
+++ b/test/specs/specs_extend/CMakeLists.txt
|
||||
@@ -43,6 +43,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/storage_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/image_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
specs_extend_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/specs/verify/CMakeLists.txt b/test/specs/verify/CMakeLists.txt
|
||||
index b0602127..7f000cd1 100644
|
||||
--- a/test/specs/verify/CMakeLists.txt
|
||||
+++ b/test/specs/verify/CMakeLists.txt
|
||||
@@ -38,6 +38,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/storage_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/image_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/storage_mock.cc
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/sender_mock.cc
|
||||
verify_ut.cc)
|
||||
|
||||
target_include_directories(${EXE} PUBLIC
|
||||
diff --git a/test/volume/CMakeLists.txt b/test/volume/CMakeLists.txt
|
||||
index 27d07330..1f9dac03 100644
|
||||
--- a/test/volume/CMakeLists.txt
|
||||
+++ b/test/volume/CMakeLists.txt
|
||||
@@ -24,6 +24,7 @@ add_executable(${EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/common/cgroup/cgroup_v1.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/common/cgroup/cgroup_v2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/common/cgroup/cgroup_common.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../test/mocks/sender_mock.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/cmd/command_parser.c
|
||||
volume_ut.cc)
|
||||
|
||||
@@ -43,6 +44,6 @@ target_include_directories(${EXE} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/console
|
||||
)
|
||||
|
||||
-target_link_libraries(${EXE} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} -lcrypto -lyajl -lz)
|
||||
+target_link_libraries(${EXE} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} -lcrypto -lyajl -lz)
|
||||
add_test(NAME ${EXE} COMMAND ${EXE} --gtest_output=xml:${EXE}-Results.xml)
|
||||
set_tests_properties(${EXE} PROPERTIES TIMEOUT 120)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
252
0037-add-cgroup-v2-doc.patch
Normal file
252
0037-add-cgroup-v2-doc.patch
Normal file
File diff suppressed because one or more lines are too long
27
0038-fix-run-ubuntu-container-bug-in-inspect.sh.patch
Normal file
27
0038-fix-run-ubuntu-container-bug-in-inspect.sh.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 8e1fe0302bf1a871f66a296e456811e878b1fa3b Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 2 Apr 2024 10:06:18 +0800
|
||||
Subject: [PATCH 38/43] fix run ubuntu container bug in inspect.sh
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
CI/test_cases/container_cases/inspect.sh | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CI/test_cases/container_cases/inspect.sh b/CI/test_cases/container_cases/inspect.sh
|
||||
index b4f4a785..86aed3d8 100755
|
||||
--- a/CI/test_cases/container_cases/inspect.sh
|
||||
+++ b/CI/test_cases/container_cases/inspect.sh
|
||||
@@ -146,7 +146,8 @@ function test_inspect_spec()
|
||||
|
||||
isula rm -f $containername
|
||||
|
||||
- isula run -it -m 4m --name $containername $ubuntu_image perl -e 'for ($i = 0; $i < 100000000; $i++) { $a .= " " x 1024 }'
|
||||
+ # use more than 10m memory limit, otherwise it might fail to run
|
||||
+ isula run -it -m 10m --name $containername $ubuntu_image perl -e 'for ($i = 0; $i < 100000000; $i++) { $a .= " " x 1024 }'
|
||||
|
||||
isula inspect -f "{{json .State.OOMKilled}} {{.Name}}" $containername 2>&1 | sed -n '1p' | grep "true"
|
||||
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check container with image: ${ubuntu_image}" && ((ret++))
|
||||
--
|
||||
2.34.1
|
||||
|
||||
2601
0039-add-support-for-GetContainerEvents.patch
Normal file
2601
0039-add-support-for-GetContainerEvents.patch
Normal file
File diff suppressed because it is too large
Load Diff
74
0040-fix-cpurt-init-bug-for-systemd-cgroup.patch
Normal file
74
0040-fix-cpurt-init-bug-for-systemd-cgroup.patch
Normal file
@ -0,0 +1,74 @@
|
||||
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
|
||||
|
||||
41
0041-fix-message-queue-concurrent-bug.patch
Normal file
41
0041-fix-message-queue-concurrent-bug.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From f90a145d9d29682295aebf2bcd30865ee5f6491f Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 2 Apr 2024 07:53:54 +0000
|
||||
Subject: [PATCH 41/43] fix message queue concurrent bug
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
src/daemon/mailbox/message_queue.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/mailbox/message_queue.c b/src/daemon/mailbox/message_queue.c
|
||||
index 7fe044f2..7e53301e 100644
|
||||
--- a/src/daemon/mailbox/message_queue.c
|
||||
+++ b/src/daemon/mailbox/message_queue.c
|
||||
@@ -106,11 +106,12 @@ message_queue *message_queue_create(void (*release)(void *))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- bq = blocking_queue_create(BLOCKING_QUEUE_NO_TIMEOUT, release);
|
||||
- if (bq == NULL) {
|
||||
+ mq->messages = blocking_queue_create(BLOCKING_QUEUE_NO_TIMEOUT, release);
|
||||
+ if (mq->messages == NULL) {
|
||||
ERROR("Failed to create events queue");
|
||||
return NULL;
|
||||
}
|
||||
+ bq = mq->messages;
|
||||
|
||||
mq->subscribers = map_new(MAP_PTR_INT, MAP_DEFAULT_CMP_FUNC, message_queue_subscriber_free);
|
||||
if (mq->subscribers == NULL) {
|
||||
@@ -131,7 +132,7 @@ message_queue *message_queue_create(void (*release)(void *))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- mq->messages = isula_transfer_ptr(bq);
|
||||
+ bq = NULL;
|
||||
return isula_transfer_ptr(mq);
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
26
0042-specify-runtime-as-runc-for-oom-test-CI.patch
Normal file
26
0042-specify-runtime-as-runc-for-oom-test-CI.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 7af700c4021ef9961aaac37ffa5767bd4f3dd184 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 2 Apr 2024 08:00:37 +0000
|
||||
Subject: [PATCH 42/43] specify runtime as runc for oom test CI
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
CI/test_cases/container_cases/inspect.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CI/test_cases/container_cases/inspect.sh b/CI/test_cases/container_cases/inspect.sh
|
||||
index 86aed3d8..5d976281 100755
|
||||
--- a/CI/test_cases/container_cases/inspect.sh
|
||||
+++ b/CI/test_cases/container_cases/inspect.sh
|
||||
@@ -147,7 +147,7 @@ function test_inspect_spec()
|
||||
isula rm -f $containername
|
||||
|
||||
# use more than 10m memory limit, otherwise it might fail to run
|
||||
- isula run -it -m 10m --name $containername $ubuntu_image perl -e 'for ($i = 0; $i < 100000000; $i++) { $a .= " " x 1024 }'
|
||||
+ isula run -it -m 10m --runtime runc --name $containername $ubuntu_image perl -e 'for ($i = 0; $i < 100000000; $i++) { $a .= " " x 1024 }'
|
||||
|
||||
isula inspect -f "{{json .State.OOMKilled}} {{.Name}}" $containername 2>&1 | sed -n '1p' | grep "true"
|
||||
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check container with image: ${ubuntu_image}" && ((ret++))
|
||||
--
|
||||
2.34.1
|
||||
|
||||
27
0043-set-oomkilled-in-cri.patch
Normal file
27
0043-set-oomkilled-in-cri.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 5393ce7d02bb73ce4760edefa959dfb4846f1958 Mon Sep 17 00:00:00 2001
|
||||
From: jikai <jikai11@huawei.com>
|
||||
Date: Tue, 2 Apr 2024 11:19:06 +0000
|
||||
Subject: [PATCH 43/43] set oomkilled in cri
|
||||
|
||||
Signed-off-by: jikai <jikai11@huawei.com>
|
||||
---
|
||||
src/daemon/common/cri/v1/v1_cri_helpers.cc | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/daemon/common/cri/v1/v1_cri_helpers.cc b/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||||
index a3488894..ea5c8bb5 100644
|
||||
--- a/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||||
+++ b/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||||
@@ -506,6 +506,9 @@ void UpdateBaseStatusFromInspect(
|
||||
} else { // Case 3
|
||||
state = runtime::v1::CONTAINER_CREATED;
|
||||
}
|
||||
+ if (inspect->state->oom_killed == true) {
|
||||
+ reason = "OOMKilled";
|
||||
+ }
|
||||
if (inspect->state->error != nullptr) {
|
||||
message = inspect->state->error;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
17
iSulad.spec
17
iSulad.spec
@ -1,5 +1,5 @@
|
||||
%global _version 2.1.5
|
||||
%global _release 3
|
||||
%global _release 4
|
||||
%global is_systemd 1
|
||||
%global enable_criv1 1
|
||||
%global enable_shimv2 1
|
||||
@ -49,6 +49,15 @@ Patch0031: 0031-cgroup-v2-does-not-support-isulad-setting-cpu_rt-opt.patch
|
||||
Patch0032: 0032-add-test-that-isulad-cannot-set-cpu_rt-parameters-wh.patch
|
||||
Patch0033: 0033-fix-sandbox-container-bool-value-uninitialized.patch
|
||||
Patch0034: 0034-bugfix-for-cpurt.sh.patch
|
||||
Patch0035: 0035-monitor-cgroup-oom-killed-event-and-update-to-cri-of.patch
|
||||
Patch0036: 0036-add-ci-cases-for-oomkilled-monitor.patch
|
||||
Patch0037: 0037-add-cgroup-v2-doc.patch
|
||||
Patch0038: 0038-fix-run-ubuntu-container-bug-in-inspect.sh.patch
|
||||
Patch0039: 0039-add-support-for-GetContainerEvents.patch
|
||||
Patch0040: 0040-fix-cpurt-init-bug-for-systemd-cgroup.patch
|
||||
Patch0041: 0041-fix-message-queue-concurrent-bug.patch
|
||||
Patch0042: 0042-specify-runtime-as-runc-for-oom-test-CI.patch
|
||||
Patch0043: 0043-set-oomkilled-in-cri.patch
|
||||
|
||||
%ifarch x86_64 aarch64
|
||||
Provides: libhttpclient.so()(64bit)
|
||||
@ -303,6 +312,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Apr 02 2024 jikai <jikai11@huawei.com> - 2.1.5-4
|
||||
- Type: update
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: upgrade from upstream
|
||||
|
||||
* Sat Mar 30 2024 zhongtao <zhongtao17@huawei.com> - 2.1.5-3
|
||||
- Type: update
|
||||
- ID: NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user