!424 sync from upstream openeuler/iSulad
From: @leizhongkai Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
f52bac3401
25
0001-fix-memleak.patch
Normal file
25
0001-fix-memleak.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 199971d61cc53ee11b16b353bcd0594abc86cb3e Mon Sep 17 00:00:00 2001
|
||||||
|
From: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
Date: Fri, 26 Aug 2022 09:33:05 +0800
|
||||||
|
Subject: [PATCH 1/2] fix memleak
|
||||||
|
|
||||||
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
---
|
||||||
|
src/daemon/entry/cri/websocket/service/ws_server.cc | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/entry/cri/websocket/service/ws_server.cc b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||||
|
index 63afc9d..6438c4d 100644
|
||||||
|
--- a/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||||
|
+++ b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||||
|
@@ -399,6 +399,7 @@ int WebsocketServer::RegisterStreamTask(struct lws *wsi) noexcept
|
||||||
|
auto insertRet = m_wsis.insert(std::make_pair(socketID, session));
|
||||||
|
if (!insertRet.second) {
|
||||||
|
ERROR("failed to insert session data to map");
|
||||||
|
+ delete session;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
175
0002-cleancode-about-rest-register-container.patch
Normal file
175
0002-cleancode-about-rest-register-container.patch
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
From bf50cef67ac2288bed7013c675df8d35f370dc32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||||
|
Date: Sat, 27 Aug 2022 10:40:02 +0800
|
||||||
|
Subject: [PATCH 2/2] cleancode about rest register container
|
||||||
|
|
||||||
|
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||||
|
---
|
||||||
|
src/daemon/common/selinux_label.c | 2 +-
|
||||||
|
.../entry/connect/rest/rest_containers_service.c | 93 ++++++++++++++--------
|
||||||
|
2 files changed, 62 insertions(+), 33 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/common/selinux_label.c b/src/daemon/common/selinux_label.c
|
||||||
|
index 5242297..145e4b6 100644
|
||||||
|
--- a/src/daemon/common/selinux_label.c
|
||||||
|
+++ b/src/daemon/common/selinux_label.c
|
||||||
|
@@ -481,7 +481,7 @@ static int uniq_mcs(unsigned int range, char *mcs, size_t len)
|
||||||
|
c2 = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
- nret = snprintf(mcs, len, "s0:c%d,c%d", c1, c2);
|
||||||
|
+ nret = snprintf(mcs, len, "s0:c%u,c%u", c1, c2);
|
||||||
|
if (nret < 0 || nret >= len) {
|
||||||
|
ERROR("Failed to compose mcs");
|
||||||
|
return -1;
|
||||||
|
diff --git a/src/daemon/entry/connect/rest/rest_containers_service.c b/src/daemon/entry/connect/rest/rest_containers_service.c
|
||||||
|
index 53241be..397660e 100644
|
||||||
|
--- a/src/daemon/entry/connect/rest/rest_containers_service.c
|
||||||
|
+++ b/src/daemon/entry/connect/rest/rest_containers_service.c
|
||||||
|
@@ -1733,8 +1733,7 @@ out:
|
||||||
|
free_container_stats_response(cresponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* rest register containers handler */
|
||||||
|
-int rest_register_containers_handler(evhtp_t *htp)
|
||||||
|
+static int rest_register_containers_manage_handler(evhtp_t *htp)
|
||||||
|
{
|
||||||
|
if (evhtp_set_cb(htp, ContainerServiceCreate, rest_create_cb, NULL) == NULL) {
|
||||||
|
ERROR("Failed to register create callback");
|
||||||
|
@@ -1748,10 +1747,6 @@ int rest_register_containers_handler(evhtp_t *htp)
|
||||||
|
ERROR("Failed to register restart callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceVersion, rest_version_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register version callback");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
if (evhtp_set_cb(htp, ContainerServiceUpdate, rest_update_cb, NULL) == NULL) {
|
||||||
|
ERROR("Failed to register update callback");
|
||||||
|
return -1;
|
||||||
|
@@ -1760,62 +1755,96 @@ int rest_register_containers_handler(evhtp_t *htp)
|
||||||
|
ERROR("Failed to register kill callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceInspect, rest_container_inspect_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register inspect callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceRemove, rest_remove_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register remove callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceExec, rest_exec_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register exec callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceStart, rest_start_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register start callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceAttach, rest_attach_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register attach callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServicePause, rest_pause_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register pause callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceRemove, rest_remove_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register remove callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceResume, rest_resume_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register resume callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceStart, rest_start_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register start callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceWait, rest_wait_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register wait callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceList, rest_list_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register list callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceExport, rest_export_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register export callback");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceRename, rest_rename_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register rename callback");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceResize, rest_resize_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register resize callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceWait, rest_wait_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register wait callback");
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int rest_register_containers_info_handler(evhtp_t *htp)
|
||||||
|
+{
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceVersion, rest_version_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register version callback");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceInspect, rest_container_inspect_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register inspect callback");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceList, rest_list_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register list callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (evhtp_set_cb(htp, ContainerServiceInfo, rest_info_cb, NULL) == NULL) {
|
||||||
|
ERROR("Failed to register info callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceExport, rest_export_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register export callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceStats, rest_stats_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register stats callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServicePause, rest_pause_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register pause callback");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int rest_register_containers_stream_handler(evhtp_t *htp)
|
||||||
|
+{
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceExec, rest_exec_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register exec callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceResume, rest_resume_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register resume callback");
|
||||||
|
+ if (evhtp_set_cb(htp, ContainerServiceAttach, rest_attach_cb, NULL) == NULL) {
|
||||||
|
+ ERROR("Failed to register attach callback");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceRename, rest_rename_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register rename callback");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* rest register containers handler */
|
||||||
|
+int rest_register_containers_handler(evhtp_t *htp)
|
||||||
|
+{
|
||||||
|
+ if (rest_register_containers_manage_handler(htp) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceResize, rest_resize_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register resize callback");
|
||||||
|
+
|
||||||
|
+ if (rest_register_containers_info_handler(htp) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (evhtp_set_cb(htp, ContainerServiceStats, rest_stats_cb, NULL) == NULL) {
|
||||||
|
- ERROR("Failed to register stats callback");
|
||||||
|
+
|
||||||
|
+ if (rest_register_containers_stream_handler(htp) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
11
iSulad.spec
11
iSulad.spec
@ -1,5 +1,5 @@
|
|||||||
%global _version 2.0.16
|
%global _version 2.0.16
|
||||||
%global _release 1
|
%global _release 2
|
||||||
%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,6 +13,9 @@ 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}
|
||||||
|
|
||||||
|
Patch001: 0001-fix-memleak.patch
|
||||||
|
Patch002: 0002-cleancode-about-rest-register-container.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)
|
||||||
@ -239,6 +242,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 30 2022 leizhongkai <leizhongkai@huawei.com> - 2.0.16-2
|
||||||
|
- Type: enhancement
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: sync from upstream openeuler/iSulad
|
||||||
|
|
||||||
* Tue Aug 23 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.16-1
|
* Tue Aug 23 2022 wangfengtu <wangfengtu@huawei.com> - 2.0.16-1
|
||||||
- Type: enhancement
|
- Type: enhancement
|
||||||
- ID: NA
|
- ID: NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user