!257 update version to v2.0.11

From: @wangfengtu 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2022-02-24 12:50:19 +00:00 committed by Gitee
commit f872f6d785
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
28 changed files with 11 additions and 5425 deletions

View File

@ -1,185 +0,0 @@
From 717a0c83e3032c2255b257531cfd160b98cd8180 Mon Sep 17 00:00:00 2001
From: gaohuatao <gaohuatao@huawei.com>
Date: Tue, 16 Nov 2021 11:30:03 +0800
Subject: [PATCH 01/14] add self def runtime for shimv2
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
---
CMakeLists.txt | 2 +-
iSulad.spec | 2 +-
src/contrib/config/daemon.json | 5 ++-
src/daemon/config/isulad_config.c | 3 ++
.../cri/cri_container_manager_service_impl.cc | 9 +++--
src/daemon/entry/cri/cri_helpers.cc | 39 +++++++++++++++++++
src/daemon/entry/cri/cri_helpers.h | 2 +
.../cri_pod_sandbox_manager_service_impl.cc | 5 ++-
8 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cffc0dc..0f7d6b9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,7 +104,7 @@ endif()
install(FILES src/contrib/config/daemon.json
DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
install(FILES src/contrib/config/daemon_constants.json
- DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
+ DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ GROUP_READ)
install(FILES src/contrib/config/config.json src/contrib/config/systemcontainer_config.json
DESTINATION ${conf_prefix}/default/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
install(FILES src/contrib/config/seccomp_default.json
diff --git a/iSulad.spec b/iSulad.spec
index d6e5778c..c5fd802d 100644
--- a/iSulad.spec
+++ b/iSulad.spec
@@ -83,7 +83,7 @@ install -m 0644 ../src/daemon/modules/api/image_api.h %{buildroot}/%{_in
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/isulad
install -m 0640 ../src/contrib/config/daemon.json %{buildroot}/%{_sysconfdir}/isulad/daemon.json
-install -m 0640 ../src/contrib/config/daemon_constants.json %{buildroot}/%{_sysconfdir}/isulad/daemon_constants.json
+install -m 0440 ../src/contrib/config/daemon_constants.json %{buildroot}/%{_sysconfdir}/isulad/daemon_constants.json
install -m 0640 ../src/contrib/config/seccomp_default.json %{buildroot}/%{_sysconfdir}/isulad/seccomp_default.json
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/isulad
diff --git a/src/contrib/config/daemon.json b/src/contrib/config/daemon.json
index d2ce4d02..92cd6c47 100644
--- a/src/contrib/config/daemon.json
+++ b/src/contrib/config/daemon.json
@@ -33,5 +33,8 @@
"cni-conf-dir": "",
"image-layer-check": false,
"use-decrypted-key": true,
- "insecure-skip-verify-enforce": false
+ "insecure-skip-verify-enforce": false,
+ "cri-runtimes": {
+ "kata": "io.containerd.kata.v2"
+ }
}
diff --git a/src/daemon/config/isulad_config.c b/src/daemon/config/isulad_config.c
index ded3c0f6..f70b4575 100644
--- a/src/daemon/config/isulad_config.c
+++ b/src/daemon/config/isulad_config.c
@@ -1522,6 +1522,9 @@ int merge_json_confs_into_global(struct service_arguments *args)
args->json_confs->runtimes = tmp_json_confs->runtimes;
tmp_json_confs->runtimes = NULL;
+ args->json_confs->cri_runtimes = tmp_json_confs->cri_runtimes;
+ tmp_json_confs->cri_runtimes = NULL;
+
// Daemon storage-driver
if (merge_storage_conf_into_global(args, tmp_json_confs)) {
ret = -1;
diff --git a/src/daemon/entry/cri/cri_container_manager_service_impl.cc b/src/daemon/entry/cri/cri_container_manager_service_impl.cc
index ff98df9b..2e65ab51 100644
--- a/src/daemon/entry/cri/cri_container_manager_service_impl.cc
+++ b/src/daemon/entry/cri/cri_container_manager_service_impl.cc
@@ -296,8 +296,8 @@ auto ContainerManagerServiceImpl::GenerateCreateContainerCustomConfig(
if (containerConfig.has_metadata()) {
if (append_json_map_string_string(custom_config->annotations,
- CRIHelpers::Constants::CONTAINER_NAME_ANNOTATION_KEY.c_str(),
- containerConfig.metadata().name().c_str()) != 0) {
+ CRIHelpers::Constants::CONTAINER_NAME_ANNOTATION_KEY.c_str(),
+ containerConfig.metadata().name().c_str()) != 0) {
error.SetError("Append container name into annotation failed");
goto cleanup;
}
@@ -355,7 +355,10 @@ ContainerManagerServiceImpl::GenerateCreateContainerRequest(const std::string &r
request->id = util_strdup_s(cname.c_str());
if (!podSandboxRuntime.empty()) {
- request->runtime = util_strdup_s(podSandboxRuntime.c_str());
+ request->runtime = CRIHelpers::cri_runtime_convert(podSandboxRuntime.c_str());
+ if (request->runtime == nullptr) {
+ request->runtime = util_strdup_s(podSandboxRuntime.c_str());
+ }
}
if (!containerConfig.image().image().empty()) {
diff --git a/src/daemon/entry/cri/cri_helpers.cc b/src/daemon/entry/cri/cri_helpers.cc
index 137726e6..f45c669f 100644
--- a/src/daemon/entry/cri/cri_helpers.cc
+++ b/src/daemon/entry/cri/cri_helpers.cc
@@ -32,6 +32,7 @@
#include "path.h"
#include "utils.h"
#include "service_container_api.h"
+#include "isulad_config.h"
namespace CRIHelpers {
const std::string Constants::POD_NETWORK_ANNOTATION_KEY { "network.alpha.kubernetes.io/network" };
@@ -992,4 +993,42 @@ char *GenerateExecSuffix()
return exec_suffix;
}
+char *cri_runtime_convert(const char *runtime)
+{
+ char *runtime_val = nullptr;
+ json_map_string_string *cri_shimv2_runtimes = nullptr;
+
+ if (runtime == nullptr) {
+ return nullptr;
+ }
+
+ if (isulad_server_conf_rdlock()) {
+ ERROR("Lock isulad server conf failed");
+ return nullptr;
+ }
+
+ struct service_arguments *args = conf_get_server_conf();
+ if (args == nullptr || args->json_confs == nullptr || args->json_confs->cri_runtimes == nullptr) {
+ ERROR("Cannot get cri runtime list");
+ goto out;
+ }
+
+ cri_shimv2_runtimes = args->json_confs->cri_runtimes;
+ for (size_t i = 0; i < cri_shimv2_runtimes->len; i++) {
+ if (cri_shimv2_runtimes->keys[i] == nullptr || cri_shimv2_runtimes->values[i] == nullptr) {
+ WARN("CRI runtimes key or value is null");
+ continue;
+ }
+
+ if (strcmp(runtime, cri_shimv2_runtimes->keys[i]) == 0) {
+ runtime_val = util_strdup_s(cri_shimv2_runtimes->values[i]);
+ break;
+ }
+ }
+
+out:
+ (void)isulad_server_conf_unlock();
+ return runtime_val;
+}
+
} // namespace CRIHelpers
diff --git a/src/daemon/entry/cri/cri_helpers.h b/src/daemon/entry/cri/cri_helpers.h
index 450c899c..9eccc1da 100644
--- a/src/daemon/entry/cri/cri_helpers.h
+++ b/src/daemon/entry/cri/cri_helpers.h
@@ -150,6 +150,8 @@ void RemoveContainer(service_executor_t *cb, const std::string &containerID, Err
void StopContainer(service_executor_t *cb, const std::string &containerID, int64_t timeout, Errors &error);
char *GenerateExecSuffix();
+
+char *cri_runtime_convert(const char *runtime);
}; // namespace CRIHelpers
#endif // DAEMON_ENTRY_CRI_CRI_HELPERS_H
diff --git a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
index 8801bea6..0f9ef044 100644
--- a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
+++ b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
@@ -251,7 +251,10 @@ container_create_request *PodSandboxManagerServiceImpl::PackCreateContainerReque
create_request->id = util_strdup_s(sandboxName.c_str());
if (!runtimeHandler.empty()) {
- create_request->runtime = util_strdup_s(runtimeHandler.c_str());
+ create_request->runtime = CRIHelpers::cri_runtime_convert(runtimeHandler.c_str());
+ if (create_request->runtime == nullptr) {
+ create_request->runtime = util_strdup_s(runtimeHandler.c_str());
+ }
}
create_request->image = util_strdup_s(image.c_str());
--
2.25.1

View File

@ -1,29 +0,0 @@
From 2e6f54021ee4b2b81fb0119714f1c4fffb4a031f Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Fri, 19 Nov 2021 15:11:23 +0800
Subject: [PATCH 02/14] fix memleak when use multiple --volumes-from
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/spec/specs_mount.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/daemon/modules/spec/specs_mount.c b/src/daemon/modules/spec/specs_mount.c
index 175a0fbe..6b6ac87d 100644
--- a/src/daemon/modules/spec/specs_mount.c
+++ b/src/daemon/modules/spec/specs_mount.c
@@ -2773,6 +2773,11 @@ static int calc_volumes_from_len(host_config *host_spec, size_t *len)
if (cont->common_config != NULL && cont->common_config->mount_points != NULL) {
*len += cont->common_config->mount_points->len;
}
+
+ free(id);
+ id = NULL;
+ container_unref(cont);
+ cont = NULL;
}
out:
--
2.25.1

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@
From 1d89d1d6fce7a3f89ce2a984500dede6529c8f53 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Fri, 26 Nov 2021 09:45:20 +0000
Subject: [PATCH 04/14] add new function mock for ut
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
test/mocks/namespace_mock.cc | 10 ++++++++++
test/mocks/namespace_mock.h | 1 +
test/specs/specs/specs_ut.cc | 1 +
3 files changed, 12 insertions(+)
diff --git a/test/mocks/namespace_mock.cc b/test/mocks/namespace_mock.cc
index 5c0cba6c..da24e406 100644
--- a/test/mocks/namespace_mock.cc
+++ b/test/mocks/namespace_mock.cc
@@ -47,3 +47,13 @@ char *get_container_process_label(const char *path)
}
return nullptr;
}
+
+int get_network_namespace_path(const host_config *host_spec,
+ const container_config_v2_common_config_network_settings *network_settings,
+ const char *type, char **dest_path)
+{
+ if (g_namespace_mock != nullptr) {
+ return g_namespace_mock->GetNetworkNamespacePath(host_spec, network_settings, type, dest_path);
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/test/mocks/namespace_mock.h b/test/mocks/namespace_mock.h
index b835e028..80e75b0b 100644
--- a/test/mocks/namespace_mock.h
+++ b/test/mocks/namespace_mock.h
@@ -26,6 +26,7 @@ public:
MOCK_METHOD1(ConnectedContainer, char *(const char *mode));
MOCK_METHOD3(GetShareNamespacePath, int(const char *type, const char *src_path, char **dest_path));
MOCK_METHOD1(GetContainerProcessLabel, char *(const char *path));
+ MOCK_METHOD4(GetNetworkNamespacePath, int(const host_config *, const container_config_v2_common_config_network_settings *, const char *, char **));
};
void MockNamespace_SetMock(MockNamespace *mock);
diff --git a/test/specs/specs/specs_ut.cc b/test/specs/specs/specs_ut.cc
index 2f2a2524..c4014e2e 100644
--- a/test/specs/specs/specs_ut.cc
+++ b/test/specs/specs/specs_ut.cc
@@ -19,6 +19,7 @@
#include "mock.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "specs_api.h"
+#include "specs_namespace.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "oci_ut_common.h"
--
2.25.1

View File

@ -1,28 +0,0 @@
From 07b81da5e3d357c34cf7f5379ba507a16617a5ed Mon Sep 17 00:00:00 2001
From: gaohuatao <gaohuatao@huawei.com>
Date: Sat, 27 Nov 2021 11:14:40 +0800
Subject: [PATCH 05/14] delete isulad h flag
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
---
src/cmd/isulad/isulad_commands.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cmd/isulad/isulad_commands.c b/src/cmd/isulad/isulad_commands.c
index d0ab029c..c2826c83 100644
--- a/src/cmd/isulad/isulad_commands.c
+++ b/src/cmd/isulad/isulad_commands.c
@@ -213,8 +213,8 @@ int parse_args(struct service_arguments *args, int argc, const char **argv)
if (args->argc > 0) {
printf("unresolved arguments: %s;\t"
- "run `%s --help` or `%s -h` for help.\n",
- args->argv[0], argv[0], argv[0]);
+ "run `%s --help` for help.\n",
+ args->argv[0], argv[0]);
return -1;
}
--
2.25.1

View File

@ -1,26 +0,0 @@
From d3d44e344d2ea2213c7d595c957e8ebf0a661fd2 Mon Sep 17 00:00:00 2001
From: chengzrz <czrzrichard@gmail.com>
Date: Sat, 27 Nov 2021 11:31:13 +0800
Subject: [PATCH 06/14] Fix memory leak in ClearCniNetwork when calling
get_sandbox_key
Signed-off-by: chengzrz <czrzrichard@gmail.com>
---
src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
index eb1cd09f..0a577849 100644
--- a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
+++ b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
@@ -748,6 +748,7 @@ auto PodSandboxManagerServiceImpl::ClearCniNetwork(const std::string &realSandbo
ERROR("Failed to umount directory %s:%s", netnsPath, strerror(errno));
}
}
+ free(netnsPath);
}
free_container_inspect(inspect_data);
return 0;
--
2.25.1

View File

@ -1,26 +0,0 @@
From 23ab9ac224056a2efef00b20cfc973c8e98a1e1d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 26 Nov 2021 09:51:52 +0800
Subject: [PATCH 07/14] fix cri libwebsockets sync_close_sem memory leak
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/daemon/entry/cri/websocket/service/ws_server.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/daemon/entry/cri/websocket/service/ws_server.cc b/src/daemon/entry/cri/websocket/service/ws_server.cc
index 509f821e..e4b3a1b4 100644
--- a/src/daemon/entry/cri/websocket/service/ws_server.cc
+++ b/src/daemon/entry/cri/websocket/service/ws_server.cc
@@ -191,6 +191,8 @@ void WebsocketServer::CloseWsSession(int socketID)
}
(void)sem_wait(session->sync_close_sem);
(void)sem_destroy(session->sync_close_sem);
+ delete session->sync_close_sem;
+ session->sync_close_sem = nullptr;
close(session->pipes.at(0));
delete session->session_mutex;
session->session_mutex = nullptr;
--
2.25.1

