!83 update from openeuler
From: @gaohuatao Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
fbdccc8407
@ -0,0 +1,25 @@
|
|||||||
|
From c3013bfda83f3bcdcf518f29ad942bd99b4a356c Mon Sep 17 00:00:00 2001
|
||||||
|
From: chengzrz <czrzrichard@gmail.com>
|
||||||
|
Date: Thu, 28 Oct 2021 03:18:15 -0400
|
||||||
|
Subject: [PATCH 1/2] modified ipconfig.json to adapt to newest version of cni
|
||||||
|
plugins
|
||||||
|
|
||||||
|
---
|
||||||
|
src/json/schema/cni/network/ipconfig.json | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/json/schema/cni/network/ipconfig.json b/src/json/schema/cni/network/ipconfig.json
|
||||||
|
index 4854118..9f3a2fe 100644
|
||||||
|
--- a/src/json/schema/cni/network/ipconfig.json
|
||||||
|
+++ b/src/json/schema/cni/network/ipconfig.json
|
||||||
|
@@ -16,7 +16,6 @@
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
- "version",
|
||||||
|
"address"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
From 1b25d3822a3794e7edfaeec14628b1f5c0b1089b Mon Sep 17 00:00:00 2001
|
|
||||||
From: haozi007 <liuhao27@huawei.com>
|
|
||||||
Date: Sat, 30 Jan 2021 14:30:55 +0800
|
|
||||||
Subject: [PATCH 1/2] support quiet of log config
|
|
||||||
|
|
||||||
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
|
||||||
---
|
|
||||||
tests/log_ut.cpp | 8 ++++----
|
|
||||||
third_party/log.c | 17 ++++++++---------
|
|
||||||
2 files changed, 12 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/log_ut.cpp b/tests/log_ut.cpp
|
|
||||||
index 3694160..8cf6599 100644
|
|
||||||
--- a/tests/log_ut.cpp
|
|
||||||
+++ b/tests/log_ut.cpp
|
|
||||||
@@ -40,18 +40,18 @@ TEST(log_testcases, test_isula_libutils_default_log_config)
|
|
||||||
isula_libutils_default_log_config(name, &tconf);
|
|
||||||
|
|
||||||
ASSERT_EQ(tconf.file, nullptr);
|
|
||||||
- ASSERT_EQ(tconf.driver, nullptr);
|
|
||||||
+ EXPECT_STREQ(tconf.driver, ISULA_LOG_DRIVER_STDOUT);
|
|
||||||
EXPECT_STREQ(name, tconf.name);
|
|
||||||
- EXPECT_STREQ("FATAL", tconf.priority);
|
|
||||||
+ EXPECT_STREQ("DEBUG", tconf.priority);
|
|
||||||
|
|
||||||
// not quiet configs check
|
|
||||||
tconf.quiet = false;
|
|
||||||
isula_libutils_default_log_config(name, &tconf);
|
|
||||||
|
|
||||||
ASSERT_EQ(tconf.file, nullptr);
|
|
||||||
- ASSERT_NE(tconf.driver, nullptr);
|
|
||||||
+ EXPECT_STREQ(tconf.driver, ISULA_LOG_DRIVER_STDOUT);
|
|
||||||
EXPECT_STREQ(name, tconf.name);
|
|
||||||
- EXPECT_STREQ(ISULA_LOG_DRIVER_STDOUT, tconf.driver);
|
|
||||||
+ EXPECT_STREQ("DEBUG", tconf.priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void check_log(int fd, bool exist, bool subcheck, const char *target)
|
|
||||||
diff --git a/third_party/log.c b/third_party/log.c
|
|
||||||
index 83de005..2fcb014 100644
|
|
||||||
--- a/third_party/log.c
|
|
||||||
+++ b/third_party/log.c
|
|
||||||
@@ -79,11 +79,9 @@ void isula_libutils_default_log_config(const char *name, struct isula_libutils_l
|
|
||||||
{
|
|
||||||
log->name = name;
|
|
||||||
log->file = NULL;
|
|
||||||
- // use to disable log
|
|
||||||
- log->priority = "FATAL";
|
|
||||||
- if (!log->quiet) {
|
|
||||||
- log->driver = ISULA_LOG_DRIVER_STDOUT;
|
|
||||||
- }
|
|
||||||
+ log->priority = "DEBUG";
|
|
||||||
+ log->quiet = true;
|
|
||||||
+ log->driver = ISULA_LOG_DRIVER_STDOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void isula_libutils_set_log_prefix(const char *prefix)
|
|
||||||
@@ -103,9 +101,6 @@ void isula_libutils_free_log_prefix(void)
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static int log_append_stderr(const struct lxc_log_appender *appender, struct lxc_log_event *event)
|
|
||||||
{
|
|
||||||
- if (event->priority < LXC_LOG_LEVEL_ERROR)
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
if (event->locinfo->file == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -410,6 +405,11 @@ int isula_libutils_log_enable(const struct isula_libutils_log_config *log)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (log->quiet) {
|
|
||||||
+ g_lxc_log_category_lxc.priority = LXC_LOG_LEVEL_FATAL;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!choice_log_driver(log)) {
|
|
||||||
COMMAND_ERROR("Invalid log config of driver");
|
|
||||||
return -1;
|
|
||||||
@@ -422,7 +422,6 @@ int isula_libutils_log_enable(const struct isula_libutils_log_config *log)
|
|
||||||
|
|
||||||
isula_libutils_set_log_prefix(log->prefix != NULL ? log->prefix : log->name);
|
|
||||||
|
|
||||||
-
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
58
0002-disable-lxc_keep-with-oci-image.patch
Normal file
58
0002-disable-lxc_keep-with-oci-image.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 409f5bf06e782fe5cbcf01e463b114c973b33dcb Mon Sep 17 00:00:00 2001
|
||||||
|
From: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
Date: Thu, 21 Oct 2021 12:11:00 +0800
|
||||||
|
Subject: [PATCH 2/2] disable lxc_keep with oci image
|
||||||
|
|
||||||
|
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
---
|
||||||
|
src/lcrcontainer.h | 1 +
|
||||||
|
src/lcrcontainer_execute.c | 13 +++++++++++++
|
||||||
|
2 files changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/lcrcontainer.h b/src/lcrcontainer.h
|
||||||
|
index ecf3655..062d681 100644
|
||||||
|
--- a/src/lcrcontainer.h
|
||||||
|
+++ b/src/lcrcontainer.h
|
||||||
|
@@ -201,6 +201,7 @@ struct lcr_start_request {
|
||||||
|
uint32_t start_timeout;
|
||||||
|
const char *container_pidfile;
|
||||||
|
const char *exit_fifo;
|
||||||
|
+ bool image_type_oci;
|
||||||
|
};
|
||||||
|
bool lcr_start(const struct lcr_start_request *request);
|
||||||
|
|
||||||
|
diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c
|
||||||
|
index 4c8e0e6..d04a467 100644
|
||||||
|
--- a/src/lcrcontainer_execute.c
|
||||||
|
+++ b/src/lcrcontainer_execute.c
|
||||||
|
@@ -966,7 +966,9 @@ void execute_lxc_start(const char *name, const char *path, const struct lcr_star
|
||||||
|
{
|
||||||
|
// should check the size of params when add new params.
|
||||||
|
char *params[PARAM_NUM] = {NULL};
|
||||||
|
+ char buf[PARAM_NUM] = { 0 };
|
||||||
|
size_t i = 0;
|
||||||
|
+ int nret = 0;
|
||||||
|
|
||||||
|
if (lcr_util_check_inherited(true, -1) != 0) {
|
||||||
|
COMMAND_ERROR("Close inherited fds failed");
|
||||||
|
@@ -983,6 +985,17 @@ void execute_lxc_start(const char *name, const char *path, const struct lcr_star
|
||||||
|
add_array_kv(params, PARAM_NUM, &i, "--in-fifo", request->console_fifos[0]);
|
||||||
|
add_array_kv(params, PARAM_NUM, &i, "--out-fifo", request->console_fifos[1]);
|
||||||
|
add_array_kv(params, PARAM_NUM, &i, "--err-fifo", request->console_fifos[2]);
|
||||||
|
+
|
||||||
|
+ nret = snprintf(buf, sizeof(buf), "%s=true", LXC_IMAGE_OCI_KEY);
|
||||||
|
+ if (nret < 0 || (size_t)nret >= sizeof(buf)) {
|
||||||
|
+ COMMAND_ERROR("Format KEY=VAL of image type error");
|
||||||
|
+ exit(EXIT_FAILURE);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (request->image_type_oci) {
|
||||||
|
+ add_array_kv(params, PARAM_NUM, &i, "-s", buf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (!request->tty) {
|
||||||
|
add_array_elem(params, PARAM_NUM, &i, "--disable-pty");
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
From 7129e7bc07005452f1b965e206e56134c1119a04 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Li Feng <lifeng2221dd1@zoho.com.cn>
|
|
||||||
Date: Thu, 28 Jan 2021 19:17:22 +0800
|
|
||||||
Subject: [PATCH 2/2] lcr: add inactive file total metric
|
|
||||||
|
|
||||||
Signed-off-by: Li Feng <lifeng2221dd1@zoho.com.cn>
|
|
||||||
---
|
|
||||||
src/json/schema/container/info.json | 3 +++
|
|
||||||
src/lcrcontainer.h | 1 +
|
|
||||||
src/lcrcontainer_execute.c | 1 +
|
|
||||||
3 files changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/json/schema/container/info.json b/src/json/schema/container/info.json
|
|
||||||
index e554556..8ce10af 100644
|
|
||||||
--- a/src/json/schema/container/info.json
|
|
||||||
+++ b/src/json/schema/container/info.json
|
|
||||||
@@ -55,6 +55,9 @@
|
|
||||||
},
|
|
||||||
"cache_total": {
|
|
||||||
"type": "uint64"
|
|
||||||
+ },
|
|
||||||
+ "inactive_file_total": {
|
|
||||||
+ "type": "uint64"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/lcrcontainer.h b/src/lcrcontainer.h
|
|
||||||
index 68014ba..dcd1b12 100644
|
|
||||||
--- a/src/lcrcontainer.h
|
|
||||||
+++ b/src/lcrcontainer.h
|
|
||||||
@@ -98,6 +98,7 @@ struct lcr_container_state {
|
|
||||||
/* Cache usage */
|
|
||||||
uint64_t cache;
|
|
||||||
uint64_t cache_total;
|
|
||||||
+ uint64_t inactive_file_total;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c
|
|
||||||
index 2091b49..ab04c7e 100644
|
|
||||||
--- a/src/lcrcontainer_execute.c
|
|
||||||
+++ b/src/lcrcontainer_execute.c
|
|
||||||
@@ -500,6 +500,7 @@ void do_lcr_state(struct lxc_container *c, struct lcr_container_state *lcs)
|
|
||||||
|
|
||||||
lcs->cache = lxc_metrics.cache;
|
|
||||||
lcs->cache_total = lxc_metrics.cache_total;
|
|
||||||
+ lcs->inactive_file_total = lxc_metrics.inactive_file_total;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ExitSignalOffset 128
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
From 60e18350f884ecc995865eb773da7508ec580f49 Mon Sep 17 00:00:00 2001
|
|
||||||
From: jikui <jikui2@huawei.com>
|
|
||||||
Date: Mon, 8 Mar 2021 18:16:12 +0800
|
|
||||||
Subject: [PATCH 03/10] lcr: add default runtime field for isula info
|
|
||||||
|
|
||||||
Signed-off-by: jikui <jikui2@huawei.com>
|
|
||||||
---
|
|
||||||
src/json/schema/host/info-response.json | 6 ++++++
|
|
||||||
1 file changed, 6 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/json/schema/host/info-response.json b/src/json/schema/host/info-response.json
|
|
||||||
index c42fa68..a7482eb 100644
|
|
||||||
--- a/src/json/schema/host/info-response.json
|
|
||||||
+++ b/src/json/schema/host/info-response.json
|
|
||||||
@@ -50,6 +50,12 @@
|
|
||||||
"isulad_root_dir": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
+ "default_runtime": {
|
|
||||||
+ "type": "string"
|
|
||||||
+ },
|
|
||||||
+ "runtimes": {
|
|
||||||
+ "type": "ArrayOfStrings"
|
|
||||||
+ },
|
|
||||||
"total_mem": {
|
|
||||||
"type": "uint32"
|
|
||||||
},
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
From dee153e7de91235ba179378773bc79efd980d344 Mon Sep 17 00:00:00 2001
|
|
||||||
From: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
Date: Thu, 11 Mar 2021 11:20:19 +0800
|
|
||||||
Subject: [PATCH 04/10] support isula exec --workdir
|
|
||||||
|
|
||||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
---
|
|
||||||
src/json/schema/container/exec-request.json | 5 ++++-
|
|
||||||
src/lcrcontainer.h | 1 +
|
|
||||||
src/lcrcontainer_execute.c | 3 +++
|
|
||||||
3 files changed, 8 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/json/schema/container/exec-request.json b/src/json/schema/container/exec-request.json
|
|
||||||
index 1482b55..9c9c0d1 100644
|
|
||||||
--- a/src/json/schema/container/exec-request.json
|
|
||||||
+++ b/src/json/schema/container/exec-request.json
|
|
||||||
@@ -40,6 +40,9 @@
|
|
||||||
},
|
|
||||||
"user": {
|
|
||||||
"type": "string"
|
|
||||||
+ },
|
|
||||||
+ "workdir": {
|
|
||||||
+ "type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-}
|
|
||||||
\ No newline at end of file
|
|
||||||
+}
|
|
||||||
diff --git a/src/lcrcontainer.h b/src/lcrcontainer.h
|
|
||||||
index dcd1b12..ecf3655 100644
|
|
||||||
--- a/src/lcrcontainer.h
|
|
||||||
+++ b/src/lcrcontainer.h
|
|
||||||
@@ -295,6 +295,7 @@ struct lcr_exec_request {
|
|
||||||
|
|
||||||
bool tty;
|
|
||||||
bool open_stdin;
|
|
||||||
+ char *workdir;
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
* Execute process inside a container
|
|
||||||
diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c
|
|
||||||
index ab04c7e..8ea479e 100644
|
|
||||||
--- a/src/lcrcontainer_execute.c
|
|
||||||
+++ b/src/lcrcontainer_execute.c
|
|
||||||
@@ -536,6 +536,9 @@ static void execute_lxc_attach(const char *name, const char *path, const struct
|
|
||||||
add_array_elem(params, args_len, &i, path);
|
|
||||||
add_array_elem(params, args_len, &i, "--clear-env");
|
|
||||||
add_array_elem(params, args_len, &i, "--quiet");
|
|
||||||
+ if (request->workdir != NULL) {
|
|
||||||
+ add_array_kv(params, args_len, &i, "--workdir", request->workdir);
|
|
||||||
+ }
|
|
||||||
add_array_kv(params, args_len, &i, "--logfile", request->logpath);
|
|
||||||
add_array_kv(params, args_len, &i, "-l", request->loglevel);
|
|
||||||
add_array_kv(params, args_len, &i, "--in-fifo", request->console_fifos[0]);
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From 84368fe8c022bd8e0d0d8968bf9325070f677383 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wujing <wujing50@huawei.com>
|
|
||||||
Date: Tue, 16 Mar 2021 09:59:37 +0800
|
|
||||||
Subject: [PATCH 05/10] add secure compile options prohibit rpath options
|
|
||||||
|
|
||||||
Signed-off-by: wujing <wujing50@huawei.com>
|
|
||||||
---
|
|
||||||
lcr.spec | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/lcr.spec b/lcr.spec
|
|
||||||
index 71d6abd..6911cd5 100644
|
|
||||||
--- a/lcr.spec
|
|
||||||
+++ b/lcr.spec
|
|
||||||
@@ -54,7 +54,7 @@ the %{name}-libs package contains libraries for running iSula applications.
|
|
||||||
%build
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
-%cmake -DDEBUG=ON -DENABLE_UT=ON -DLIB_INSTALL_DIR=%{_libdir} ../
|
|
||||||
+%cmake -DDEBUG=ON -DENABLE_UT=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} ../
|
|
||||||
%make_build
|
|
||||||
|
|
||||||
%install
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From fac14fbabd07c587d09cb96ef9ccb663096dca3e Mon Sep 17 00:00:00 2001
|
|
||||||
From: haozi007 <liuhao27@huawei.com>
|
|
||||||
Date: Tue, 23 Mar 2021 10:05:04 +0800
|
|
||||||
Subject: [PATCH 06/10] remove invalid fuzz option
|
|
||||||
|
|
||||||
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
|
||||||
---
|
|
||||||
tests/fuzz/fuzz.sh | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/fuzz/fuzz.sh b/tests/fuzz/fuzz.sh
|
|
||||||
index d71be7c..7513e65 100755
|
|
||||||
--- a/tests/fuzz/fuzz.sh
|
|
||||||
+++ b/tests/fuzz/fuzz.sh
|
|
||||||
@@ -23,7 +23,7 @@
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
LIB_FUZZING_ENGINE="/lib64/libFuzzer.a"
|
|
||||||
-FUZZ_OPTION="corpus -dict=./dict/log_fuzz.dict -runs=10000000 -max_total_time=3600"
|
|
||||||
+FUZZ_OPTION="-dict=./dict/log_fuzz.dict -runs=10000000 -max_total_time=3600"
|
|
||||||
|
|
||||||
if [ ! -f "$LIB_FUZZING_ENGINE" ];then
|
|
||||||
echo "$LIB_FUZZING_ENGINE not exist, pls check"
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,214 +0,0 @@
|
|||||||
From 26f52ea703a5a232de6d1bed5a0cbe9a6aea36d7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
Date: Fri, 2 Apr 2021 16:57:58 +0800
|
|
||||||
Subject: [PATCH 08/10] fix pause container error
|
|
||||||
|
|
||||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
---
|
|
||||||
src/conf.c | 18 +++++++++---------
|
|
||||||
src/lcrcontainer_execute.c | 10 +++++-----
|
|
||||||
src/utils.c | 10 +++++-----
|
|
||||||
src/utils.h | 10 +++++-----
|
|
||||||
4 files changed, 24 insertions(+), 24 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/conf.c b/src/conf.c
|
|
||||||
index d1fd2f3..f2569b3 100644
|
|
||||||
--- a/src/conf.c
|
|
||||||
+++ b/src/conf.c
|
|
||||||
@@ -50,7 +50,7 @@ static int files_limit_checker_v1(const char *value)
|
|
||||||
int ret = 0;
|
|
||||||
int cgroup_version = 0;
|
|
||||||
|
|
||||||
- cgroup_version = get_cgroup_version();
|
|
||||||
+ cgroup_version = lcr_util_get_cgroup_version();
|
|
||||||
if (cgroup_version < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -75,7 +75,7 @@ static int files_limit_checker_v2(const char *value)
|
|
||||||
int ret = 0;
|
|
||||||
int cgroup_version = 0;
|
|
||||||
|
|
||||||
- cgroup_version = get_cgroup_version();
|
|
||||||
+ cgroup_version = lcr_util_get_cgroup_version();
|
|
||||||
if (cgroup_version < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -2044,7 +2044,7 @@ static int trans_resources_mem_swap_v2(const defs_resources *res, struct lcr_lis
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (get_real_swap(res->memory->limit, res->memory->swap, &swap) != 0) {
|
|
||||||
+ if (lcr_util_get_real_swap(res->memory->limit, res->memory->swap, &swap) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2085,7 +2085,7 @@ static int trans_resources_cpu_weight_v2(const defs_resources *res, struct lcr_l
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (trans_conf_int64(conf, "lxc.cgroup2.cpu.weight", trans_cpushare_to_cpuweight(res->cpu->shares)) != 0) {
|
|
||||||
+ if (trans_conf_int64(conf, "lxc.cgroup2.cpu.weight", lcr_util_trans_cpushare_to_cpuweight(res->cpu->shares)) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2176,7 +2176,7 @@ static int trans_io_weight_v2(const defs_resources_block_io *block_io, struct lc
|
|
||||||
size_t len = block_io->weight_device_len;
|
|
||||||
|
|
||||||
if (block_io->weight != INVALID_INT) {
|
|
||||||
- weight = trans_blkio_weight_to_io_weight(block_io->weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_weight(block_io->weight);
|
|
||||||
if (weight < CGROUP2_WEIGHT_MIN || weight > CGROUP2_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %d", block_io->weight);
|
|
||||||
return -1;
|
|
||||||
@@ -2196,7 +2196,7 @@ static int trans_io_weight_v2(const defs_resources_block_io *block_io, struct lc
|
|
||||||
int nret = 0;
|
|
||||||
char buf_value[300] = { 0x00 };
|
|
||||||
|
|
||||||
- weight = trans_blkio_weight_to_io_weight(weight_device[i]->weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_weight(weight_device[i]->weight);
|
|
||||||
if (weight < CGROUP2_WEIGHT_MIN || weight > CGROUP2_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %d", weight_device[i]->weight);
|
|
||||||
return -1;
|
|
||||||
@@ -2227,7 +2227,7 @@ static int trans_io_bfq_weight_v2(const defs_resources_block_io *block_io, struc
|
|
||||||
size_t len = block_io->weight_device_len;
|
|
||||||
|
|
||||||
if (block_io->weight != INVALID_INT) {
|
|
||||||
- weight = trans_blkio_weight_to_io_bfq_weight(block_io->weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_bfq_weight(block_io->weight);
|
|
||||||
if (weight < CGROUP2_BFQ_WEIGHT_MIN || weight > CGROUP2_BFQ_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %d", block_io->weight);
|
|
||||||
return -1;
|
|
||||||
@@ -2247,7 +2247,7 @@ static int trans_io_bfq_weight_v2(const defs_resources_block_io *block_io, struc
|
|
||||||
int nret = 0;
|
|
||||||
char buf_value[300] = { 0x00 };
|
|
||||||
|
|
||||||
- weight = trans_blkio_weight_to_io_weight(weight_device[i]->weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_weight(weight_device[i]->weight);
|
|
||||||
if (weight < CGROUP2_BFQ_WEIGHT_MIN || weight > CGROUP2_BFQ_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %d", weight_device[i]->weight);
|
|
||||||
return -1;
|
|
||||||
@@ -2433,7 +2433,7 @@ static struct lcr_list *trans_oci_resources(const defs_resources *res)
|
|
||||||
{
|
|
||||||
int cgroup_version = 0;
|
|
||||||
|
|
||||||
- cgroup_version = get_cgroup_version();
|
|
||||||
+ cgroup_version = lcr_util_get_cgroup_version();
|
|
||||||
if (cgroup_version < 0) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c
|
|
||||||
index bef787b..4c8e0e6 100644
|
|
||||||
--- a/src/lcrcontainer_execute.c
|
|
||||||
+++ b/src/lcrcontainer_execute.c
|
|
||||||
@@ -199,7 +199,7 @@ static int update_resources_cpu_weight_v2(struct lxc_container *c, const struct
|
|
||||||
}
|
|
||||||
|
|
||||||
int num = snprintf(numstr, sizeof(numstr), "%llu",
|
|
||||||
- (unsigned long long)trans_cpushare_to_cpuweight(cr->cpu_shares));
|
|
||||||
+ (unsigned long long)lcr_util_trans_cpushare_to_cpuweight(cr->cpu_shares));
|
|
||||||
if (num < 0 || (size_t)num >= sizeof(numstr)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -486,7 +486,7 @@ static int update_resources_memory_swap_v2(struct lxc_container *c, const struct
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (get_real_swap(cr->memory_limit, cr->memory_swap, &swap) != 0) {
|
|
||||||
+ if (lcr_util_get_real_swap(cr->memory_limit, cr->memory_swap, &swap) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -637,7 +637,7 @@ static int update_resources_io_weight_v2(struct lxc_container *c, const struct l
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- weight = trans_blkio_weight_to_io_weight(cr->blkio_weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_weight(cr->blkio_weight);
|
|
||||||
if (weight < CGROUP2_WEIGHT_MIN || weight > CGROUP2_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %llu", (unsigned long long) cr->blkio_weight);
|
|
||||||
return -1;
|
|
||||||
@@ -665,7 +665,7 @@ static int update_resources_io_bfq_weight_v2(struct lxc_container *c, const stru
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- weight = trans_blkio_weight_to_io_bfq_weight(cr->blkio_weight);
|
|
||||||
+ weight = lcr_util_trans_blkio_weight_to_io_bfq_weight(cr->blkio_weight);
|
|
||||||
if (weight < CGROUP2_BFQ_WEIGHT_MIN || weight > CGROUP2_BFQ_WEIGHT_MAX) {
|
|
||||||
ERROR("invalid io weight cased by invalid blockio weight %llu", (unsigned long long) cr->blkio_weight);
|
|
||||||
return -1;
|
|
||||||
@@ -693,7 +693,7 @@ static bool update_resources(struct lxc_container *c, struct lcr_cgroup_resource
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- cgroup_version = get_cgroup_version();
|
|
||||||
+ cgroup_version = lcr_util_get_cgroup_version();
|
|
||||||
if (cgroup_version < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
diff --git a/src/utils.c b/src/utils.c
|
|
||||||
index 24dc926..7ee9ba8 100644
|
|
||||||
--- a/src/utils.c
|
|
||||||
+++ b/src/utils.c
|
|
||||||
@@ -1264,7 +1264,7 @@ out:
|
|
||||||
}
|
|
||||||
|
|
||||||
/* swap in oci is memoy+swap, so here we need to get real swap */
|
|
||||||
-int get_real_swap(int64_t memory, int64_t memory_swap, int64_t *swap)
|
|
||||||
+int lcr_util_get_real_swap(int64_t memory, int64_t memory_swap, int64_t *swap)
|
|
||||||
{
|
|
||||||
if (memory == -1 && memory_swap == 0) {
|
|
||||||
*swap = -1; // -1 is max
|
|
||||||
@@ -1295,25 +1295,25 @@ int get_real_swap(int64_t memory, int64_t memory_swap, int64_t *swap)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-int trans_cpushare_to_cpuweight(int64_t cpu_share)
|
|
||||||
+int lcr_util_trans_cpushare_to_cpuweight(int64_t cpu_share)
|
|
||||||
{
|
|
||||||
/* map from range [2-262144] to [1-10000] */
|
|
||||||
return 1 + ((cpu_share - 2) * 9999) / 262142;
|
|
||||||
}
|
|
||||||
|
|
||||||
-uint64_t trans_blkio_weight_to_io_weight(int weight)
|
|
||||||
+uint64_t lcr_util_trans_blkio_weight_to_io_weight(int weight)
|
|
||||||
{
|
|
||||||
// map from [10-1000] to [1-10000]
|
|
||||||
return (uint64_t)(1 + ((uint64_t)weight - 10) * 9999 / 990);
|
|
||||||
}
|
|
||||||
|
|
||||||
-uint64_t trans_blkio_weight_to_io_bfq_weight(int weight)
|
|
||||||
+uint64_t lcr_util_trans_blkio_weight_to_io_bfq_weight(int weight)
|
|
||||||
{
|
|
||||||
// map from [10-1000] to [1-1000]
|
|
||||||
return (uint64_t)(1 + ((uint64_t)weight - 10) * 999 / 990);
|
|
||||||
}
|
|
||||||
|
|
||||||
-int get_cgroup_version()
|
|
||||||
+int lcr_util_get_cgroup_version()
|
|
||||||
{
|
|
||||||
struct statfs fs = {0};
|
|
||||||
|
|
||||||
diff --git a/src/utils.h b/src/utils.h
|
|
||||||
index 423c0c8..5aae95d 100644
|
|
||||||
--- a/src/utils.h
|
|
||||||
+++ b/src/utils.h
|
|
||||||
@@ -216,11 +216,11 @@ int lcr_util_null_stdfds(void);
|
|
||||||
|
|
||||||
int lcr_util_atomic_write_file(const char *filepath, const char *content);
|
|
||||||
|
|
||||||
-int get_real_swap(int64_t memory, int64_t memory_swap, int64_t *swap);
|
|
||||||
-int trans_cpushare_to_cpuweight(int64_t cpu_share);
|
|
||||||
-uint64_t trans_blkio_weight_to_io_weight(int weight);
|
|
||||||
-uint64_t trans_blkio_weight_to_io_bfq_weight(int weight);
|
|
||||||
-int get_cgroup_version();
|
|
||||||
+int lcr_util_get_real_swap(int64_t memory, int64_t memory_swap, int64_t *swap);
|
|
||||||
+int lcr_util_trans_cpushare_to_cpuweight(int64_t cpu_share);
|
|
||||||
+uint64_t lcr_util_trans_blkio_weight_to_io_weight(int weight);
|
|
||||||
+uint64_t lcr_util_trans_blkio_weight_to_io_bfq_weight(int weight);
|
|
||||||
+int lcr_util_get_cgroup_version();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
From 4b7b830f5e20b4751584fd462219919d4bd756da Mon Sep 17 00:00:00 2001
|
|
||||||
From: wangyueliang <wangyueliang@kylinos.cn>
|
|
||||||
Date: Mon, 12 Apr 2021 10:30:24 +0800
|
|
||||||
Subject: [PATCH 09/10] Fix spelling errors
|
|
||||||
|
|
||||||
---
|
|
||||||
README.md | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/README.md b/README.md
|
|
||||||
index 8a45755..dd960dd 100644
|
|
||||||
--- a/README.md
|
|
||||||
+++ b/README.md
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
# lcr
|
|
||||||
|
|
||||||
`lcr`(Lightweight Container Runtime) is CLI tool for spawning and running containers according to OCI specification.
|
|
||||||
-It is based on `liblxc` and written by `C`. It can use by container engine: [iSulad](https://gitee.com/openeuler/iSulad). [iSulad](https://gitee.com/openeuler/iSulad) use `ldopen` to call functions defined in lcr.
|
|
||||||
+It is based on `liblxc` and written by `C`. It can use by container engine: [iSulad](https://gitee.com/openeuler/iSulad). [iSulad](https://gitee.com/openeuler/iSulad) use `dlopen` to call functions defined in lcr.
|
|
||||||
|
|
||||||
## How to Contribute
|
|
||||||
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
From e63b4e066c79caaab65db5bbb04f9c72aac399df Mon Sep 17 00:00:00 2001
|
|
||||||
From: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
Date: Wed, 12 May 2021 10:54:57 +0800
|
|
||||||
Subject: [PATCH 10/10] fix memory usage of stats not right when runtime is
|
|
||||||
kata
|
|
||||||
|
|
||||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
|
||||||
---
|
|
||||||
src/json/schema/shim/client/runtime-stats.json | 8 ++++++++
|
|
||||||
1 file changed, 8 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/json/schema/shim/client/runtime-stats.json b/src/json/schema/shim/client/runtime-stats.json
|
|
||||||
index 707e58e..6ed9473 100644
|
|
||||||
--- a/src/json/schema/shim/client/runtime-stats.json
|
|
||||||
+++ b/src/json/schema/shim/client/runtime-stats.json
|
|
||||||
@@ -45,6 +45,14 @@
|
|
||||||
"$ref": "../../defs.json#/definitions/uint64"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ },
|
|
||||||
+ "raw": {
|
|
||||||
+ "type": "object",
|
|
||||||
+ "properties": {
|
|
||||||
+ "total_inactive_file": {
|
|
||||||
+ "$ref": "../../defs.json#/definitions/uint64"
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
From 77ef9ee742e33555e1cf0ece0537a539a010ab5d Mon Sep 17 00:00:00 2001
|
|
||||||
From: jikui <jikui2@huawei.com>
|
|
||||||
Date: Sat, 15 May 2021 15:27:57 +0800
|
|
||||||
Subject: [PATCH] support auto resize of isulad shim
|
|
||||||
|
|
||||||
Signed-off-by: jikui <jikui2@huawei.com>
|
|
||||||
---
|
|
||||||
src/json/schema/shim/client/process-state.json | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/json/schema/shim/client/process-state.json b/src/json/schema/shim/client/process-state.json
|
|
||||||
index df21416..05f55fc 100644
|
|
||||||
--- a/src/json/schema/shim/client/process-state.json
|
|
||||||
+++ b/src/json/schema/shim/client/process-state.json
|
|
||||||
@@ -171,6 +171,9 @@
|
|
||||||
"isuladStderr": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
+ "resizeFifo": {
|
|
||||||
+ "type": "string"
|
|
||||||
+ },
|
|
||||||
"runtimeArgs": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
||||||
23
lcr.spec
23
lcr.spec
@ -1,5 +1,5 @@
|
|||||||
%global _version 2.0.5
|
%global _version 2.0.6
|
||||||
%global _release 20210628.165131.git738752d8
|
%global _release 1
|
||||||
%global _inner_name isula_libutils
|
%global _inner_name isula_libutils
|
||||||
|
|
||||||
Name: lcr
|
Name: lcr
|
||||||
@ -12,17 +12,8 @@ Group: Applications/System
|
|||||||
License: LGPLv2.1+
|
License: LGPLv2.1+
|
||||||
BuildRoot: %{_tmppath}/lcr-%{version}
|
BuildRoot: %{_tmppath}/lcr-%{version}
|
||||||
|
|
||||||
Patch1: 0001-support-quiet-of-log-config.patch
|
Patch1: 0001-modified-ipconfig.json-to-adapt-to-newest-version-of.patch
|
||||||
Patch2: 0002-lcr-add-inactive-file-total-metric.patch
|
Patch2: 0002-disable-lxc_keep-with-oci-image.patch
|
||||||
Patch3: 0003-lcr-add-default-runtime-field-for-isula-info.patch
|
|
||||||
Patch4: 0004-support-isula-exec-workdir.patch
|
|
||||||
Patch5: 0005-add-secure-compile-options.patch
|
|
||||||
Patch6: 0006-remove-invalid-fuzz-option.patch
|
|
||||||
Patch7: 0007-support-cgroup-v2.patch
|
|
||||||
Patch8: 0008-fix-pause-container-error.patch
|
|
||||||
Patch9: 0009-Fix-spelling-errors.patch
|
|
||||||
Patch10: 0010-fix-memory-usage-of-stats-not-right-when-runtime-is-.patch
|
|
||||||
Patch11: 0011-support-auto-resize-of-isulad-shim.patch
|
|
||||||
|
|
||||||
%define lxcver 4.0.3-2021012801
|
%define lxcver 4.0.3-2021012801
|
||||||
|
|
||||||
@ -112,6 +103,12 @@ rm -rf %{buildroot}
|
|||||||
%{_includedir}/%{_inner_name}/*.h
|
%{_includedir}/%{_inner_name}/*.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 09 2021 gaohuatao <gaohuatao@huawei.com> - 2.0.6-1
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: update to 2.0.6
|
||||||
|
|
||||||
* Mon Jun 28 2021 wujing <wujing50@huawei.com> - 2.0.5-20210628.165131.git738752d8
|
* Mon Jun 28 2021 wujing <wujing50@huawei.com> - 2.0.5-20210628.165131.git738752d8
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
BIN
v2.0.5.tar.gz
BIN
v2.0.5.tar.gz
Binary file not shown.
BIN
v2.0.6.tar.gz
Normal file
BIN
v2.0.6.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user