2022-08-02 11:14:00 +08:00
|
|
|
From cb0e052e96dfce0992132020eb5fba61c323cfc2 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: "Neil.wrz" <wangrunze13@huawei.com>
|
|
|
|
|
Date: Tue, 26 Jul 2022 02:17:47 -0700
|
2022-09-18 19:04:26 -07:00
|
|
|
Subject: [PATCH 3/5] fix cpu-quota out of range when update to -1
|
2022-08-02 11:14:00 +08:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|