summaryrefslogtreecommitdiff
path: root/0026-2169-using-macros-to-isolate-isulad-s-enable_plugin-.patch
blob: 2e77a2dc405c1d9d5f895371ac3578c9e3265800 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
From 4e6473570e3a5cd59585818216218a7a512790a5 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Mon, 4 Sep 2023 08:45:55 +0000
Subject: [PATCH 26/33] !2169 using macros to isolate isulad's enable_plugin
 configuration option * using macros to isolate isulad's enable_plugin
 configuration option

---
 src/cmd/isulad/isulad_commands.h  | 15 +++++++++++----
 src/common/constants.h            |  2 ++
 src/daemon/config/isulad_config.c |  4 ++++
 src/daemon/config/isulad_config.h |  2 ++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/cmd/isulad/isulad_commands.h b/src/cmd/isulad/isulad_commands.h
index 6a8220cc..05d3551c 100644
--- a/src/cmd/isulad/isulad_commands.h
+++ b/src/cmd/isulad/isulad_commands.h
@@ -78,6 +78,16 @@ int command_default_ulimit_append(command_option_t *option, const char *arg);
 #define USERNS_REMAP_OPT(cmdargs)
 #endif
 
+#ifdef ENABLE_PLUGIN
+#define PLUGINS_OPT(cmdargs)                                                                                \
+    { CMD_OPT_TYPE_STRING_DUP,                                                                              \
+      false, "enable-plugins", 0, &(cmdargs)->json_confs->enable_plugins,                                   \
+      "Enable plugins for all containers", NULL                                                             \
+    }, 
+#else
+#define PLUGINS_OPT(cmdargs)
+#endif
+
 #ifdef ENABLE_GRPC_REMOTE_CONNECT
 #define ISULAD_TLS_OPTIONS(cmdargs)                                                                               \
     { CMD_OPT_TYPE_STRING_DUP,                                                                                    \
@@ -326,10 +336,7 @@ int command_default_ulimit_append(command_option_t *option, const char *arg);
       false, "cpu-rt-runtime", 0, &(cmdargs)->json_confs->cpu_rt_runtime,                                         \
       "Limit CPU real-time runtime in microseconds for all containers", command_convert_llong                     \
     },                                                                                                            \
-    { CMD_OPT_TYPE_STRING_DUP,                                                                                    \
-      false, "enable-plugins", 0, &(cmdargs)->json_confs->enable_plugins,                                         \
-      "Enable plugins for all containers", NULL                                                                   \
-    },                                                                                                            \
+    PLUGINS_OPT(cmdargs)                                                                                          \
     { CMD_OPT_TYPE_CALLBACK,                                                                                      \
       false, "cri-runtime", 0, (cmdargs),                                                                         \
       "CRI runtime class transform", server_callback_cri_runtime                                                  \
diff --git a/src/common/constants.h b/src/common/constants.h
index c0417263..f98fb930 100644
--- a/src/common/constants.h
+++ b/src/common/constants.h
@@ -134,9 +134,11 @@ extern "C" {
 
 #define AUTH_PLUGIN "authz-broker"
 
+#ifdef ENABLE_PLUGIN
 #define ISULAD_ENABLE_PLUGINS "ISULAD_ENABLE_PLUGINS"
 #define ISULAD_ENABLE_PLUGINS_SEPERATOR ","
 #define ISULAD_ENABLE_PLUGINS_SEPERATOR_CHAR ','
+#endif
 
 #ifdef ENABLE_NETWORK
 #define ISULAD_CNI_NETWORK_CONF_FILE_PRE "isulacni-"
diff --git a/src/daemon/config/isulad_config.c b/src/daemon/config/isulad_config.c
index f600f0cf..72722c30 100644
--- a/src/daemon/config/isulad_config.c
+++ b/src/daemon/config/isulad_config.c
@@ -1253,6 +1253,7 @@ out:
     return result;
 }
 
+#ifdef ENABLE_PLUGIN
 char *conf_get_enable_plugins(void)
 {
     struct service_arguments *conf = NULL;
@@ -1274,6 +1275,7 @@ out:
     (void)isulad_server_conf_unlock();
     return plugins;
 }
+#endif
 
 #ifdef ENABLE_USERNS_REMAP
 char *conf_get_isulad_userns_remap(void)
@@ -1739,7 +1741,9 @@ int merge_json_confs_into_global(struct service_arguments *args)
     override_string_value(&args->json_confs->pidfile, &tmp_json_confs->pidfile);
     // iSulad runtime execution options
     override_string_value(&args->json_confs->hook_spec, &tmp_json_confs->hook_spec);
+#ifdef ENABLE_PLUGIN
     override_string_value(&args->json_confs->enable_plugins, &tmp_json_confs->enable_plugins);
+#endif
 #ifdef ENABLE_USERNS_REMAP
     override_string_value(&args->json_confs->userns_remap, &tmp_json_confs->userns_remap);
 #endif
diff --git a/src/daemon/config/isulad_config.h b/src/daemon/config/isulad_config.h
index 4fe1acdc..459ea331 100644
--- a/src/daemon/config/isulad_config.h
+++ b/src/daemon/config/isulad_config.h
@@ -60,7 +60,9 @@ int conf_get_container_log_opts(isulad_daemon_configs_container_log **opts);
 
 char *conf_get_isulad_log_file(void);
 char *conf_get_engine_log_file(void);
+#ifdef ENABLE_PLUGIN
 char *conf_get_enable_plugins(void);
+#endif
 #ifdef ENABLE_USERNS_REMAP
 char *conf_get_isulad_userns_remap(void);
 #endif
-- 
2.40.1