From 37a4accb5d2b0cb2e9c32a6cc0a2149cc9d88785 Mon Sep 17 00:00:00 2001 From: jikai Date: Fri, 19 Apr 2024 09:32:38 +0000 Subject: [PATCH] sync from openeuler Signed-off-by: jikai (cherry picked from commit 88f864b1b68c4f612409c7ef6df32c2c90e8f2e8) --- ...roup-field-in-isulad-and-shim-config.patch | 2 +- ...http-parser-as-third-party-component.patch | 2 +- 0003-add-enable-pod-events-field.patch | 2 +- ...ields-in-shim-stats-and-container-in.patch | 2 +- ...-Add-oomkilled-field-in-inspect.json.patch | 2 +- 0006-add-runtime-in-process-state.patch | 2 +- ...-restore-bufsize-to-prevent-log-loss.patch | 2 +- 0008-support-clang-build.patch | 2 +- 0009-support-cdi-spec.patch | 265 ++++++++++++++++++ 0010-remove-file-mode-check-in-ut.patch | 42 +++ lcr.spec | 10 +- 11 files changed, 324 insertions(+), 9 deletions(-) create mode 100644 0009-support-cdi-spec.patch create mode 100644 0010-remove-file-mode-check-in-ut.patch diff --git a/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch b/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch index 013df06..1c20c46 100644 --- a/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch +++ b/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch @@ -1,7 +1,7 @@ From 3bcb8f3f60abb6ab6cde999cadb6a836744d4104 Mon Sep 17 00:00:00 2001 From: jikai Date: Thu, 11 Jan 2024 19:00:19 +0800 -Subject: [PATCH 1/8] add systemd-cgroup field in isulad and shim config +Subject: [PATCH 01/10] add systemd-cgroup field in isulad and shim config Signed-off-by: jikai --- diff --git a/0002-Add-http-parser-as-third-party-component.patch b/0002-Add-http-parser-as-third-party-component.patch index 5c5c190..1cb3621 100644 --- a/0002-Add-http-parser-as-third-party-component.patch +++ b/0002-Add-http-parser-as-third-party-component.patch @@ -1,7 +1,7 @@ From 30558b07c80895e748e4754010d3bfa99f1a52da Mon Sep 17 00:00:00 2001 From: xuxuepeng Date: Mon, 19 Feb 2024 23:41:50 +0800 -Subject: [PATCH 2/8] Add http-parser as third party component +Subject: [PATCH 02/10] Add http-parser as third party component Signed-off-by: xuxuepeng --- diff --git a/0003-add-enable-pod-events-field.patch b/0003-add-enable-pod-events-field.patch index 0aa6b02..b8ac5e3 100644 --- a/0003-add-enable-pod-events-field.patch +++ b/0003-add-enable-pod-events-field.patch @@ -1,7 +1,7 @@ From 19655a5df138acda0a57b0411bc69f82511a32b4 Mon Sep 17 00:00:00 2001 From: jikai Date: Wed, 13 Mar 2024 15:21:09 +0800 -Subject: [PATCH 3/8] add enable pod events field +Subject: [PATCH 03/10] add enable pod events field Signed-off-by: jikai --- diff --git a/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch b/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch index a6ffd48..96e2443 100644 --- a/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch +++ b/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch @@ -1,7 +1,7 @@ From 299f54b13a85855540e6d28e9c9bfefb7bc66f14 Mon Sep 17 00:00:00 2001 From: jikai Date: Fri, 12 Jan 2024 11:30:34 +0800 -Subject: [PATCH 4/8] add swap usage fields in shim stats and container info +Subject: [PATCH 04/10] add swap usage fields in shim stats and container info Signed-off-by: jikai --- diff --git a/0005-Add-oomkilled-field-in-inspect.json.patch b/0005-Add-oomkilled-field-in-inspect.json.patch index dbcea54..2ba26f3 100644 --- a/0005-Add-oomkilled-field-in-inspect.json.patch +++ b/0005-Add-oomkilled-field-in-inspect.json.patch @@ -1,7 +1,7 @@ From 5adb5c82cb48f55fec1d6750e0648a0ffc5a372c Mon Sep 17 00:00:00 2001 From: jikai Date: Mon, 18 Mar 2024 20:23:58 +0800 -Subject: [PATCH 5/8] Add oomkilled field in inspect.json +Subject: [PATCH 05/10] Add oomkilled field in inspect.json Signed-off-by: jikai --- diff --git a/0006-add-runtime-in-process-state.patch b/0006-add-runtime-in-process-state.patch index 7ef68f1..a6c8d46 100644 --- a/0006-add-runtime-in-process-state.patch +++ b/0006-add-runtime-in-process-state.patch @@ -1,7 +1,7 @@ From ffe13775740957f55c4a87cdee63481b1e6f4adb Mon Sep 17 00:00:00 2001 From: zhongtao Date: Mon, 8 Apr 2024 11:38:21 +0800 -Subject: [PATCH 6/8] add runtime in process-state +Subject: [PATCH 06/10] add runtime in process-state Signed-off-by: zhongtao --- diff --git a/0007-restore-bufsize-to-prevent-log-loss.patch b/0007-restore-bufsize-to-prevent-log-loss.patch index 9828cd9..c6d513a 100644 --- a/0007-restore-bufsize-to-prevent-log-loss.patch +++ b/0007-restore-bufsize-to-prevent-log-loss.patch @@ -1,7 +1,7 @@ From 27b2deef3e4d64b44a7a4cdfd76ac99bfad80f64 Mon Sep 17 00:00:00 2001 From: zhongtao Date: Tue, 9 Apr 2024 10:34:32 +0800 -Subject: [PATCH 7/8] restore bufsize to prevent log loss +Subject: [PATCH 07/10] restore bufsize to prevent log loss Signed-off-by: zhongtao --- diff --git a/0008-support-clang-build.patch b/0008-support-clang-build.patch index 217e58e..9a7b91c 100644 --- a/0008-support-clang-build.patch +++ b/0008-support-clang-build.patch @@ -1,7 +1,7 @@ From f1d0acce748fdccb750424b75f5de8fd760fb98e Mon Sep 17 00:00:00 2001 From: luofeng14 Date: Wed, 10 Apr 2024 11:29:29 +0800 -Subject: [PATCH 8/8] support clang build +Subject: [PATCH 08/10] support clang build --- cmake/set_build_flags.cmake | 2 +- diff --git a/0009-support-cdi-spec.patch b/0009-support-cdi-spec.patch new file mode 100644 index 0000000..87b9104 --- /dev/null +++ b/0009-support-cdi-spec.patch @@ -0,0 +1,265 @@ +From 63b48aafaa17616d75f79f7cfe54fc0f2827692d Mon Sep 17 00:00:00 2001 +From: liuxu +Date: Tue, 5 Mar 2024 22:20:43 +0800 +Subject: [PATCH 09/10] support cdi spec + +--- + src/json/schema/cdi/container_edits.json | 28 ++++++++++++++++ + src/json/schema/cdi/device.json | 20 ++++++++++++ + src/json/schema/cdi/device_node.json | 37 ++++++++++++++++++++++ + src/json/schema/cdi/hook.json | 26 +++++++++++++++ + src/json/schema/cdi/mount.json | 23 ++++++++++++++ + src/json/schema/cdi/spec.json | 30 ++++++++++++++++++ + src/json/schema/host-config.json | 6 ++++ + src/json/schema/isulad-daemon-configs.json | 6 ++++ + 8 files changed, 176 insertions(+) + create mode 100644 src/json/schema/cdi/container_edits.json + create mode 100644 src/json/schema/cdi/device.json + create mode 100644 src/json/schema/cdi/device_node.json + create mode 100644 src/json/schema/cdi/hook.json + create mode 100644 src/json/schema/cdi/mount.json + create mode 100644 src/json/schema/cdi/spec.json + +diff --git a/src/json/schema/cdi/container_edits.json b/src/json/schema/cdi/container_edits.json +new file mode 100644 +index 0000000..41356e4 +--- /dev/null ++++ b/src/json/schema/cdi/container_edits.json +@@ -0,0 +1,28 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "env": { ++ "$ref": "../defs.json#/definitions/ArrayOfStrings" ++ }, ++ "deviceNodes": { ++ "type": "array", ++ "items": { ++ "$ref": "device_node.json" ++ } ++ }, ++ "mounts": { ++ "type": "array", ++ "items": { ++ "$ref": "mount.json" ++ } ++ }, ++ "hooks": { ++ "type": "array", ++ "items": { ++ "$ref": "hook.json" ++ } ++ } ++ } ++} +\ No newline at end of file +diff --git a/src/json/schema/cdi/device.json b/src/json/schema/cdi/device.json +new file mode 100644 +index 0000000..4277347 +--- /dev/null ++++ b/src/json/schema/cdi/device.json +@@ -0,0 +1,20 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "name": { ++ "type": "string" ++ }, ++ "annotations": { ++ "$ref": "../defs.json#/definitions/annotations" ++ }, ++ "containerEdits": { ++ "$ref": "container_edits.json" ++ } ++ }, ++ "required": [ ++ "name", ++ "containerEdits" ++ ] ++} +\ No newline at end of file +diff --git a/src/json/schema/cdi/device_node.json b/src/json/schema/cdi/device_node.json +new file mode 100644 +index 0000000..7c442e3 +--- /dev/null ++++ b/src/json/schema/cdi/device_node.json +@@ -0,0 +1,37 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "path": { ++ "type": "string" ++ }, ++ "hostPath": { ++ "type": "string" ++ }, ++ "type": { ++ "type": "string" ++ }, ++ "major": { ++ "$ref": "../defs.json#/definitions/int64" ++ }, ++ "minor": { ++ "$ref": "../defs.json#/definitions/int64" ++ }, ++ "fileMode": { ++ "$ref": "../defs.json#/definitions/int64" ++ }, ++ "permissions": { ++ "type": "string" ++ }, ++ "uid": { ++ "$ref": "../defs.json#/definitions/UID" ++ }, ++ "gid": { ++ "$ref": "../defs.json#/definitions/GID" ++ } ++ }, ++ "required": [ ++ "path" ++ ] ++} +\ No newline at end of file +diff --git a/src/json/schema/cdi/hook.json b/src/json/schema/cdi/hook.json +new file mode 100644 +index 0000000..66d9d22 +--- /dev/null ++++ b/src/json/schema/cdi/hook.json +@@ -0,0 +1,26 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "hookName": { ++ "type": "string" ++ }, ++ "path": { ++ "type": "string" ++ }, ++ "args": { ++ "$ref": "../defs.json#/definitions/ArrayOfStrings" ++ }, ++ "env": { ++ "$ref": "../defs.json#/definitions/ArrayOfStrings" ++ }, ++ "timeout": { ++ "$ref": "../defs.json#/definitions/int32" ++ } ++ }, ++ "required": [ ++ "hookName", ++ "path" ++ ] ++} +\ No newline at end of file +diff --git a/src/json/schema/cdi/mount.json b/src/json/schema/cdi/mount.json +new file mode 100644 +index 0000000..ff8b8a9 +--- /dev/null ++++ b/src/json/schema/cdi/mount.json +@@ -0,0 +1,23 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "hostPath": { ++ "type": "string" ++ }, ++ "containerPath": { ++ "type": "string" ++ }, ++ "type": { ++ "type": "string" ++ }, ++ "options": { ++ "$ref": "../defs.json#/definitions/ArrayOfStrings" ++ } ++ }, ++ "required": [ ++ "hostPath", ++ "containerPath" ++ ] ++} +\ No newline at end of file +diff --git a/src/json/schema/cdi/spec.json b/src/json/schema/cdi/spec.json +new file mode 100644 +index 0000000..583afb0 +--- /dev/null ++++ b/src/json/schema/cdi/spec.json +@@ -0,0 +1,30 @@ ++{ ++ "_comment": "third party depend: cdi", ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "cdiVersion": { ++ "type": "string" ++ }, ++ "kind": { ++ "type": "string" ++ }, ++ "annotations": { ++ "$ref": "../defs.json#/definitions/annotations" ++ }, ++ "devices": { ++ "type": "array", ++ "items": { ++ "$ref": "device.json" ++ } ++ }, ++ "containerEdits": { ++ "$ref": "container_edits.json" ++ } ++ }, ++ "required": [ ++ "cdiVersion", ++ "kind", ++ "devices" ++ ] ++} +\ No newline at end of file +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index 30f1bdc..6af8021 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -305,6 +305,12 @@ + "items": { + "type": "string" + } ++ }, ++ "CdiRequestedDevices": { ++ "type": "array", ++ "items": { ++ "type": "string" ++ } + } + } + } +diff --git a/src/json/schema/isulad-daemon-configs.json b/src/json/schema/isulad-daemon-configs.json +index bbacfd6..cd8948a 100644 +--- a/src/json/schema/isulad-daemon-configs.json ++++ b/src/json/schema/isulad-daemon-configs.json +@@ -179,6 +179,12 @@ + }, + "enable-pod-events": { + "type": "boolean" ++ }, ++ "cdi-spec-dirs": { ++ "type": "ArrayOfStrings" ++ }, ++ "enable-cdi": { ++ "type": "boolean" + } + } + } +-- +2.34.1 + diff --git a/0010-remove-file-mode-check-in-ut.patch b/0010-remove-file-mode-check-in-ut.patch new file mode 100644 index 0000000..f2ee95f --- /dev/null +++ b/0010-remove-file-mode-check-in-ut.patch @@ -0,0 +1,42 @@ +From e7db434109376a88013d739c81c71dd1db86e3a5 Mon Sep 17 00:00:00 2001 +From: jikai +Date: Fri, 19 Apr 2024 04:04:12 +0000 +Subject: [PATCH 10/10] remove file mode check in ut + +Signed-off-by: jikai +--- + tests/utils_file_ut.cpp | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/tests/utils_file_ut.cpp b/tests/utils_file_ut.cpp +index 7e98bd8..351a498 100644 +--- a/tests/utils_file_ut.cpp ++++ b/tests/utils_file_ut.cpp +@@ -137,8 +137,8 @@ TEST(utils_file_testcase, test_isula_dir_recursive_remove) + TEST(utils_file_testcase, test_isula_file_open_and_remove) + { + std::string path = "/tmp/test"; +- struct stat buf; +- int nret; ++ // struct stat buf; ++ // int nret; + int fd; + + ASSERT_EQ(isula_file_open(nullptr, O_RDONLY, 0), -1); +@@ -151,9 +151,10 @@ TEST(utils_file_testcase, test_isula_file_open_and_remove) + + fd = isula_file_open(path.c_str(), O_RDONLY | O_CREAT, 0640); + ASSERT_NE(fd, -1); +- nret = stat(path.c_str(), &buf); +- ASSERT_EQ(nret, 0); +- ASSERT_EQ(buf.st_mode&0640, 0640); ++ // for some env, the umask set might lead the mode not to be 0644 ++ // nret = stat(path.c_str(), &buf); ++ // ASSERT_EQ(nret, 0); ++ // ASSERT_EQ(buf.st_mode&0640, 0640); + close(fd); + ASSERT_EQ(isula_path_remove(path.c_str()), 0); + } +-- +2.34.1 + diff --git a/lcr.spec b/lcr.spec index e157857..6485410 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.1.4 -%global _release 6 +%global _release 7 %global _inner_name isula_libutils %global enable_lxc 1 @@ -21,6 +21,8 @@ Patch0005: 0005-Add-oomkilled-field-in-inspect.json.patch Patch0006: 0006-add-runtime-in-process-state.patch Patch0007: 0007-restore-bufsize-to-prevent-log-loss.patch Patch0008: 0008-support-clang-build.patch +Patch0009: 0009-support-cdi-spec.patch +Patch0010: 0010-remove-file-mode-check-in-ut.patch %define lxcver_lower 4.0.3-2022102400 %define lxcver_upper 5.0.3 @@ -141,6 +143,12 @@ rm -rf %{buildroot} %{_includedir}/lcr/utils_compile.h %changelog +* Fri Apr 12 2024 luofeng - 2.1.4-7 +- Type:enhancement +- CVE:NA +- SUG:NA +- DESC:sync from upstream + * Fri Apr 12 2024 luofeng - 2.1.4-6 - Type:enhancement - CVE:NA