From dc4eae55c4237b309fac2ce8436c97365cb174dc Mon Sep 17 00:00:00 2001 From: chengzrz Date: Tue, 2 Aug 2022 11:14:00 +0800 Subject: [PATCH] add HAVE_ISULAD definition and fix cpu quota out of range Signed-off-by: chengzrz --- ...at-Add-json-spec-for-rest-resize-api.patch | 2 +- ...AVE_ISULAD-definition-for-lxc-header.patch | 25 ++++++++++++ ...-quota-out-of-range-when-update-to-1.patch | 40 +++++++++++++++++++ lcr.spec | 10 ++++- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 0002-add-HAVE_ISULAD-definition-for-lxc-header.patch create mode 100644 0003-fix-cpu-quota-out-of-range-when-update-to-1.patch diff --git a/0001-feat-Add-json-spec-for-rest-resize-api.patch b/0001-feat-Add-json-spec-for-rest-resize-api.patch index aa1f971..5ae3dc0 100644 --- a/0001-feat-Add-json-spec-for-rest-resize-api.patch +++ b/0001-feat-Add-json-spec-for-rest-resize-api.patch @@ -1,7 +1,7 @@ From 72985299db95706fd1988de4f5fa88a8cfd55367 Mon Sep 17 00:00:00 2001 From: "Neil.wrz" Date: Tue, 5 Jul 2022 18:23:42 -0700 -Subject: [PATCH] feat Add json spec for rest resize api +Subject: [PATCH 1/3] feat Add json spec for rest resize api Signed-off-by: Neil.wrz --- diff --git a/0002-add-HAVE_ISULAD-definition-for-lxc-header.patch b/0002-add-HAVE_ISULAD-definition-for-lxc-header.patch new file mode 100644 index 0000000..1cdaaf1 --- /dev/null +++ b/0002-add-HAVE_ISULAD-definition-for-lxc-header.patch @@ -0,0 +1,25 @@ +From 4d12753a659ba3b9a3a9bd24e2f842e5bd0fa7a2 Mon Sep 17 00:00:00 2001 +From: zhangxiaoyu +Date: Fri, 22 Jul 2022 10:01:52 +0800 +Subject: [PATCH 2/3] add HAVE_ISULAD definition for lxc header + +Signed-off-by: zhangxiaoyu +--- + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad32724..d7e668b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,6 +63,7 @@ message("-- commit id: " ${GIT_COMMIT_HASH}) + add_definitions(-DLCRPATH="${CMAKE_INSTALL_PREFIX}/var/lib/lcr") + add_definitions(-DLOGPATH="${CMAKE_INSTALL_PREFIX}/var/log/lcr") + add_definitions(-DLCR_GIT_COMMIT="${GIT_COMMIT_HASH}") ++add_definitions(-DHAVE_ISULAD) + + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" +-- +2.25.1 + diff --git a/0003-fix-cpu-quota-out-of-range-when-update-to-1.patch b/0003-fix-cpu-quota-out-of-range-when-update-to-1.patch new file mode 100644 index 0000000..3444182 --- /dev/null +++ b/0003-fix-cpu-quota-out-of-range-when-update-to-1.patch @@ -0,0 +1,40 @@ +From cb0e052e96dfce0992132020eb5fba61c323cfc2 Mon Sep 17 00:00:00 2001 +From: "Neil.wrz" +Date: Tue, 26 Jul 2022 02:17:47 -0700 +Subject: [PATCH 3/3] fix cpu-quota out of range when update to -1 + +Signed-off-by: Neil.wrz +--- + src/lcrcontainer.h | 2 +- + src/lcrcontainer_execute.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/lcrcontainer.h b/src/lcrcontainer.h +index 062d681..a051097 100644 +--- a/src/lcrcontainer.h ++++ b/src/lcrcontainer.h +@@ -118,7 +118,7 @@ struct lcr_cgroup_resources { + uint64_t blkio_weight; + uint64_t cpu_shares; + uint64_t cpu_period; +- uint64_t cpu_quota; ++ int64_t cpu_quota; + char *cpuset_cpus; + char *cpuset_mems; + uint64_t memory_limit; +diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c +index 0aa9cff..042ad2f 100644 +--- a/src/lcrcontainer_execute.c ++++ b/src/lcrcontainer_execute.c +@@ -321,7 +321,7 @@ static int update_resources_cpu_quota(struct lxc_container *c, const struct lcr_ + char numstr[128] = {0}; /* max buffer */ + + if (cr->cpu_quota != 0) { +- int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->cpu_quota)); ++ int num = snprintf(numstr, sizeof(numstr), "%lld", (long long int)cr->cpu_quota); + if (num < 0 || (size_t)num >= sizeof(numstr)) { + ret = -1; + goto out; +-- +2.25.1 + diff --git a/lcr.spec b/lcr.spec index d66fb83..84c2a9b 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.0.8 -%global _release 2 +%global _release 3 %global _inner_name isula_libutils Name: lcr @@ -14,6 +14,8 @@ BuildRoot: %{_tmppath}/lcr-%{version} Patch0001: 0001-feat-Add-json-spec-for-rest-resize-api.patch +Patch0002: 0002-add-HAVE_ISULAD-definition-for-lxc-header.patch +Patch0003: 0003-fix-cpu-quota-out-of-range-when-update-to-1.patch %define lxcver 4.0.3-2021112501 @@ -102,6 +104,12 @@ rm -rf %{buildroot} %{_includedir}/%{_inner_name}/*.h %changelog +* Tue Aug 2 2022 chengzeruizhi - 2.0.8-3 +- Type: enhancement +- ID: NA +- SUG: NA +- DESC: add HAVE_ISULAD definition and fix cpu quota out of range + * Thu Jul 14 2022 haozi007 - 2.0.8-2 - Type: enhancement - ID: NA