72 lines
2.1 KiB
Diff
72 lines
2.1 KiB
Diff
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/43] cgroup v2 does not support isulad setting cpu_rt
|
|
options
|
|
|
|
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
|
---
|
|
src/cmd/isulad/isulad_commands.c | 32 ++++++++++++++++++++++++++++++++
|
|
1 file changed, 32 insertions(+)
|
|
|
|
diff --git a/src/cmd/isulad/isulad_commands.c b/src/cmd/isulad/isulad_commands.c
|
|
index 5fb55689..619e36d1 100644
|
|
--- a/src/cmd/isulad/isulad_commands.c
|
|
+++ b/src/cmd/isulad/isulad_commands.c
|
|
@@ -34,6 +34,7 @@
|
|
#include "utils_verify.h"
|
|
#include "opt_ulimit.h"
|
|
#include "opt_log.h"
|
|
+#include "sysinfo.h"
|
|
|
|
const char isulad_desc[] = "GLOBAL OPTIONS:";
|
|
const char isulad_usage[] = "[global options]";
|
|
@@ -411,6 +412,33 @@ out:
|
|
return ret;
|
|
}
|
|
|
|
+static int check_args_cpu_rt(const struct service_arguments *args)
|
|
+{
|
|
+ int ret = 0;
|
|
+ __isula_auto_sysinfo_t sysinfo_t *sysinfo = NULL;
|
|
+
|
|
+ sysinfo = get_sys_info(true);
|
|
+ if (sysinfo == NULL) {
|
|
+ COMMAND_ERROR("Failed to get system info");
|
|
+ ERROR("Failed to get system info");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ if (!(sysinfo->cgcpuinfo.cpu_rt_period) && args->json_confs->cpu_rt_period != 0) {
|
|
+ COMMAND_ERROR("Invalid --cpu-rt-period: Your kernel does not support cgroup rt period");
|
|
+ ERROR("Invalid --cpu-rt-period: Your kernel does not support cgroup rt period");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ if (!(sysinfo->cgcpuinfo.cpu_rt_runtime) && args->json_confs->cpu_rt_runtime != 0) {
|
|
+ COMMAND_ERROR("Invalid --cpu-rt-runtime: Your kernel does not support cgroup rt runtime");
|
|
+ ERROR("Invalid --cpu-rt-runtime: Your kernel does not support cgroup rt runtime");
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
int check_args(struct service_arguments *args)
|
|
{
|
|
int ret = 0;
|
|
@@ -471,6 +499,10 @@ int check_args(struct service_arguments *args)
|
|
goto out;
|
|
}
|
|
|
|
+ if (check_args_cpu_rt(args) != 0) {
|
|
+ ret = -1;
|
|
+ goto out;
|
|
+ }
|
|
out:
|
|
return ret;
|
|
}
|
|
--
|
|
2.34.1
|
|
|