View File

@ -1,96 +0,0 @@
From 198daf0e54215f76ddb62caa8bea41ff6625db40 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Sat, 27 Nov 2021 14:15:34 +0800
Subject: [PATCH 08/14] fix cpu variant get error
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/utils/cutils/utils.c | 14 +++++---------
src/utils/cutils/utils_file.c | 6 +++++-
src/utils/cutils/utils_file.h | 5 +++++
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c
index a3e192fe..511cde96 100644
--- a/src/utils/cutils/utils.c
+++ b/src/utils/cutils/utils.c
@@ -1299,12 +1299,11 @@ restart:
static char *get_cpu_variant()
{
char *variant = NULL;
- char *cpuinfo = NULL;
+ char cpuinfo[1024] = { 0 };
char *start_pos = NULL;
char *end_pos = NULL;
- cpuinfo = util_read_text_file("/proc/cpuinfo");
- if (cpuinfo == NULL) {
+ if (util_file2str("/proc/cpuinfo", cpuinfo, sizeof(cpuinfo)) < 0) {
ERROR("read /proc/cpuinfo failed");
return NULL;
}
@@ -1312,7 +1311,7 @@ static char *get_cpu_variant()
start_pos = strstr(cpuinfo, "CPU architecture");
if (start_pos == NULL) {
ERROR("can not found the key \"CPU architecture\" when try to get cpu variant");
- goto out;
+ return NULL;
}
end_pos = strchr(start_pos, '\n');
if (end_pos != NULL) {
@@ -1321,17 +1320,14 @@ static char *get_cpu_variant()
start_pos = strchr(start_pos, ':');
if (start_pos == NULL) {
ERROR("can not found delimiter \":\" when try to get cpu variant");
- goto out;
+ return NULL;
}
+ start_pos += 1; // skip char ":"
util_trim_newline(start_pos);
start_pos = util_trim_space(start_pos);
variant = util_strings_to_lower(start_pos);
-out:
- free(cpuinfo);
- cpuinfo = NULL;
-
return variant;
}
diff --git a/src/utils/cutils/utils_file.c b/src/utils/cutils/utils_file.c
index f4fa4ece..00825bea 100644
--- a/src/utils/cutils/utils_file.c
+++ b/src/utils/cutils/utils_file.c
@@ -815,7 +815,11 @@ char *util_add_path(const char *path, const char *name)
return new_path;
}
-/* note: This function can only read small text file. */
+/* notes:
+ * 1. Do not use this function to read proc file because proc file in armv8 does not
+ * support fseek and the result of this function is nill string which is unexpected.
+ * 2. This function can only read small text file.
+ */
char *util_read_text_file(const char *path)
{
char *buf = NULL;
diff --git a/src/utils/cutils/utils_file.h b/src/utils/cutils/utils_file.h
index a7fbbb6b..1465ca7e 100644
--- a/src/utils/cutils/utils_file.h
+++ b/src/utils/cutils/utils_file.h
@@ -68,6 +68,11 @@ char *util_path_dir(const char *path);
char *util_add_path(const char *path, const char *name);
+/* notes:
+ * 1. Do not use this function to read proc file because proc file in armv8 does not
+ * support fseek and the result of this function is nill string which is unexpected.
+ * 2. This function can only read small text file.
+ */
char *util_read_text_file(const char *path);
int64_t util_file_size(const char *filename);
--
2.25.1

View File

@ -1,40 +0,0 @@
From 688254c48fd4a672081d11e1f50ff70e807402f3 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Mon, 29 Nov 2021 11:41:44 +0800
Subject: [PATCH 09/14] fix unit test error of registry in armv8
use the data same as x86 to do unit test in armv8
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
test/image/oci/registry/data/oci/index | 2 +-
test/image/oci/registry/data/v2/manifest_list | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/image/oci/registry/data/oci/index b/test/image/oci/registry/data/oci/index
index d713bde3..c3f09482 100644
--- a/test/image/oci/registry/data/oci/index
+++ b/test/image/oci/registry/data/oci/index
@@ -20,7 +20,7 @@ Etag: "sha256:bd28e852703450d93220e6733a9f0901b92cd558911528b03fdba56156ae0a02"
"size": 527
},
{
- "digest": "sha256:134252904112f8563a17a360957d9ad192e5c1e77463e04be74e71cffd4b41ba",
+ "digest": "sha256:106429d73f57137cc587d2d4f1ad7ffb8c4cedcb564d3fb44a8769e602a4a4ec",
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"platform": {
"architecture": "arm64",
diff --git a/test/image/oci/registry/data/v2/manifest_list b/test/image/oci/registry/data/v2/manifest_list
index b4cf93c5..c1962e3e 100644
--- a/test/image/oci/registry/data/v2/manifest_list
+++ b/test/image/oci/registry/data/v2/manifest_list
@@ -8,4 +8,4 @@ Docker-Content-Digest: sha256:9ddee63a712cea977267342e8750ecbc60d3aab25f04ceacfa
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:9ddee63a712cea977267342e8750ecbc60d3aab25f04ceacfa795e6fce341793"
-{"manifests":[{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":527},{"digest":"sha256:ea84577ce8331aaceefd586104ba283201b89b5a614b10ec44b9884722db49d8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":527},{"digest":"sha256:296361e74fe78e932cdd807743b5e37469518194f95c042135a6c3320ca52ef1","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v6"},"size":527},{"digest":"sha256:5cbe4404234f93a5401b58e0c50408d5c9caace822b70867e4f3e787be83eee9","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":527},{"digest":"sha256:134252904112f8563a17a360957d9ad192e5c1e77463e04be74e71cffd4b41ba","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":527},{"digest":"sha256:414aeb860595d7078cbe87abaeed05157d6b44907fbd7db30e1cfba9b6902448","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":527},{"digest":"sha256:116dccaef9ca8b121565a39bd568ede437f084c94bb0642d2aba6b441e38d2f8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":527},{"digest":"sha256:5477c332ec926f8221e82a6c9e37dd9d84a401e3b5f71ba7d498956552c880ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":528},{"digest":"sha256:c304d497f3e0f87f8457401787df738f6f6e62b367bfd7c5f73f5b880b30ab4f","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":528}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}
\ No newline at end of file
+{"manifests":[{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":527},{"digest":"sha256:ea84577ce8331aaceefd586104ba283201b89b5a614b10ec44b9884722db49d8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":527},{"digest":"sha256:296361e74fe78e932cdd807743b5e37469518194f95c042135a6c3320ca52ef1","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v6"},"size":527},{"digest":"sha256:5cbe4404234f93a5401b58e0c50408d5c9caace822b70867e4f3e787be83eee9","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":527},{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":527},{"digest":"sha256:414aeb860595d7078cbe87abaeed05157d6b44907fbd7db30e1cfba9b6902448","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":527},{"digest":"sha256:116dccaef9ca8b121565a39bd568ede437f084c94bb0642d2aba6b441e38d2f8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":527},{"digest":"sha256:5477c332ec926f8221e82a6c9e37dd9d84a401e3b5f71ba7d498956552c880ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":528},{"digest":"sha256:c304d497f3e0f87f8457401787df738f6f6e62b367bfd7c5f73f5b880b30ab4f","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":528}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}
--
2.25.1

View File

@ -1,68 +0,0 @@
From 7e4b7304134eb0f85b83b02aeeee3c10b2303446 Mon Sep 17 00:00:00 2001
From: chengzrz <czrzrichard@gmail.com>
Date: Mon, 29 Nov 2021 14:41:47 +0800
Subject: [PATCH 10/14] Modified cmakelist of storage_layer and added a new
mock function in isulad_config_mock to fix errors that happen when compiling
with UT option turned on
Signed-off-by: chengzrz <czrzrichard@gmail.com>
---
test/image/oci/storage/layers/CMakeLists.txt | 4 ++++
test/mocks/isulad_config_mock.cc | 8 ++++++++
test/mocks/isulad_config_mock.h | 1 +
3 files changed, 13 insertions(+)
diff --git a/test/image/oci/storage/layers/CMakeLists.txt b/test/image/oci/storage/layers/CMakeLists.txt
index 4cae382c..3fe8ab7c 100644
--- a/test/image/oci/storage/layers/CMakeLists.txt
+++ b/test/image/oci/storage/layers/CMakeLists.txt
@@ -22,6 +22,8 @@ add_executable(${DRIVER_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/err_msg.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/selinux_label.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/daemon_arguments.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/isulad_config.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
@@ -89,6 +91,8 @@ add_executable(${LAYER_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/tar/util_archive.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/tar/util_gzip.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/sha256/sha256.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/daemon_arguments.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/isulad_config.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/err_msg.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/selinux_label.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/layer.c
diff --git a/test/mocks/isulad_config_mock.cc b/test/mocks/isulad_config_mock.cc
index a333c176..eb6970d7 100644
--- a/test/mocks/isulad_config_mock.cc
+++ b/test/mocks/isulad_config_mock.cc
@@ -170,3 +170,11 @@ isulad_daemon_constants *get_isulad_daemon_constants()
}
return &g_isulad_daemon_constants;
}
+
+char *conf_get_isulad_userns_remap()
+{
+ if (g_isulad_conf_mock != nullptr) {
+ return g_isulad_conf_mock->ConfGetIsuladUsernsRemap();
+ }
+ return nullptr;
+}
\ No newline at end of file
diff --git a/test/mocks/isulad_config_mock.h b/test/mocks/isulad_config_mock.h
index b91b5465..7af20ca5 100644
--- a/test/mocks/isulad_config_mock.h
+++ b/test/mocks/isulad_config_mock.h
@@ -39,6 +39,7 @@ public:
MOCK_METHOD0(ConfGetUseDecryptedKeyFlag, bool (void));
MOCK_METHOD0(InitIsuladDaemonConstants, int (void));
MOCK_METHOD0(GetIsuladDaemonConstants, isulad_daemon_constants * (void));
+ MOCK_METHOD0(ConfGetIsuladUsernsRemap, char *(void));
};
void MockIsuladConf_SetMock(MockIsuladConf *mock);
--
2.25.1

View File

@ -1,120 +0,0 @@
From db952e8122e584dbb24d28d36abc2ac1b8ad0c77 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Mon, 29 Nov 2021 16:07:39 +0800
Subject: [PATCH 11/14] add fuzz build in CI
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
CI/make-and-install.sh | 9 +++++++++
CMakeLists.txt | 4 ++--
test/fuzz/CMakeLists.txt | 25 +++++++++++++++++++------
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/CI/make-and-install.sh b/CI/make-and-install.sh
index 602878bf..3fd88b84 100755
--- a/CI/make-and-install.sh
+++ b/CI/make-and-install.sh
@@ -74,12 +74,21 @@ rm -rf build
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_UT=ON -DENABLE_SHIM_V2=ON ..
make -j $(nproc)
+make install
ctest -T memcheck --output-on-failure
if [[ $? -ne 0 ]]; then
exit 1
fi
echo_success "===================RUN DT-LLT TESTCASES END========================="
+# build fuzz
+cd $ISULAD_COPY_PATH
+rm -rf build
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZ=ON ..
+make -j $(nproc)
+
# build rest version
cd $ISULAD_COPY_PATH
rm -rf build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f7d6b9c..8fc03f2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,9 +86,9 @@ IF(ENABLE_UT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
ENDIF(ENABLE_UT)
-IF(ENABLE_FUZZ)
+IF(ENABLE_FUZZ AND (NOT ENABLE_UT))
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
-ENDIF(ENABLE_FUZZ)
+ENDIF(ENABLE_FUZZ AND (NOT ENABLE_UT))
# install all files
install(FILES ${CMAKE_BINARY_DIR}/conf/isulad.pc
diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt
index 816dd3cf..61ab47d7 100644
--- a/test/fuzz/CMakeLists.txt
+++ b/test/fuzz/CMakeLists.txt
@@ -20,9 +20,18 @@ SET(EXE1 im_config_image_exist_fuzz)
SET(EXE2 im_get_image_count_fuzz)
SET(EXE3 test_volume_mount_spec_fuzz)
SET(EXE4 test_volume_parse_volume_fuzz)
-add_executable(${EXE0} im_oci_image_exist_fuzz.cc)
-add_executable(${EXE1} im_config_image_exist_fuzz.cc)
-add_executable(${EXE2} im_get_image_count_fuzz.cc)
+add_executable(${EXE0}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_oci_image_exist_fuzz.cc)
+add_executable(${EXE1}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_config_image_exist_fuzz.cc)
+add_executable(${EXE2}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
+ im_get_image_count_fuzz.cc)
add_executable(${EXE3}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/path.c
@@ -36,6 +45,8 @@ add_executable(${EXE3}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_mount_spec.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
test_volume_mount_spec_fuzz.cc
)
add_executable(${EXE4}
@@ -51,6 +62,8 @@ add_executable(${EXE4}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/modules/spec/parse_volume.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
test_volume_parse_volume_fuzz.cc
)
@@ -96,15 +109,15 @@ target_include_directories(${EXE4} PUBLIC
set_target_properties(${EXE0} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE0} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE1} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE1} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE2} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE2} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
-target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
+target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
set_target_properties(${EXE3} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${EXE3} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
--
2.25.1

View File

@ -1,26 +0,0 @@
From cd3cda2bf3880d1e805406cba6e5c6510ef8832b Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Wed, 1 Dec 2021 10:14:33 +0800
Subject: [PATCH 12/14] print valgrind log
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
CI/test_cases/helpers.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh
index 27f04749..dd1bf943 100755
--- a/CI/test_cases/helpers.sh
+++ b/CI/test_cases/helpers.sh
@@ -146,7 +146,7 @@ function check_valgrind_log() {
cat $valgrind_log | grep "are definitely lost" | grep "==$pid=="
if [ $? -eq 0 ];then
echo "Memory leak may checked by valgrind, see valgrind log file: $valgrind_log"
- sed -n '/definitely lost/,// p' $valgrind_log
+ cat $valgrind_log
exit 1
fi
return 0
--
2.25.1

View File

@ -1,32 +0,0 @@
From 3750c2f7d6c13289bbfbb278e0e09667468286d0 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Thu, 2 Dec 2021 15:24:11 +0800
Subject: [PATCH 13/14] fix cri version memory leak
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc b/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
index 4316b190..6c4ba515 100644
--- a/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
+++ b/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
@@ -44,10 +44,10 @@ void RuntimeVersionerServiceImpl::Version(const std::string &apiVersion,
} else {
error.SetError("Failed to call version callback");
}
- free_container_version_response(response);
- return;
+ } else {
+ VersionResponseToGRPC(response, versionResponse);
}
- VersionResponseToGRPC(response, versionResponse);
+ free_container_version_response(response);
}
} // namespace CRI
\ No newline at end of file
--
2.25.1

View File

@ -1,25 +0,0 @@
From 861a635c95254c7429bc8c23552f529c5a083762 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Thu, 2 Dec 2021 15:24:31 +0800
Subject: [PATCH 14/14] fix undefined reference in libisulad_img.so
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/image/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/daemon/modules/image/CMakeLists.txt b/src/daemon/modules/image/CMakeLists.txt
index 86b7d8a6..0a004835 100644
--- a/src/daemon/modules/image/CMakeLists.txt
+++ b/src/daemon/modules/image/CMakeLists.txt
@@ -71,6 +71,7 @@ add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
${CMAKE_SOURCE_DIR}/src/utils/tar/isulad_tar.c
${CMAKE_SOURCE_DIR}/src/utils/tar/util_archive.c
${CMAKE_SOURCE_DIR}/src/utils/tar/util_gzip.c
+ ${CMAKE_SOURCE_DIR}/src/daemon/config/isulad_config.c
)
target_include_directories(${LIB_ISULAD_IMG} PUBLIC
--
2.25.1

View File

@ -1,26 +0,0 @@
From 08a39a58fe36af1705df60373789d23d258d8327 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Fri, 3 Dec 2021 09:32:39 +0800
Subject: [PATCH] fix undefined reference to `service_arguments_free' in
libisulad_img.so
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/image/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/daemon/modules/image/CMakeLists.txt b/src/daemon/modules/image/CMakeLists.txt
index 0a004835..14ce571d 100644
--- a/src/daemon/modules/image/CMakeLists.txt
+++ b/src/daemon/modules/image/CMakeLists.txt
@@ -72,6 +72,7 @@ add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
${CMAKE_SOURCE_DIR}/src/utils/tar/util_archive.c
${CMAKE_SOURCE_DIR}/src/utils/tar/util_gzip.c
${CMAKE_SOURCE_DIR}/src/daemon/config/isulad_config.c
+ ${CMAKE_SOURCE_DIR}/src/daemon/config/daemon_arguments.c
)
target_include_directories(${LIB_ISULAD_IMG} PUBLIC
--
2.25.1

View File

@ -1,42 +0,0 @@
From b97bdc9e63872bef2164a3b97ab837ac607ccf16 Mon Sep 17 00:00:00 2001
From: gaohuatao <gaohuatao@huawei.com>
Date: Fri, 3 Dec 2021 16:36:18 +0800
Subject: [PATCH] fix mem leak
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
---
src/daemon/modules/image/oci/storage/image_store/image_store.c | 3 ++-
.../modules/image/oci/storage/rootfs_store/rootfs_store.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/daemon/modules/image/oci/storage/image_store/image_store.c b/src/daemon/modules/image/oci/storage/image_store/image_store.c
index d2956114..288d7bd7 100644
--- a/src/daemon/modules/image/oci/storage/image_store/image_store.c
+++ b/src/daemon/modules/image/oci/storage/image_store/image_store.c
@@ -2980,7 +2980,8 @@ static int append_image_by_directory(const char *image_dir)
im = storage_image_parse_file(image_path, NULL, &err);
if (im == NULL) {
ERROR("Failed to parse images path: %s", err);
- return -1;
+ ret = -1;
+ goto out;
}
ret = strip_default_hostname(im);
diff --git a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
index 8e1d5a11..378d1a96 100644
--- a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
+++ b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
@@ -177,7 +177,8 @@ static int append_container_by_directory(const char *container_dir)
c = storage_rootfs_parse_file(container_path, NULL, &err);
if (c == NULL) {
ERROR("Failed to parse container path: %s", err);
- return -1;
+ ret = -1;
+ goto out;
}
if (do_append_container(c) != 0) {
--
2.25.1

View File

@ -1,26 +0,0 @@
From de8ef6a226fdbee53975d6d746a065a24a98ea05 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Mon, 6 Dec 2021 11:07:36 +0800
Subject: [PATCH] isula pull does not support format name@digest
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/cmd/isula/images/pull.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmd/isula/images/pull.c b/src/cmd/isula/images/pull.c
index 3ba7a715..da9cae52 100644
--- a/src/cmd/isula/images/pull.c
+++ b/src/cmd/isula/images/pull.c
@@ -25,7 +25,7 @@
#include "connect.h"
const char g_cmd_pull_desc[] = "Pull an image or a repository from a registry";
-const char g_cmd_pull_usage[] = "pull [OPTIONS] NAME[:TAG|@DIGEST]";
+const char g_cmd_pull_usage[] = "pull [OPTIONS] NAME[:TAG]";
struct client_arguments g_cmd_pull_args = {};
--
2.25.1

View File

@ -1,144 +0,0 @@
From 6f337131977c21966cf7a6898cfc81414c07cf05 Mon Sep 17 00:00:00 2001
From: chengzrz <czrzrichard@gmail.com>
Date: Mon, 6 Dec 2021 15:34:31 +0800
Subject: [PATCH] Fixed dangerous memory operations
Signed-off-by: chengzrz <czrzrichard@gmail.com>
---
.../cri_pod_sandbox_manager_service_impl.cc | 3 +-
.../executor/container_cb/execution_create.c | 5 +++
src/utils/cutils/utils_network.c | 43 +++++++++++++------
test/mocks/namespace_mock.h | 3 +-
4 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
index 0a577849..57297287 100644
--- a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
+++ b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
@@ -477,7 +477,7 @@ void PodSandboxManagerServiceImpl::SetupSandboxNetwork(const runtime::v1alpha2::
{
std::map<std::string, std::string> stdAnnos;
std::map<std::string, std::string> networkOptions;
- const char* sandbox_key = get_sandbox_key(inspect_data);
+ char* sandbox_key = get_sandbox_key(inspect_data);
// Setup sandbox files
if (config.has_dns_config() && inspect_data->resolv_conf_path != nullptr) {
@@ -510,6 +510,7 @@ void PodSandboxManagerServiceImpl::SetupSandboxNetwork(const runtime::v1alpha2::
}
cleanup:
+ free(sandbox_key);
return;
}
diff --git a/src/daemon/executor/container_cb/execution_create.c b/src/daemon/executor/container_cb/execution_create.c
index 95a7d9ab..e647ca06 100644
--- a/src/daemon/executor/container_cb/execution_create.c
+++ b/src/daemon/executor/container_cb/execution_create.c
@@ -1421,6 +1421,11 @@ static char *new_pod_sandbox_key(void)
static int generate_network_settings(const host_config *host_config, container_config_v2_common_config *v2_spec)
{
+ if (host_config == NULL || v2_spec == NULL) {
+ ERROR("Invalid input");
+ return -1;
+ }
+
container_config_v2_common_config_network_settings *settings = NULL;
if (!namespace_is_file(host_config->network_mode)) {
diff --git a/src/utils/cutils/utils_network.c b/src/utils/cutils/utils_network.c
index a5d77c93..1ca901ea 100644
--- a/src/utils/cutils/utils_network.c
+++ b/src/utils/cutils/utils_network.c
@@ -65,26 +65,34 @@ out:
return ret;
}
-static void mount_netns(void *netns_path)
+static void* mount_netns(void *netns_path)
{
- int failure = EXIT_FAILURE;
- int success = EXIT_SUCCESS;
+ int *ecode = (int *)malloc(sizeof(int));
char fullpath[PATH_MAX] = { 0x00 };
int ret = 0;
if (unshare(CLONE_NEWNET) != 0) {
- pthread_exit((void *)&failure);
+ ERROR("Failed to unshare");
+ goto err_out;
}
ret = snprintf(fullpath, sizeof(fullpath), "/proc/%d/task/%ld/ns/net", getpid(), (long int)syscall(__NR_gettid));
if (ret < 0 || (size_t)ret >= sizeof(fullpath)) {
- pthread_exit((void *)&failure);
+ ERROR("Failed to get full path");
+ goto err_out;
}
if (util_mount(fullpath, (char *)netns_path, "none", "bind") != 0) {
- pthread_exit((void *)&failure);
+ ERROR("Failed to mount %s", fullpath);
+ goto err_out;
}
- pthread_exit((void *)&success);
+
+ *ecode = EXIT_SUCCESS;
+ pthread_exit((void *)ecode);
+
+err_out:
+ *ecode = EXIT_FAILURE;
+ pthread_exit((void *)ecode);
}
// this function mounts netns path to /proc/%d/task/%d/ns/net
@@ -103,14 +111,25 @@ int util_mount_namespace(const char *netns_path)
ret = pthread_join(newns_thread, &status);
if (ret != 0) {
ERROR("Failed to join thread");
+ ret = -1;
+ goto out;
+ }
+
+ if (status == NULL) {
+ ERROR("Failed set exit status");
return -1;
+ }
+
+ if (*(int *)status != 0) {
+ ERROR("Failed to initialize network namespace, status code is %d", *(int *)status);
+ ret = -1;
} else {
- if (*(int *)status != 0) {
- ERROR("Failed to initialize network namespace");
- return -1;
- }
+ ret = 0;
}
- return 0;
+
+out:
+ free(status);
+ return ret;
}
int util_umount_namespace(const char *netns_path)
diff --git a/test/mocks/namespace_mock.h b/test/mocks/namespace_mock.h
index 80e75b0b..5bfc2c70 100644
--- a/test/mocks/namespace_mock.h
+++ b/test/mocks/namespace_mock.h
@@ -26,7 +26,8 @@ public:
MOCK_METHOD1(ConnectedContainer, char *(const char *mode));
MOCK_METHOD3(GetShareNamespacePath, int(const char *type, const char *src_path, char **dest_path));
MOCK_METHOD1(GetContainerProcessLabel, char *(const char *path));
- MOCK_METHOD4(GetNetworkNamespacePath, int(const host_config *, const container_config_v2_common_config_network_settings *, const char *, char **));
+ MOCK_METHOD4(GetNetworkNamespacePath, int(const host_config *,
+ const container_config_v2_common_config_network_settings *, const char *, char **));
};
void MockNamespace_SetMock(MockNamespace *mock);
--
2.25.1

View File

@ -1,97 +0,0 @@
From 5a9ab3c983158c8848868e92d5a06fbd7bfc9141 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 6 Dec 2021 09:26:40 +0000
Subject: [PATCH] add pull request gateway checker for build and ut
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
CI/pr-gateway.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100755 CI/pr-gateway.sh
diff --git a/CI/pr-gateway.sh b/CI/pr-gateway.sh
new file mode 100755
index 00000000..c38059b9
--- /dev/null
+++ b/CI/pr-gateway.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+#######################################################################
+##- @Copyright (C) Huawei Technologies., Ltd. 2021. All rights reserved.
+# - iSulad licensed under the Mulan PSL v2.
+# - You can use this software according to the terms and conditions of the Mulan PSL v2.
+# - You may obtain a copy of Mulan PSL v2 at:
+# - http://license.coscl.org.cn/MulanPSL2
+# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+# - PURPOSE.
+# - See the Mulan PSL v2 for more details.
+##- @Description:provide gateway checker for pull request of iSulad
+##- @Author: haozi007
+##- @Create: 2021-12-06
+#######################################################################
+tbranch="master"
+if [ $# -eq 1 ]; then
+ tbranch=$1
+fi
+
+dnf install -y gtest-devel gmock-devel diffutils cmake gcc-c++ yajl-devel patch make libtool libevent-devel libevhtp-devel grpc grpc-plugins grpc-devel protobuf-devel libcurl libcurl-devel sqlite-devel libarchive-devel device-mapper-devel http-parser-devel libseccomp-devel libcap-devel libselinux-devel libwebsockets libwebsockets-devel systemd-devel git chrpath
+
+# dnf install -y cargo rust rust-packaging
+
+cd ~
+
+rm -rf lxc
+git clone https://gitee.com/src-openeuler/lxc.git
+pushd lxc
+rm -rf lxc-4.0.3
+./apply-patches || exit 1
+pushd lxc-4.0.3
+./autogen.sh && ./configure || exit 1
+make -j $(nproc) || exit 1
+make install
+popd
+popd
+
+ldconfig
+rm -rf lcr
+git clone https://gitee.com/openeuler/lcr.git
+pushd lcr
+git checkout ${tbranch}
+rm -rf build
+mkdir build
+pushd build
+cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE ../ || exit 1
+make -j $(nproc) || exit 1
+make install
+popd
+popd
+
+ldconfig
+rm -rf clibcni
+git clone https://gitee.com/openeuler/clibcni.git
+pushd clibcni
+git checkout ${tbranch}
+rm -rf build
+mkdir build
+pushd build
+cmake -DDEBUG=ON ../ || exit 1
+make -j $(nproc) || exit 1
+make install
+popd
+popd
+
+ldconfig
+pushd iSulad
+rm -rf build
+mkdir build
+pushd build
+cmake -DDEBUG=ON -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UT=ON -DENABLE_SHIM_V2=OFF ../ || exit 1
+#cmake -DDEBUG=ON -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UT=ON -DENABLE_SHIM_V2=ON ../ || exit 1
+make -j $(nproc) || exit 1
+ctest -V
+popd
+popd
--
2.25.1

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
From fcc132e592ba1f9c427e02ef6f930eb208a6ebca Mon Sep 17 00:00:00 2001
From: chengzrz <czrzrichard@gmail.com>
Date: Thu, 9 Dec 2021 14:56:39 +0800
Subject: [PATCH] Fixed a bug that occurs when starting container in host mode
Signed-off-by: chengzrz <czrzrichard@gmail.com>
---
src/daemon/modules/spec/specs_namespace.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/daemon/modules/spec/specs_namespace.c b/src/daemon/modules/spec/specs_namespace.c
index eea0b3ff..e9f98d00 100644
--- a/src/daemon/modules/spec/specs_namespace.c
+++ b/src/daemon/modules/spec/specs_namespace.c
@@ -156,7 +156,7 @@ static int handle_get_path_from_host(const host_config *host_spec,
const container_config_v2_common_config_network_settings *network_settings,
const char *type, char **dest_path)
{
- *dest_path = namespace_get_host_namespace_path(host_spec->network_mode);
+ *dest_path = namespace_get_host_namespace_path(type);
if (*dest_path == NULL) {
return -1;
}
@@ -209,6 +209,9 @@ int get_network_namespace_path(const host_config *host_spec,
for (index = 0; index < jump_table_size; ++index) {
if (strncmp(network_mode, handler_jump_table[index].mode, strlen(handler_jump_table[index].mode)) == 0) {
ret = handler_jump_table[index].handle(host_spec, network_settings, type, dest_path);
+ if (ret != 0) {
+ ERROR("Failed to get ns path, network mode is %s, type is %s", network_mode, type);
+ }
return ret;
}
}
--
2.25.1

View File

@ -1,29 +0,0 @@
From f321f120a7b5d987fb12fbca6942b9866a9c7400 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 21 Dec 2021 16:13:49 +0800
Subject: [PATCH 22/23] fix memory leak in CniNetworkPlugin
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/daemon/entry/cri/cni_network_plugin.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/daemon/entry/cri/cni_network_plugin.cc b/src/daemon/entry/cri/cni_network_plugin.cc
index ffdbeb10..b86b21e8 100644
--- a/src/daemon/entry/cri/cni_network_plugin.cc
+++ b/src/daemon/entry/cri/cni_network_plugin.cc
@@ -165,9 +165,10 @@ void CniNetworkPlugin::PlatformInit(Errors &error)
{
char *tpath { nullptr };
char *serr { nullptr };
- tpath = look_path(const_cast<char *>("nsenter"), &serr);
+ tpath = look_path(std::string("nsenter").c_str(), &serr);
if (tpath == nullptr) {
error.SetError(serr);
+ free(serr);
return;
}
m_nsenterPath = tpath;
--
2.25.1

View File

@ -1,26 +0,0 @@
From 8cd3a33c5e0ded33f2e8d3d2bb41f93c298bc2c5 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Mon, 27 Dec 2021 10:07:51 +0800
Subject: [PATCH 23/23] fix codex error
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/image/oci/oci_import.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/daemon/modules/image/oci/oci_import.c b/src/daemon/modules/image/oci/oci_import.c
index ebb555fd..ae2f547a 100644
--- a/src/daemon/modules/image/oci/oci_import.c
+++ b/src/daemon/modules/image/oci/oci_import.c
@@ -256,7 +256,7 @@ static int create_manifest(import_desc *desc)
}
manifest->layers_len = 1;
- manifest->layers[0] = util_common_calloc_s(sizeof(registry_manifest_schema2_layers_element *));
+ manifest->layers[0] = util_common_calloc_s(sizeof(registry_manifest_schema2_layers_element));
if (manifest->layers[0] == NULL) {
ERROR("out of memory");
isulad_try_set_error_message("out of memory");
--
2.25.1

View File

@ -1,816 +0,0 @@
From ce905c49d29446ea9f60d5a9466b7b68e019a03a Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Thu, 30 Dec 2021 09:55:40 +0800
Subject: [PATCH] fix compile error when building embedded image
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
cmake/checker.cmake | 14 ++--
src/CMakeLists.txt | 28 ++++++--
src/cmd/isula/extend/stats.c | 9 +--
src/cmd/isula/main.c | 4 ++
src/cmd/isula/stream/CMakeLists.txt | 11 ++-
src/cmd/isulad/isulad_commands.c | 3 +-
src/cmd/isulad/main.c | 4 ++
.../executor/container_cb/execution_stream.c | 8 ++-
src/daemon/executor/container_cb/list.c | 2 +-
src/daemon/modules/image/CMakeLists.txt | 40 +++++++++--
src/daemon/modules/image/embedded/db/db_all.c | 2 +-
src/daemon/modules/image/embedded/lim.c | 10 +--
src/daemon/modules/log/log_gather.c | 5 +-
src/daemon/modules/plugin/plugin.c | 9 +--
src/daemon/modules/spec/verify.c | 9 +--
src/utils/cutils/utils.c | 2 +-
src/utils/cutils/utils_base64.c | 2 +-
src/utils/tar/CMakeLists.txt | 7 ++
src/utils/tar/isulad_tar.c | 68 ------------------
src/utils/tar/isulad_tar.h | 7 --
src/utils/tar/util_gzip.c | 69 +++++++++++++++++++
src/utils/tar/util_gzip.h | 7 ++
22 files changed, 200 insertions(+), 120 deletions(-)
diff --git a/cmake/checker.cmake b/cmake/checker.cmake
index 7f3ef888..17a324f6 100644
--- a/cmake/checker.cmake
+++ b/cmake/checker.cmake
@@ -56,6 +56,7 @@ find_library(LIBYAJL_LIBRARY yajl
HINTS ${PC_LIBYAJL_LIBDIR} ${PC_LIBYAJL_LIBRARY_DIRS})
_CHECK(LIBYAJL_LIBRARY "LIBYAJL_LIBRARY-NOTFOUND" "libyajl.so")
+if (ENABLE_OCI_IMAGE)
# check libarchive
pkg_check_modules(PC_LIBARCHIVE REQUIRED "libarchive>=3.4")
find_path(LIBARCHIVE_INCLUDE_DIR archive.h
@@ -65,17 +66,18 @@ find_library(LIBARCHIVE_LIBRARY archive
HINTS ${PC_LIBARCHIVE_LIBDIR} ${PC_LIBARCHIVE_LIBRARY_DIRS})
_CHECK(LIBARCHIVE_LIBRARY "LIBARCHIVE_LIBRARY-NOTFOUND" "libarchive.so")
-# check libcrypto
-pkg_check_modules(PC_CRYPTO REQUIRED "libcrypto")
-find_library(CRYPTO_LIBRARY crypto
- HINTS ${PC_CRYPTO_LIBDIR} ${PC_LIBCRYPTO_LIBRARY_DIRS})
-_CHECK(CRYPTO_LIBRARY "CRYPTO_LIBRARY-NOTFOUND" "libcrypto.so")
-
# check websocket
find_path(WEBSOCKET_INCLUDE_DIR libwebsockets.h)
_CHECK(WEBSOCKET_INCLUDE_DIR "WEBSOCKET_INCLUDE_DIR-NOTFOUND" libwebsockets.h)
find_library(WEBSOCKET_LIBRARY websockets)
_CHECK(WEBSOCKET_LIBRARY "WEBSOCKET_LIBRARY-NOTFOUND" "libwebsockets.so")
+endif()
+
+# check libcrypto
+pkg_check_modules(PC_CRYPTO REQUIRED "libcrypto")
+find_library(CRYPTO_LIBRARY crypto
+ HINTS ${PC_CRYPTO_LIBDIR} ${PC_LIBCRYPTO_LIBRARY_DIRS})
+_CHECK(CRYPTO_LIBRARY "CRYPTO_LIBRARY-NOTFOUND" "libcrypto.so")
find_path(HTTP_PARSER_INCLUDE_DIR http_parser.h)
_CHECK(HTTP_PARSER_INCLUDE_DIR "HTTP_PARSER_INCLUDE_DIR-NOTFOUND" "http_parser.h")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 034190a3..1401784b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -73,14 +73,19 @@ set_target_properties(libisula PROPERTIES PREFIX "")
target_link_libraries(libisula
${LIBYAJL_LIBRARY}
- ${SELINUX_LIBRARY}
${ISULA_LIBUTILS_LIBRARY}
- ${LIBARCHIVE_LIBRARY}
${LIBTAR_LIBRARY}
- ${WEBSOCKET_LIBRARY}
${CRYPTO_LIBRARY}
)
+if (ENABLE_OCI_IMAGE)
+ target_link_libraries(libisula ${LIBARCHIVE_LIBRARY} ${WEBSOCKET_LIBRARY})
+endif()
+
+if (ENABLE_SELINUX)
+ target_link_libraries(libisula ${SELINUX_LIBRARY})
+endif()
+
if (ENABLE_SHIM_V2)
target_link_libraries(libisula ${LIBSHIM_V2_LIBRARY})
endif()
@@ -110,7 +115,12 @@ add_executable(isulad-shim
${SHARED_SRCS}
)
target_include_directories(isulad-shim PUBLIC ${ISULAD_SHIM_INCS} ${SHARED_INCS})
-target_link_libraries(isulad-shim ${LIBYAJL_LIBRARY} ${ISULA_LIBUTILS_LIBRARY} ${LIBARCHIVE_LIBRARY} ${LIBTAR_LIBRARY} ${ZLIB_LIBRARY} ${CRYPTO_LIBRARY} -lpthread)
+
+target_link_libraries(isulad-shim ${LIBYAJL_LIBRARY} ${ISULA_LIBUTILS_LIBRARY} ${LIBTAR_LIBRARY} ${ZLIB_LIBRARY} ${CRYPTO_LIBRARY} -lpthread)
+
+if (ENABLE_OCI_IMAGE)
+ target_link_libraries(isulad-shim ${LIBARCHIVE_LIBRARY})
+endif()
# ------ build isula-shim finish -------
@@ -132,7 +142,15 @@ target_include_directories(isulad PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/utils/http
)
-target_link_libraries(isulad ${LIBYAJL_LIBRARY} ${SYSTEMD_LIBRARY} ${SELINUX_LIBRARY} ${LIBARCHIVE_LIBRARY} ${LIBTAR_LIBRARY} ${WEBSOCKET_LIBRARY} ${CRYPTO_LIBRARY})
+target_link_libraries(isulad ${LIBYAJL_LIBRARY} ${SYSTEMD_LIBRARY} ${LIBTAR_LIBRARY} ${CRYPTO_LIBRARY})
+
+if (ENABLE_OCI_IMAGE)
+ target_link_libraries(isulad ${LIBARCHIVE_LIBRARY} ${WEBSOCKET_LIBRARY})
+endif()
+
+if (ENABLE_SELINUX)
+ target_link_libraries(isulad ${SELINUX_LIBRARY})
+endif()
target_link_libraries(isulad -ldl ${ZLIB_LIBRARY} ${ISULA_LIBUTILS_LIBRARY} -lpthread libhttpclient)
diff --git a/src/cmd/isula/extend/stats.c b/src/cmd/isula/extend/stats.c
index 35458f14..21ea34b9 100644
--- a/src/cmd/isula/extend/stats.c
+++ b/src/cmd/isula/extend/stats.c
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <unistd.h>
#include <string.h>
+#include <inttypes.h>
#include "client_arguments.h"
#include "utils.h"
@@ -171,10 +172,10 @@ static void stats_print_original_data(const struct isula_container_info *stats)
short_id[SHORTIDLEN] = '\0';
}
- printf("%-16s %-10llu %-10s %-20lu %-20lu %-15u %-15lu %-15lu %-15lu %-15lu %-15lu %-15lu %-40s", short_id,
- (unsigned long long)stats->pids_current, stats->status, stats->cpu_use_nanos, stats->cpu_system_use,
- stats->online_cpus, stats->blkio_read, stats->blkio_write, stats->mem_used, stats->mem_limit,
- stats->kmem_used, stats->cache, stats->name);
+ printf("%-16s %-10" PRIu64 " %-10s %-20" PRIu64 " %-20" PRIu64 " %-15u %-15" PRIu64 " %-15" PRIu64 " %-15" PRIu64
+ " %-15" PRIu64 " %-15" PRIu64 " %-15" PRIu64 " %-40s", short_id, stats->pids_current, stats->status,
+ stats->cpu_use_nanos, stats->cpu_system_use, stats->online_cpus, stats->blkio_read, stats->blkio_write,
+ stats->mem_used, stats->mem_limit, stats->kmem_used, stats->cache, stats->name);
free(short_id);
}
diff --git a/src/cmd/isula/main.c b/src/cmd/isula/main.c
index a69df5d5..4e7cf1ca 100644
--- a/src/cmd/isula/main.c
+++ b/src/cmd/isula/main.c
@@ -203,6 +203,7 @@ struct command g_commands[] = {
{ NULL, false, NULL, NULL, NULL, NULL } // End of the list
};
+#ifdef ENABLE_OCI_IMAGE
static int set_locale()
{
int ret = 0;
@@ -217,12 +218,15 @@ static int set_locale()
out:
return ret;
}
+#endif
int main(int argc, char **argv)
{
+#ifdef ENABLE_OCI_IMAGE
if (set_locale() != 0) {
exit(ECOMMON);
}
+#endif
if (connect_client_ops_init()) {
return ECOMMON;
diff --git a/src/cmd/isula/stream/CMakeLists.txt b/src/cmd/isula/stream/CMakeLists.txt
index 332435bc..eeb7e4dd 100644
--- a/src/cmd/isula/stream/CMakeLists.txt
+++ b/src/cmd/isula/stream/CMakeLists.txt
@@ -1,7 +1,14 @@
# get current directory sources files
-aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_stream_srcs)
+aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} local_isula_stream_srcs)
+
+# use a separate micro defination for libarchive
+if (DISABLE_OCI)
+ list(REMOVE_ITEM local_isula_stream_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/cp.c
+ )
+endif()
set(ISULA_STREAM_SRCS
- ${isula_stream_srcs}
+ ${local_isula_stream_srcs}
PARENT_SCOPE
)
diff --git a/src/cmd/isulad/isulad_commands.c b/src/cmd/isulad/isulad_commands.c
index c2826c83..b37c7208 100644
--- a/src/cmd/isulad/isulad_commands.c
+++ b/src/cmd/isulad/isulad_commands.c
@@ -19,6 +19,7 @@
#include <limits.h>
#include <isula_libutils/host_config.h>
#include <strings.h>
+#include <inttypes.h>
#include "config.h"
#include "isula_libutils/log.h"
@@ -250,7 +251,7 @@ static int check_args_log_conf(const struct service_arguments *args)
/* validate max-size */
if ((args->json_confs->log_driver && strcasecmp("file", args->json_confs->log_driver) == 0) &&
(args->max_size < (4 * 1024))) {
- ERROR("Max-size \"%ld\" must large than 4KB.", args->max_size);
+ ERROR("Max-size \"%" PRId64 "\" must large than 4KB.", args->max_size);
ret = -1;
goto out;
}
diff --git a/src/cmd/isulad/main.c b/src/cmd/isulad/main.c
index c981bf1c..16a4f15b 100644
--- a/src/cmd/isulad/main.c
+++ b/src/cmd/isulad/main.c
@@ -1448,6 +1448,7 @@ out:
return ret;
}
+#ifdef ENABLE_OCI_IMAGE
static int set_locale()
{
int ret = 0;
@@ -1462,6 +1463,7 @@ static int set_locale()
out:
return ret;
}
+#endif
/*
* Takes socket path as argument
@@ -1478,9 +1480,11 @@ int main(int argc, char **argv)
exit(ECOMMON);
}
+#ifdef ENABLE_OCI_IMAGE
if (set_locale() != 0) {
exit(ECOMMON);
}
+#endif
http_global_init();
diff --git a/src/daemon/executor/container_cb/execution_stream.c b/src/daemon/executor/container_cb/execution_stream.c
index 4b6cdb10..0921eb19 100644
--- a/src/daemon/executor/container_cb/execution_stream.c
+++ b/src/daemon/executor/container_cb/execution_stream.c
@@ -40,6 +40,7 @@
#include <string.h>
#include <sys/prctl.h>
#include <time.h>
+#include <inttypes.h>
#include "isula_libutils/log.h"
#include "io_wrapper.h"
@@ -343,6 +344,7 @@ pack_response:
return (cc == ISULAD_SUCCESS) ? 0 : -1;
}
+#ifdef ENABLE_OCI_IMAGE
static int copy_from_container_cb_check(const struct isulad_copy_from_container_request *request,
struct isulad_copy_from_container_response **response, container_t **cont)
{
@@ -963,6 +965,7 @@ pack_response:
free(dst_base);
return ret;
}
+#endif
static int container_logs_cb_check(const struct isulad_logs_request *request, struct isulad_logs_response *response)
{
@@ -1626,7 +1629,8 @@ static int container_logs_cb(const struct isulad_logs_request *request, stream_f
goto out;
}
- EVENT("Event: {Object: %s, Content: path: %s, rotate: %d, size: %ld }", id, log_config->path, log_config->rotate,
+ EVENT("Event: {Object: %s, Content: path: %s, rotate: %d, size: %" PRId64 " }", id, log_config->path,
+ log_config->rotate,
log_config->size);
nret = check_log_config(log_config);
@@ -1670,7 +1674,9 @@ void container_stream_callback_init(service_container_callback_t *cb)
{
cb->attach = container_attach_cb;
cb->exec = container_exec_cb;
+#ifdef ENABLE_OCI_IMAGE
cb->copy_from_container = copy_from_container_cb;
cb->copy_to_container = copy_to_container_cb;
+#endif
cb->logs = container_logs_cb;
}
diff --git a/src/daemon/executor/container_cb/list.c b/src/daemon/executor/container_cb/list.c
index d8f26328..67fef06e 100644
--- a/src/daemon/executor/container_cb/list.c
+++ b/src/daemon/executor/container_cb/list.c
@@ -620,7 +620,7 @@ static int pack_list_containers(char **idsarray, const struct list_context *ctx,
}
if (container_nums > (SIZE_MAX / sizeof(container_container *))) {
- ERROR("Get too many containers:%ld", container_nums);
+ ERROR("Get too many containers:%zu", container_nums);
ret = -1;
goto out;
}
diff --git a/src/daemon/modules/image/CMakeLists.txt b/src/daemon/modules/image/CMakeLists.txt
index 14ce571d..bfab0334 100644
--- a/src/daemon/modules/image/CMakeLists.txt
+++ b/src/daemon/modules/image/CMakeLists.txt
@@ -45,7 +45,7 @@ set(IMAGE_INCS
# set sources and headers for libisulad_img
set(LIB_ISULAD_IMG libisulad_img)
-add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
+set(LIB_ISULAD_IMG_SRCS
${local_image_srcs}
${CMAKE_SOURCE_DIR}/src/utils/cutils/utils.c
${CMAKE_SOURCE_DIR}/src/utils/cutils/utils_regex.c
@@ -66,15 +66,29 @@ add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
${CMAKE_SOURCE_DIR}/src/utils/sha256/sha256.c
${CMAKE_SOURCE_DIR}/src/utils/buffer/buffer.c
${CMAKE_SOURCE_DIR}/src/daemon/common/err_msg.c
- ${CMAKE_SOURCE_DIR}/src/daemon/common/selinux_label.c
${CMAKE_SOURCE_DIR}/src/daemon/common/sysinfo.c
- ${CMAKE_SOURCE_DIR}/src/utils/tar/isulad_tar.c
- ${CMAKE_SOURCE_DIR}/src/utils/tar/util_archive.c
${CMAKE_SOURCE_DIR}/src/utils/tar/util_gzip.c
${CMAKE_SOURCE_DIR}/src/daemon/config/isulad_config.c
${CMAKE_SOURCE_DIR}/src/daemon/config/daemon_arguments.c
)
+if (ENALBE_SELINUX)
+ list(APPEND LIB_ISULAD_IMG_SRCS
+ ${CMAKE_SOURCE_DIR}/src/daemon/common/selinux_label.c
+ )
+endif()
+
+if (ENABLE_OCI_IMAGE)
+ list(APPEND LIB_ISULAD_IMG_SRCS
+ ${CMAKE_SOURCE_DIR}/src/utils/tar/isulad_tar.c
+ ${CMAKE_SOURCE_DIR}/src/utils/tar/util_archive.c
+ )
+endif()
+
+add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
+ ${LIB_ISULAD_IMG_SRCS}
+ )
+
target_include_directories(${LIB_ISULAD_IMG} PUBLIC
${local_image_incs}
${CMAKE_SOURCE_DIR}/src/daemon/modules/api
@@ -97,9 +111,21 @@ target_link_libraries(${LIB_ISULAD_IMG}
${ISULA_LIBUTILS_LIBRARY}
${DEVMAPPER_LIBRARY}
${LIBTAR_LIBRARY}
- ${SELINUX_LIBRARY}
- ${LIBARCHIVE_LIBRARY}
- -lpthread -lcrypto -lz libhttpclient)
+ ${CRYPTO_LIBRARY}
+ ${ZLIB_LIBRARY}
+ -lpthread libhttpclient)
+
+if (ENABLE_OCI_IMAGE)
+ target_link_libraries(${LIB_ISULAD_IMG}
+ ${LIBARCHIVE_LIBRARY}
+ )
+endif()
+
+if (ENALBE_SELINUX)
+ target_link_libraries(${LIB_ISULAD_IMG}
+ ${SELINUX_LIBRARY}
+ )
+endif()
target_compile_definitions(${LIB_ISULAD_IMG} PRIVATE LIB_ISULAD_IMG_SO)
diff --git a/src/daemon/modules/image/embedded/db/db_all.c b/src/daemon/modules/image/embedded/db/db_all.c
index 9a611589..47e6e2e0 100644
--- a/src/daemon/modules/image/embedded/db/db_all.c
+++ b/src/daemon/modules/image/embedded/db/db_all.c
@@ -694,7 +694,7 @@ static int read_all_images_info(sqlite3_stmt *stmt, void **data)
goto cleanup;
}
if ((*imagesinfo)->imagesnum > (SIZE_MAX / sizeof(struct db_image *) - 1)) {
- ERROR("List of images is too long:%ld", (*imagesinfo)->imagesnum);
+ ERROR("List of images is too long:%zu", (*imagesinfo)->imagesnum);
goto cleanup;
}
oldsize = (*imagesinfo)->imagesnum * sizeof(struct db_image *);
diff --git a/src/daemon/modules/image/embedded/lim.c b/src/daemon/modules/image/embedded/lim.c
index a3834d3c..538cfff6 100644
--- a/src/daemon/modules/image/embedded/lim.c
+++ b/src/daemon/modules/image/embedded/lim.c
@@ -196,7 +196,7 @@ static bool validate_layer_path_in_host_real(size_t layer_index, char *path_in_h
}
if (!util_valid_file(real_path, fmod)) {
- ERROR("invalid path in host %s, real path is %s, layer %ld", path_in_host, real_path, layer_index);
+ ERROR("invalid path in host %s, real path is %s, layer %zu", path_in_host, real_path, layer_index);
if (fmod == (uint32_t)S_IFREG) {
isulad_try_set_error_message(
"Invalid content in manifest: layer(except first layer) is not a regular file");
@@ -218,13 +218,13 @@ static bool validate_layer_path_in_host(size_t layer_index, const char *location
if (layer_index == 0) {
/* layer 0 is absolute path of rootfs device or host / */
if (!valid_absolute_path(path_in_host)) {
- ERROR("path in host %s not a absolute path, layer %lu", path_in_host, layer_index);
+ ERROR("path in host %s not a absolute path, layer %zu", path_in_host, layer_index);
isulad_try_set_error_message("Invalid content in manifest: first layer path in host must be absolute path");
return false;
}
if ((int)fmod == S_IFDIR && strcmp(path_in_host, "/") != 0) {
- ERROR("expected / as root, got %s, layer %lu", path_in_host, layer_index);
+ ERROR("expected / as root, got %s, layer %zu", path_in_host, layer_index);
isulad_try_set_error_message("Invalid content in manifest: first layer path in host must be /");
return false;
}
@@ -235,7 +235,7 @@ static bool validate_layer_path_in_host(size_t layer_index, const char *location
char parent_location[PATH_MAX] = { 0 };
int sret = 0;
if (!valid_relative_path(path_in_host)) {
- ERROR("path in host %s not a relative path, layer %lu", path_in_host, layer_index);
+ ERROR("path in host %s not a relative path, layer %zu", path_in_host, layer_index);
isulad_try_set_error_message("Invalid content in manifest:"
" layer path in host(except first layer) must be relative path");
return false;
@@ -409,7 +409,7 @@ static bool validate_image_name(char *image_name)
static bool validate_image_layers_number(size_t layers_len)
{
if (layers_len > LAYER_NUM_MAX || layers_len < 1) {
- ERROR("invalid layers number %ld maxium is %d", layers_len, LAYER_NUM_MAX);
+ ERROR("invalid layers number %zu maxium is %d", layers_len, LAYER_NUM_MAX);
isulad_try_set_error_message("Invalid content in manifest: layer empty or max depth exceeded");
return false;
}
diff --git a/src/daemon/modules/log/log_gather.c b/src/daemon/modules/log/log_gather.c
index b9813917..51c112a3 100644
--- a/src/daemon/modules/log/log_gather.c
+++ b/src/daemon/modules/log/log_gather.c
@@ -26,11 +26,12 @@
#include <stdio.h>
#include <strings.h>
#include <sys/prctl.h>
+#include <inttypes.h>
#include "log_gather_api.h"
#include "isula_libutils/log.h"
#include "utils.h"
-#include "isulad_tar.h"
+#include "util_gzip.h"
#include "utils_file.h"
typedef int (*log_save_t)(const void *buf, size_t count);
@@ -223,7 +224,7 @@ static int check_log_file()
if (ret != 0) {
COMMAND_ERROR("Rotate log file %s failed.", g_log_file);
} else {
- INFO("Log file large than %lu, rotate it.", g_max_size);
+ INFO("Log file large than %" PRIu64", rotate it.", g_max_size);
}
} else {
ret = 0;
diff --git a/src/daemon/modules/plugin/plugin.c b/src/daemon/modules/plugin/plugin.c
index 25326567..9fe6dc8b 100644
--- a/src/daemon/modules/plugin/plugin.c
+++ b/src/daemon/modules/plugin/plugin.c
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/select.h>
+#include <inttypes.h>
#include "isula_libutils/log.h"
#include "plugin_api.h"
@@ -519,7 +520,7 @@ static int pm_register_plugin(const char *name, const char *addr)
goto failed;
}
- INFO("add activated plugin %s 0x%lx", plugin->name, plugin->manifest->watch_event);
+ INFO("add activated plugin %s 0x%" PRIx64, plugin->name, plugin->manifest->watch_event);
return 0;
failed:
@@ -854,7 +855,7 @@ bool plugin_is_watching(plugin_t *plugin, uint64_t pe)
}
plugin_unlock(plugin);
- INFO("plugin %s watching=%s for event 0x%lx", plugin->name, (ok ? "true" : "false"), pe);
+ INFO("plugin %s watching=%s for event 0x%" PRIx64, plugin->name, (ok ? "true" : "false"), pe);
return ok;
}
@@ -885,7 +886,7 @@ static int unpack_activate_response(const struct parsed_http_message *message, v
goto out;
}
- INFO("get resp 0x%lx", resp->watch_event);
+ INFO("get resp 0x%" PRIx64, resp->watch_event);
manifest->init_type = resp->init_type;
manifest->watch_event = resp->watch_event;
@@ -1371,7 +1372,7 @@ static int plugin_event_handle_dispath_impl(const char *cid, const char *plugins
ret = plugin_event_post_remove_handle(plugin, cid);
break;
default:
- ERROR("plugin event %ld not support.", pe);
+ ERROR("plugin event %" PRIu64 " not support.", pe);
ret = -1;
break;
}
diff --git a/src/daemon/modules/spec/verify.c b/src/daemon/modules/spec/verify.c
index 57501cde..245beb8b 100644
--- a/src/daemon/modules/spec/verify.c
+++ b/src/daemon/modules/spec/verify.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <linux/oom.h>
+#include <inttypes.h>
#include "constants.h"
#include "err_msg.h"
@@ -962,8 +963,8 @@ static bool check_hugetlbs_repeated(size_t newlen, const char *pagesize,
for (j = 0; j < newlen; j++) {
if (newtlb[j] != NULL && newtlb[j]->page_size != NULL && !strcmp(newtlb[j]->page_size, pagesize)) {
- WARN("hugetlb-limit setting of %s is repeated, former setting %lu will be replaced with %lu", pagesize,
- newtlb[j]->limit, hugetlb->limit);
+ WARN("hugetlb-limit setting of %s is repeated, former setting %" PRIu64 " will be replaced with %" PRIu64,
+ pagesize, newtlb[j]->limit, hugetlb->limit);
newtlb[j]->limit = hugetlb->limit;
repeated = true;
goto out;
@@ -1090,7 +1091,7 @@ static int verify_resources_device(defs_resources *resources)
for (i = 0; i < resources->devices_len; i++) {
if (!util_valid_device_mode(resources->devices[i]->access)) {
- ERROR("Invalid device mode \"%s\" for device \"%ld %ld\"", resources->devices[i]->access,
+ ERROR("Invalid device mode \"%s\" for device \"%" PRId64" %" PRId64 "\"", resources->devices[i]->access,
resources->devices[i]->major, resources->devices[i]->minor);
isulad_set_error_message("Invalid device mode \"%s\" for device \"%ld %ld\"", resources->devices[i]->access,
resources->devices[i]->major, resources->devices[i]->minor);
@@ -1678,7 +1679,7 @@ static int add_hugetbl_element(host_config_hugetlbs_element ***hugetlb, size_t *
for (j = 0; j < *len; j++) {
if (strcmp((*hugetlb)[j]->page_size, pagesize) == 0) {
WARN("Hostconfig: hugetlb-limit setting of %s is repeated, "
- "former setting %lu will be replaced with %lu",
+ "former setting %" PRIu64 " will be replaced with %" PRIu64,
pagesize, (*hugetlb)[j]->limit, element->limit);
(*hugetlb)[j]->limit = element->limit;
goto out;
diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c
index 511cde96..850b2329 100644
--- a/src/utils/cutils/utils.c
+++ b/src/utils/cutils/utils.c
@@ -1358,7 +1358,7 @@ int util_normalized_host_os_arch(char **host_os, char **host_arch, char **host_v
*host_arch = util_strdup_s("arm64");
} else if ((strcasecmp("armhf", uts.machine) == 0) || (strcasecmp("armel", uts.machine) == 0)) {
*host_arch = util_strdup_s("arm");
- } else if ((strcasecmp("mips64le", uts.machine) == 0) || (strcasecmp("mips64el", uts.machine) == 0)) {
+ } else if ((strcasecmp("mips64le", uts.machine) == 0) || (strcasecmp("mips64el", uts.machine) == 0)) {
*host_arch = util_strdup_s("mips64le");
} else {
*host_arch = util_strdup_s(uts.machine);
diff --git a/src/utils/cutils/utils_base64.c b/src/utils/cutils/utils_base64.c
index 2eb6b6bd..a2b0d7a4 100644
--- a/src/utils/cutils/utils_base64.c
+++ b/src/utils/cutils/utils_base64.c
@@ -115,7 +115,7 @@ size_t util_base64_decode_len(const char *input, size_t len)
size_t padding_count = 0;
if (input == NULL || len < 4 || len % 4 != 0) {
- ERROR("Invalid param for base64 decode length, length is %ld", len);
+ ERROR("Invalid param for base64 decode length, length is %zu", len);
return -1;
}
diff --git a/src/utils/tar/CMakeLists.txt b/src/utils/tar/CMakeLists.txt
index 0f3a56c1..97532ad1 100644
--- a/src/utils/tar/CMakeLists.txt
+++ b/src/utils/tar/CMakeLists.txt
@@ -1,6 +1,13 @@
# get current directory sources files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} local_tar_srcs)
+if (DISABLE_OCI)
+ list(REMOVE_ITEM local_tar_srcs
+ ${CMAKE_CURRENT_SOURCE_DIR}/util_archive.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/isulad_tar.c
+ )
+endif()
+
set(TAR_SRCS
${local_tar_srcs}
PARENT_SCOPE
diff --git a/src/utils/tar/isulad_tar.c b/src/utils/tar/isulad_tar.c
index 03277373..228e091a 100644
--- a/src/utils/tar/isulad_tar.c
+++ b/src/utils/tar/isulad_tar.c
@@ -19,8 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/wait.h>
#include <limits.h>
#include <sys/stat.h>
#include <errno.h>
@@ -50,72 +48,6 @@ void free_archive_copy_info(struct archive_copy_info *info)
free(info);
}
-/*
- * compress file.
- * param filename: archive file to compres.
- * return: zero if compress success, non-zero if not.
- */
-int gzip(const char *filename, size_t len)
-{
- int pipefd[2] = { -1, -1 };
- int status = 0;
- pid_t pid = 0;
-
- if (filename == NULL) {
- return -1;
- }
- if (len == 0) {
- return -1;
- }
-
- if (pipe2(pipefd, O_CLOEXEC) != 0) {
- ERROR("Failed to create pipe\n");
- return -1;
- }
-
- pid = fork();
- if (pid == -1) {
- ERROR("Failed to fork()\n");
- close(pipefd[0]);
- close(pipefd[1]);
- return -1;
- }
-
- if (pid == 0) {
- // child process, dup2 pipefd[1] to stderr
- close(pipefd[0]);
- dup2(pipefd[1], 2);
-
- if (!util_valid_cmd_arg(filename)) {
- fprintf(stderr, "Invalid filename: %s\n", filename);
- exit(EXIT_FAILURE);
- }
-
- execlp("gzip", "gzip", "-f", filename, NULL);
-
- fprintf(stderr, "Failed to exec gzip");
- exit(EXIT_FAILURE);
- }
-
- ssize_t size_read = 0;
- char buffer[BUFSIZ] = { 0 };
-
- close(pipefd[1]);
-
- if (waitpid(pid, &status, 0) != pid) {
- close(pipefd[0]);
- return -1;
- }
-
- size_read = read(pipefd[0], buffer, BUFSIZ);
- close(pipefd[0]);
-
- if (size_read) {
- ERROR("Received error:\n%s", buffer);
- }
- return status;
-}
-
static int get_rebase_name(const char *path, const char *real_path, char **resolved_path, char **rebase_name)
{
int nret;
diff --git a/src/utils/tar/isulad_tar.h b/src/utils/tar/isulad_tar.h
index c773fe9b..31d2d24a 100644
--- a/src/utils/tar/isulad_tar.h
+++ b/src/utils/tar/isulad_tar.h
@@ -47,13 +47,6 @@ struct archive_tar_resource_rebase_opts {
char *include_file;
};
-/*
- * compress file.
- * param filename : archive file to compres.
- * return: zero if compress success, non-zero if not.
- */
-int gzip(const char *filename, size_t len);
-
struct archive_copy_info *copy_info_source_path(const char *path, bool follow_link, char **err);
char *prepare_archive_copy(const struct archive_copy_info *srcinfo, const struct archive_copy_info *dstinfo,
diff --git a/src/utils/tar/util_gzip.c b/src/utils/tar/util_gzip.c
index 8733bcbc..9b17e9d7 100644
--- a/src/utils/tar/util_gzip.c
+++ b/src/utils/tar/util_gzip.c
@@ -16,6 +16,8 @@
#include "util_gzip.h"
#include <zlib.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "utils.h"
#include "isula_libutils/log.h"
@@ -151,3 +153,70 @@ out:
return ret;
}
+
+/*
+ * compress file.
+ * param filename: archive file to compres.
+ * return: zero if compress success, non-zero if not.
+ */
+int gzip(const char *filename, size_t len)
+{
+ int pipefd[2] = { -1, -1 };
+ int status = 0;
+ pid_t pid = 0;
+
+ if (filename == NULL) {
+ return -1;
+ }
+ if (len == 0) {
+ return -1;
+ }
+
+ if (pipe2(pipefd, O_CLOEXEC) != 0) {
+ ERROR("Failed to create pipe\n");
+ return -1;
+ }
+
+ pid = fork();
+ if (pid == -1) {
+ ERROR("Failed to fork()\n");
+ close(pipefd[0]);
+ close(pipefd[1]);
+ return -1;
+ }
+
+ if (pid == 0) {
+ // child process, dup2 pipefd[1] to stderr
+ close(pipefd[0]);
+ dup2(pipefd[1], 2);
+ dup2(pipefd[1], 2);
+
+ if (!util_valid_cmd_arg(filename)) {
+ fprintf(stderr, "Invalid filename: %s\n", filename);
+ exit(EXIT_FAILURE);
+ }
+
+ execlp("gzip", "gzip", "-f", filename, NULL);
+
+ fprintf(stderr, "Failed to exec gzip");
+ exit(EXIT_FAILURE);
+ }
+
+ ssize_t size_read = 0;
+ char buffer[BUFSIZ] = { 0 };
+
+ close(pipefd[1]);
+
+ if (waitpid(pid, &status, 0) != pid) {
+ close(pipefd[0]);
+ return -1;
+ }
+
+ size_read = read(pipefd[0], buffer, BUFSIZ);
+ close(pipefd[0]);
+
+ if (size_read) {
+ ERROR("Received error:\n%s", buffer);
+ }
+ return status;
+}
diff --git a/src/utils/tar/util_gzip.h b/src/utils/tar/util_gzip.h
index 637997bd..7d881e92 100644
--- a/src/utils/tar/util_gzip.h
+++ b/src/utils/tar/util_gzip.h
@@ -28,6 +28,13 @@ int util_gzip_z(const char *srcfile, const char *dstfile, const mode_t mode);
// Decompress
int util_gzip_d(const char *srcfile, const FILE *destfp);
+/*
+ * compress file.
+ * param filename: archive file to compres.
+ * return: zero if compress success, non-zero if not.
+ */
+int gzip(const char *filename, size_t len);
+
#ifdef __cplusplus
}
#endif
--
2.25.1

View File

@ -1,61 +0,0 @@
From e24056c1c09eecace5197feb813fe29e19e30ede Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 11 Jan 2022 10:00:37 +0800
Subject: [PATCH] fix compile error with grpc 1.41.x
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
cmake/checker.cmake | 2 ++
src/CMakeLists.txt | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/cmake/checker.cmake b/cmake/checker.cmake
index 17a324f6..946ee730 100644
--- a/cmake/checker.cmake
+++ b/cmake/checker.cmake
@@ -147,6 +147,8 @@ if (GRPC_CONNECTOR OR ENABLE_OCI_IMAGE)
_CHECK(GRPC_LIBRARY "GRPC_LIBRARY-NOTFOUND" "libgrpc.so")
find_library(GPR_LIBRARY gpr)
_CHECK(GPR_LIBRARY "GPR_LIBRARY-NOTFOUND" "libgpr.so")
+ # no check
+ find_library(ABSL_SYNC_LIB absl_synchronization)
# check devmapper
find_path(DEVMAPPER_INCLUDE_DIR libdevmapper.h)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1401784b..30f451d4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -95,6 +95,9 @@ if (GRPC_CONNECTOR)
target_link_libraries(libisula -Wl,--as-needed -lstdc++)
target_link_libraries(libisula -Wl,--as-needed ${PROTOBUF_LIBRARY})
target_link_libraries(libisula -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
+ if(ABSL_SYNC_LIB)
+ target_link_libraries(libisula -Wl,--no-as-needed ${ABSL_SYNC_LIB})
+ endif()
else()
target_link_libraries(libisula ${EVHTP_LIBRARY} ${EVENT_LIBRARY} ${ZLIB_LIBRARY} -ldl libhttpclient)
endif()
@@ -167,6 +170,9 @@ if (GRPC_CONNECTOR)
target_link_libraries(isulad -Wl,--as-needed -lstdc++)
target_link_libraries(isulad -Wl,--as-needed ${PROTOBUF_LIBRARY})
target_link_libraries(isulad -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
+ if(ABSL_SYNC_LIB)
+ target_link_libraries(isulad -Wl,--no-as-needed ${ABSL_SYNC_LIB})
+ endif()
target_link_libraries(isulad ${CLIBCNI_LIBRARY})
else()
message("Restful iSulad")
@@ -182,6 +188,9 @@ if (ENABLE_OCI_IMAGE)
target_link_libraries(isulad -Wl,--as-needed -ldevmapper)
target_link_libraries(isulad -Wl,--as-needed ${PROTOBUF_LIBRARY})
target_link_libraries(isulad -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
+ if(ABSL_SYNC_LIB)
+ target_link_libraries(isulad -Wl,--no-as-needed ${ABSL_SYNC_LIB})
+ endif()
endif()
if (ISULAD_GCOV)
--
2.25.1

View File

@ -1,35 +0,0 @@
From b13bdf63b048f49e2e269737073e8f5b894cd3aa Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Wed, 12 Jan 2022 14:16:41 +0800
Subject: [PATCH] fix compile error of isula-transform
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/image/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/daemon/modules/image/CMakeLists.txt b/src/daemon/modules/image/CMakeLists.txt
index bfab0334..315014d6 100644
--- a/src/daemon/modules/image/CMakeLists.txt
+++ b/src/daemon/modules/image/CMakeLists.txt
@@ -72,7 +72,7 @@ set(LIB_ISULAD_IMG_SRCS
${CMAKE_SOURCE_DIR}/src/daemon/config/daemon_arguments.c
)
-if (ENALBE_SELINUX)
+if (ENABLE_SELINUX)
list(APPEND LIB_ISULAD_IMG_SRCS
${CMAKE_SOURCE_DIR}/src/daemon/common/selinux_label.c
)
@@ -121,7 +121,7 @@ if (ENABLE_OCI_IMAGE)
)
endif()
-if (ENALBE_SELINUX)
+if (ENABLE_SELINUX)
target_link_libraries(${LIB_ISULAD_IMG}
${SELINUX_LIBRARY}
)
--
2.25.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.10 %global _version 2.0.11
%global _release 15 %global _release 1
%global is_systemd 1 %global is_systemd 1
%global enable_shimv2 1 %global enable_shimv2 1
%global is_embedded 1 %global is_embedded 1
@ -13,33 +13,6 @@ URL: https://gitee.com/openeuler/iSulad
Source: https://gitee.com/openeuler/iSulad/repository/archive/v%{version}.tar.gz Source: https://gitee.com/openeuler/iSulad/repository/archive/v%{version}.tar.gz
BuildRoot: {_tmppath}/iSulad-%{version} BuildRoot: {_tmppath}/iSulad-%{version}
Patch0001: 0001-add-self-def-runtime-for-shimv2.patch
Patch0002: 0002-fix-memleak-when-use-multiple-volumes-from.patch
Patch0003: 0003-Modified-the-procedure-of-running-a-pod-to-adapt-to-.patch
Patch0004: 0004-add-new-function-mock-for-ut.patch
Patch0005: 0005-delete-isulad-h-flag.patch
Patch0006: 0006-Fix-memory-leak-in-ClearCniNetwork-when-calling-get_.patch
Patch0007: 0007-fix-cri-libwebsockets-sync_close_sem-memory-leak.patch
Patch0008: 0008-fix-cpu-variant-get-error.patch
Patch0009: 0009-fix-unit-test-error-of-registry-in-armv8.patch
Patch0010: 0010-Modified-cmakelist-of-storage_layer-and-added-a-new-.patch
Patch0011: 0011-add-fuzz-build-in-CI.patch
Patch0012: 0012-print-valgrind-log.patch
Patch0013: 0013-fix-cri-version-memory-leak.patch
Patch0014: 0014-fix-undefined-reference-in-libisulad_img.so.patch
Patch0015: 0015-fix-undefined-reference-to-service_arguments_free-in.patch
Patch0016: 0016-fix-mem-leak.patch
Patch0017: 0017-isula-pull-does-not-support-format-name-digest.patch
Patch0018: 0018-Fixed-dangerous-memory-operations.patch
Patch0019: 0019-add-pull-request-gateway-checker-for-build-and-ut.patch
Patch0020: 0020-Optimize-websocket-streaming-service-code.patch
Patch0021: 0021-Fixed-a-bug-that-occurs-when-starting-container-in-h.patch
Patch0022: 0022-fix-memory-leak-in-CniNetworkPlugin.patch
Patch0023: 0023-fix-codex-error.patch
Patch0024: 0024-fix-compile-error-when-building-embedded-image.patch
Patch0025: 0025-fix-compile-error-with-grpc-1.41.x.patch
Patch0026: 0026-fix-compile-error-of-isula-transform.patch
%ifarch x86_64 aarch64 %ifarch x86_64 aarch64
Provides: libhttpclient.so()(64bit) Provides: libhttpclient.so()(64bit)
Provides: libisula.so()(64bit) Provides: libisula.so()(64bit)
@ -62,8 +35,8 @@ BuildRequires: sqlite-devel
Requires: sqlite Requires: sqlite
%endif %endif
%define lcrver 2.0.6 %define lcrver 2.0.7
%define clibcniver 2.0.6 %define clibcniver 2.0.7
BuildRequires: lcr-devel >= %{lcrver} clibcni-devel >= %{clibcniver} BuildRequires: lcr-devel >= %{lcrver} clibcni-devel >= %{clibcniver}
@ -93,7 +66,7 @@ This is a umbrella project for gRPC-services based Lightweight Container
Runtime Daemon, written by C. Runtime Daemon, written by C.
%prep %prep
%autosetup -n %{name} -Sgit -p1 %autosetup -n iSulad-v%{_version} -Sgit -p1
%build %build
mkdir -p build mkdir -p build
@ -263,6 +236,12 @@ fi
%endif %endif
%changelog %changelog
* Thu Feb 24 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.11-1
- Type: enhancement
- ID: NA
- SUG: NA
- DESC: update version to v2.0.11
* Wed Jan 12 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.10-15 * Wed Jan 12 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.10-15
- Type: bugfix - Type: bugfix
- ID: NA - ID: NA

Binary file not shown.