add HAVE_ISULAD definition and fix cpu quota out of range
Signed-off-by: chengzrz <czrzrichard@gmail.com>
This commit is contained in:
parent
70a94750fa
commit
dc4eae55c4
@ -1,7 +1,7 @@
|
||||
From 72985299db95706fd1988de4f5fa88a8cfd55367 Mon Sep 17 00:00:00 2001
|
||||
From: "Neil.wrz" <wangrunze13@huawei.com>
|
||||
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 <wangrunze13@huawei.com>
|
||||
---
|
||||
|
||||
25
0002-add-HAVE_ISULAD-definition-for-lxc-header.patch
Normal file
25
0002-add-HAVE_ISULAD-definition-for-lxc-header.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 4d12753a659ba3b9a3a9bd24e2f842e5bd0fa7a2 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Fri, 22 Jul 2022 10:01:52 +0800
|
||||
Subject: [PATCH 2/3] add HAVE_ISULAD definition for lxc header
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
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
|
||||
|
||||
40
0003-fix-cpu-quota-out-of-range-when-update-to-1.patch
Normal file
40
0003-fix-cpu-quota-out-of-range-when-update-to-1.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From cb0e052e96dfce0992132020eb5fba61c323cfc2 Mon Sep 17 00:00:00 2001
|
||||
From: "Neil.wrz" <wangrunze13@huawei.com>
|
||||
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 <wangrunze13@huawei.com>
|
||||
---
|
||||
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
|
||||
|
||||
10
lcr.spec
10
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<chengzeruizhi@huawei.com> - 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<liuhao27@huawei.com> - 2.0.8-2
|
||||
- Type: enhancement
|
||||
- ID: NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user