!110 [sync] PR-105: sync from upstream
From: @openeuler-sync-bot Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
e082dcf3ff
32
0001-make-thread-detach-to-avoid-resource-leak.patch
Normal file
32
0001-make-thread-detach-to-avoid-resource-leak.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 1ef7a43907ac6fc521cedd2b4744be4d102efd32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
Date: Thu, 31 Dec 2020 14:05:25 +0800
|
||||||
|
Subject: [PATCH 1/9] make thread detach to avoid resource leak
|
||||||
|
|
||||||
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
---
|
||||||
|
src/daemon/modules/image/oci/registry/registry.c | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/modules/image/oci/registry/registry.c b/src/daemon/modules/image/oci/registry/registry.c
|
||||||
|
index 391af4fb..3fba2039 100644
|
||||||
|
--- a/src/daemon/modules/image/oci/registry/registry.c
|
||||||
|
+++ b/src/daemon/modules/image/oci/registry/registry.c
|
||||||
|
@@ -1389,6 +1389,14 @@ static void *register_layers_in_thread(void *arg)
|
||||||
|
size_t i = 0;
|
||||||
|
struct timespec ts = {0};
|
||||||
|
|
||||||
|
+ ret = pthread_detach(pthread_self());
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ ERROR("Set thread detach fail");
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ prctl(PR_SET_NAME, "register_layer");
|
||||||
|
+
|
||||||
|
for (i = 0; i < desc->layers_len; i++) {
|
||||||
|
mutex_lock(&desc->mutex);
|
||||||
|
while (wait_fetch_complete(&infos[i])) {
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
134
0002-devmapper-fix-udev-wait-thread-resource-leak.patch
Normal file
134
0002-devmapper-fix-udev-wait-thread-resource-leak.patch
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
From 025416aae9f7eaaa8fe5ad52ecbbf6692505186b Mon Sep 17 00:00:00 2001
|
||||||
|
From: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
Date: Thu, 31 Dec 2020 14:31:12 +0800
|
||||||
|
Subject: [PATCH 2/9] devmapper: fix udev wait thread resource leak
|
||||||
|
|
||||||
|
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
---
|
||||||
|
.../graphdriver/devmapper/driver_devmapper.c | 2 +-
|
||||||
|
.../graphdriver/devmapper/wrapper_devmapper.c | 35 +++++++++++--------
|
||||||
|
2 files changed, 22 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
|
||||||
|
index ab60845d..f2586f0d 100644
|
||||||
|
--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
|
||||||
|
+++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
|
||||||
|
@@ -216,7 +216,7 @@ char *devmapper_mount_layer(const char *id, const struct graphdriver *driver,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mount_device(id, mnt_point_dir, mount_opts, driver->devset) != 0) {
|
||||||
|
- ERROR("Mount device:%s to path:%s failed", id, mnt_parent_dir);
|
||||||
|
+ ERROR("Mount device:%s to path:%s failed", id, mnt_point_dir);
|
||||||
|
ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
index 112e2b73..1dcdf595 100644
|
||||||
|
--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
+++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
@@ -358,28 +358,32 @@ out:
|
||||||
|
|
||||||
|
static void *udev_wait_process(void *data)
|
||||||
|
{
|
||||||
|
+ int ret = 0;
|
||||||
|
udev_wait_pth_t *uwait = (udev_wait_pth_t *)data;
|
||||||
|
|
||||||
|
- if (dm_udev_wait(uwait->cookie) != 1) {
|
||||||
|
- pthread_mutex_lock(&uwait->udev_mutex);
|
||||||
|
- uwait->state = ERR_UDEV_WAIT;
|
||||||
|
- pthread_mutex_unlock(&uwait->udev_mutex);
|
||||||
|
- DAEMON_CLEAR_ERRMSG();
|
||||||
|
- pthread_exit((void *)ERR_UDEV_WAIT);
|
||||||
|
+ if (pthread_detach(pthread_self()) != 0) {
|
||||||
|
+ CRIT("Start: set thread detach fail");
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ ret = dm_udev_wait(uwait->cookie);
|
||||||
|
pthread_mutex_lock(&uwait->udev_mutex);
|
||||||
|
- uwait->state = DEV_OK;
|
||||||
|
+ if (ret != 1) {
|
||||||
|
+ uwait->state = ERR_UDEV_WAIT;
|
||||||
|
+ } else {
|
||||||
|
+ uwait->state = DEV_OK;
|
||||||
|
+ }
|
||||||
|
pthread_mutex_unlock(&uwait->udev_mutex);
|
||||||
|
+
|
||||||
|
+out:
|
||||||
|
DAEMON_CLEAR_ERRMSG();
|
||||||
|
- pthread_exit((void *)0);
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UdevWait waits for any processes that are waiting for udev to complete the specified cookie.
|
||||||
|
void dev_udev_wait(uint32_t cookie)
|
||||||
|
{
|
||||||
|
pthread_t tid;
|
||||||
|
- int thread_result = 0;
|
||||||
|
udev_wait_pth_t *uwait = NULL;
|
||||||
|
float timeout = 0;
|
||||||
|
struct timeval start, end;
|
||||||
|
@@ -403,7 +407,7 @@ void dev_udev_wait(uint32_t cookie)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pthread_create(&tid, NULL, udev_wait_process, uwait) != 0) {
|
||||||
|
- ERROR("devmapper: create udev wait process thread failed");
|
||||||
|
+ ERROR("devmapper: create udev wait process thread error:%s", strerror(errno));
|
||||||
|
goto free_out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -419,15 +423,14 @@ void dev_udev_wait(uint32_t cookie)
|
||||||
|
ERROR("devmapper: get time failed");
|
||||||
|
goto free_out;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
timeout = (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) / 1000000; // seconds
|
||||||
|
if (timeout >= (float)dm_udev_wait_timeout) {
|
||||||
|
if (dm_udev_complete(cookie) != 1) {
|
||||||
|
ERROR("Failed to complete udev cookie %u on udev wait timeout", cookie);
|
||||||
|
goto free_out;
|
||||||
|
}
|
||||||
|
- INFO("devmapper: udev wait join thread start...");
|
||||||
|
- pthread_join(tid, (void *)&thread_result);
|
||||||
|
- INFO("devmapper: udev wait join thread end exit %d", thread_result);
|
||||||
|
+ ERROR("Wait on udev cookie time out");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -482,6 +485,7 @@ int dev_delete_device_force(const char *name)
|
||||||
|
}
|
||||||
|
|
||||||
|
udev:
|
||||||
|
+ DEBUG("Start udev wait on delete device force");
|
||||||
|
dev_udev_wait(cookie);
|
||||||
|
|
||||||
|
out:
|
||||||
|
@@ -536,6 +540,7 @@ int dev_remove_device_deferred(const char *name)
|
||||||
|
}
|
||||||
|
|
||||||
|
udev:
|
||||||
|
+ DEBUG("Start udev wait on remove device deferred");
|
||||||
|
dev_udev_wait(cookie);
|
||||||
|
out:
|
||||||
|
if (dmt != NULL) {
|
||||||
|
@@ -825,6 +830,7 @@ int dev_resume_device(const char *dm_name)
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ DEBUG("Start udev wait on resume device");
|
||||||
|
dev_udev_wait(cookie);
|
||||||
|
|
||||||
|
out:
|
||||||
|
@@ -886,7 +892,8 @@ int dev_active_device(const char *pool_name, const char *name, int device_id, ui
|
||||||
|
ERROR("devicemapper: error running deviceCreate (ActivateDevice) %d", ret);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ DEBUG("Start udev wait on create device");
|
||||||
|
dev_udev_wait(cookie);
|
||||||
|
out:
|
||||||
|
if (dmt != NULL) {
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
61
0003-clean-code-fix-clean-code.patch
Normal file
61
0003-clean-code-fix-clean-code.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From 200f49ff353ee8266505316659493ffc4082c803 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lifeng68 <lifeng68@huawei.com>
|
||||||
|
Date: Tue, 5 Jan 2021 18:48:20 +0800
|
||||||
|
Subject: [PATCH 3/9] clean code: fix clean code
|
||||||
|
|
||||||
|
Signed-off-by: lifeng68 <lifeng68@huawei.com>
|
||||||
|
---
|
||||||
|
.../layer_store/graphdriver/devmapper/wrapper_devmapper.c | 2 +-
|
||||||
|
src/utils/console/console.c | 2 +-
|
||||||
|
src/utils/cutils/utils.c | 2 --
|
||||||
|
3 files changed, 2 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
index 1dcdf595..5748ec54 100644
|
||||||
|
--- a/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
+++ b/src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/wrapper_devmapper.c
|
||||||
|
@@ -892,7 +892,7 @@ int dev_active_device(const char *pool_name, const char *name, int device_id, ui
|
||||||
|
ERROR("devicemapper: error running deviceCreate (ActivateDevice) %d", ret);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+
|
||||||
|
DEBUG("Start udev wait on create device");
|
||||||
|
dev_udev_wait(cookie);
|
||||||
|
out:
|
||||||
|
diff --git a/src/utils/console/console.c b/src/utils/console/console.c
|
||||||
|
index cb748196..7fda519c 100644
|
||||||
|
--- a/src/utils/console/console.c
|
||||||
|
+++ b/src/utils/console/console.c
|
||||||
|
@@ -68,7 +68,7 @@ static int console_cb_tty_stdin_with_escape(int fd, uint32_t events, void *cbdat
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == 'q' && ts->saw_tty_exit) {
|
||||||
|
- ret = 1;
|
||||||
|
+ ret = EPOLL_LOOP_HANDLE_CLOSE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c
|
||||||
|
index 1e777dc3..9107f540 100644
|
||||||
|
--- a/src/utils/cutils/utils.c
|
||||||
|
+++ b/src/utils/cutils/utils.c
|
||||||
|
@@ -493,7 +493,6 @@ out:
|
||||||
|
static void set_stderr_buf(char **stderr_buf, const char *format, ...)
|
||||||
|
{
|
||||||
|
char errbuf[BUFSIZ + 1] = { 0 };
|
||||||
|
- char *jerr = NULL;
|
||||||
|
|
||||||
|
UTIL_FREE_AND_SET_NULL(*stderr_buf);
|
||||||
|
|
||||||
|
@@ -511,7 +510,6 @@ static void set_stderr_buf(char **stderr_buf, const char *format, ...)
|
||||||
|
if (*stderr_buf == NULL) {
|
||||||
|
*stderr_buf = util_strdup_s(errbuf);
|
||||||
|
}
|
||||||
|
- free(jerr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int open_devnull(void)
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
29
0004-judge-isula-load-file-exists.patch
Normal file
29
0004-judge-isula-load-file-exists.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From c0b6c4187a3c66bef8b75a63e699df1be57d05b4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
Date: Mon, 11 Jan 2021 18:29:26 +0800
|
||||||
|
Subject: [PATCH 4/9] judge isula load file exists
|
||||||
|
|
||||||
|
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
---
|
||||||
|
src/cmd/isula/images/load.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/cmd/isula/images/load.c b/src/cmd/isula/images/load.c
|
||||||
|
index 343d8d6d..0fb8014e 100644
|
||||||
|
--- a/src/cmd/isula/images/load.c
|
||||||
|
+++ b/src/cmd/isula/images/load.c
|
||||||
|
@@ -162,6 +162,11 @@ int cmd_load_main(int argc, const char **argv)
|
||||||
|
g_cmd_load_args.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (!util_file_exists(g_cmd_load_args.file)) {
|
||||||
|
+ COMMAND_ERROR("File %s is not exist", g_cmd_load_args.file);
|
||||||
|
+ exit(exit_code);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
ret = client_load_image(&g_cmd_load_args);
|
||||||
|
if (ret) {
|
||||||
|
exit(exit_code);
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
29
0005-modify-image_load.sh-CI-to-test-file-not-exist.patch
Normal file
29
0005-modify-image_load.sh-CI-to-test-file-not-exist.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From e151821a1e092995836631b273bddc339cadffbe Mon Sep 17 00:00:00 2001
|
||||||
|
From: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
Date: Mon, 11 Jan 2021 18:33:39 +0800
|
||||||
|
Subject: [PATCH 5/9] modify image_load.sh CI to test file not exist
|
||||||
|
|
||||||
|
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||||
|
---
|
||||||
|
CI/test_cases/image_cases/image_load.sh | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/CI/test_cases/image_cases/image_load.sh b/CI/test_cases/image_cases/image_load.sh
|
||||||
|
index 8415e036..bf41f2af 100755
|
||||||
|
--- a/CI/test_cases/image_cases/image_load.sh
|
||||||
|
+++ b/CI/test_cases/image_cases/image_load.sh
|
||||||
|
@@ -30,6 +30,11 @@ function test_image_load()
|
||||||
|
local test="isula load image test => (${FUNCNAME[@]})"
|
||||||
|
|
||||||
|
msg_info "${test} starting..."
|
||||||
|
+
|
||||||
|
+ # file is not exist, expect fail
|
||||||
|
+ isula load -i xxx.tar
|
||||||
|
+ [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - image tar file not exist test failed" && ((ret++))
|
||||||
|
+
|
||||||
|
|
||||||
|
# single image without --tag
|
||||||
|
isula load -i $single_image
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
1918
0006-do-not-pause-container-when-copy.patch
Normal file
1918
0006-do-not-pause-container-when-copy.patch
Normal file
File diff suppressed because it is too large
Load Diff
157
0007-add-testcases-for-isula-cp.patch
Normal file
157
0007-add-testcases-for-isula-cp.patch
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
From 085b93daf8f080f21b304058da3af404be9ac61d Mon Sep 17 00:00:00 2001
|
||||||
|
From: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
Date: Fri, 8 Jan 2021 14:02:00 +0800
|
||||||
|
Subject: [PATCH 7/9] add testcases for isula cp
|
||||||
|
|
||||||
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
---
|
||||||
|
CI/test_cases/container_cases/cp.sh | 93 ++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 90 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CI/test_cases/container_cases/cp.sh b/CI/test_cases/container_cases/cp.sh
|
||||||
|
index dfbd222f..67a36909 100644
|
||||||
|
--- a/CI/test_cases/container_cases/cp.sh
|
||||||
|
+++ b/CI/test_cases/container_cases/cp.sh
|
||||||
|
@@ -163,6 +163,7 @@ test_cp_file_to_container()
|
||||||
|
return ${ret}
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
test_cp_dir_to_container()
|
||||||
|
{
|
||||||
|
local ret=0
|
||||||
|
@@ -194,6 +195,66 @@ test_cp_dir_to_container()
|
||||||
|
isula exec $containername /bin/sh -c "ls $dstfile/passwd"
|
||||||
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to do copy" && ((ret++))
|
||||||
|
|
||||||
|
+ # test copy dir with hardlink
|
||||||
|
+ rm -rf $cpfiles/a
|
||||||
|
+ mkdir -p $cpfiles/a/a $cpfiles/a/b
|
||||||
|
+ echo "test_hardlink_a" > $cpfiles/a/a/a
|
||||||
|
+ ln $cpfiles/a/a/a $cpfiles/a/b/b
|
||||||
|
+ isula cp $cpfiles/a $containername:/c
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to do copy" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername cat /c/a/a | grep "test_hardlink_a"
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy hardlink a not right" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername cat /c/b/b | grep "test_hardlink_a"
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy hardlink b not right" && ((ret++))
|
||||||
|
+ rm -rf $cpfiles/a
|
||||||
|
+
|
||||||
|
+ # test copy dir to file
|
||||||
|
+ mkdir -p $cpfiles/dst
|
||||||
|
+ isula exec -ti $containername sh -c 'touch /dst'
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to touch file in container" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula cp $cpfiles/dst $containername:/
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy dir to container failed" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername stat / | grep directory
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - file should be replaced to be dir" && ((ret++))
|
||||||
|
+ rm -rf $cpfiles/dir
|
||||||
|
+
|
||||||
|
+ # test copy current dir file
|
||||||
|
+ touch $cpfiles/current
|
||||||
|
+ cd $cpfiles
|
||||||
|
+ isula cp . $containername:/current1
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cp current1 file" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername stat /current1
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - file current1 not exist" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula cp ./ $containername:/current2
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cp current2 file" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername stat /current2
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - file current2 not exist" && ((ret++))
|
||||||
|
+ cd -
|
||||||
|
+ rm -f $cpfiles/current
|
||||||
|
+
|
||||||
|
+ # test copy perm
|
||||||
|
+ mkdir -p $cpfiles/perm && chmod 700 $cpfiles/perm
|
||||||
|
+ isula cp $cpfiles/perm $containername:/
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cp dir to container" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername stat /perm | grep "Access: (0700/drwx"
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy perm not right" && ((ret++))
|
||||||
|
+ rm -f $cpfiles/perm
|
||||||
|
+
|
||||||
|
+ # test copy hardlink
|
||||||
|
+ rm -rf $cpfiles/cp_dir
|
||||||
|
+ mkdir $cpfiles/cp_dir && cd $cpfiles/cp_dir && echo hello > norm_file && ln norm_file norm_file_link && cd -
|
||||||
|
+ isula cp $cpfiles/cp_dir $containername:/home/
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - copy hardlink failed" && ((ret++))
|
||||||
|
+ rm -rf $cpfiles/cp_dir
|
||||||
|
+
|
||||||
|
return ${ret}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -227,6 +288,17 @@ test_cp_symlink_to_container()
|
||||||
|
isula exec $containername /bin/sh -c "cat $cpfiles/target | grep root"
|
||||||
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to do copy" && ((ret++))
|
||||||
|
|
||||||
|
+ # test cp symlink with dir which have the same name prefix
|
||||||
|
+ rm -rf $cpfiles/abc $cpfiles/a
|
||||||
|
+ ln -s $cpfiles/abc $cpfiles/a
|
||||||
|
+
|
||||||
|
+ isula cp $cpfiles/a $containername:/b
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to copy symlink" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula exec -ti $containername readlink /b | grep "$cpfiles/abc"
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - invalid symlink" && ((ret++))
|
||||||
|
+ rm -f $cpfiles/abc $cpfiles/a
|
||||||
|
+
|
||||||
|
return ${ret}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -256,14 +328,21 @@ function cp_test_t()
|
||||||
|
|
||||||
|
msg_info "${test} starting..."
|
||||||
|
|
||||||
|
- isula pull ${image}
|
||||||
|
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
|
||||||
|
+ local isulad_pid=$(cat /var/run/isulad.pid)
|
||||||
|
+ local fd_num1=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
||||||
|
+ [[ $fd_num1 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
||||||
|
+
|
||||||
|
+ isula inspect ${image}
|
||||||
|
+ if [ x"$?" != x"0" ];then
|
||||||
|
+ isula pull ${image}
|
||||||
|
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
isula images | grep busybox
|
||||||
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
|
||||||
|
|
||||||
|
containername=test_cmd_cp
|
||||||
|
- isula run -n $containername -itd $image
|
||||||
|
+ isula run -n $containername -itd $image
|
||||||
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container: ${image}" && ((ret++))
|
||||||
|
|
||||||
|
rm -rf $cpfiles
|
||||||
|
@@ -274,6 +353,7 @@ function cp_test_t()
|
||||||
|
test_cp_file_from_container $containername || ((ret++))
|
||||||
|
test_cp_dir_from_container $containername || ((ret++))
|
||||||
|
test_cp_file_to_container $containername || ((ret++))
|
||||||
|
+ test_cp_dir_to_container $containername || ((ret++))
|
||||||
|
test_cp_symlink_to_container $containername || ((ret++))
|
||||||
|
test_cp_symlink_from_container $containername || ((ret++))
|
||||||
|
|
||||||
|
@@ -281,6 +361,13 @@ function cp_test_t()
|
||||||
|
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container: ${containername}" && ((ret++))
|
||||||
|
|
||||||
|
rm -rf $cpfiles
|
||||||
|
+
|
||||||
|
+ local fd_num2=$(ls -l /proc/$isulad_pid/fd | wc -l)
|
||||||
|
+ [[ $fd_num2 -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - can not get fd number" && ((ret++))
|
||||||
|
+
|
||||||
|
+ # make sure fd not increase after test
|
||||||
|
+ [[ $fd_num1 -ne $fd_num2 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - fd number not right" && ((ret++))
|
||||||
|
+
|
||||||
|
echo "test end"
|
||||||
|
return ${ret}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
107
0008-image_cb-rename-the-function-isula_-docker_-to-do_.patch
Normal file
107
0008-image_cb-rename-the-function-isula_-docker_-to-do_.patch
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
From c8d14980e145a7d400aa6c5b449a59952a422801 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Li Feng <lifeng2221dd1@zoho.com.cn>
|
||||||
|
Date: Fri, 15 Jan 2021 10:34:43 +0800
|
||||||
|
Subject: [PATCH 8/9] image_cb: rename the function {isula_/docker_} to do_
|
||||||
|
|
||||||
|
Signed-off-by: Li Feng <lifeng2221dd1@zoho.com.cn>
|
||||||
|
---
|
||||||
|
src/daemon/executor/image_cb/image_cb.c | 20 ++++++++++----------
|
||||||
|
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/daemon/executor/image_cb/image_cb.c b/src/daemon/executor/image_cb/image_cb.c
|
||||||
|
index 6ab8067f..156cf88c 100644
|
||||||
|
--- a/src/daemon/executor/image_cb/image_cb.c
|
||||||
|
+++ b/src/daemon/executor/image_cb/image_cb.c
|
||||||
|
@@ -54,7 +54,7 @@
|
||||||
|
#include "utils_timestamp.h"
|
||||||
|
#include "utils_verify.h"
|
||||||
|
|
||||||
|
-static int isula_import_image(const char *file, const char *tag, char **id)
|
||||||
|
+static int do_import_image(const char *file, const char *tag, char **id)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
im_import_request *request = NULL;
|
||||||
|
@@ -114,7 +114,7 @@ static int import_cb(const image_import_request *request, image_import_response
|
||||||
|
|
||||||
|
EVENT("Image Event: {Object: %s, Type: Importing}", request->file);
|
||||||
|
|
||||||
|
- ret = isula_import_image(request->file, request->tag, &id);
|
||||||
|
+ ret = do_import_image(request->file, request->tag, &id);
|
||||||
|
if (ret != 0) {
|
||||||
|
ERROR("Failed to import docker image %s with tag %s", request->file, request->tag);
|
||||||
|
cc = EINVALIDARGS;
|
||||||
|
@@ -140,7 +140,7 @@ out:
|
||||||
|
return (ret < 0) ? ECOMMON : ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int docker_load_image(const char *file, const char *tag, const char *type)
|
||||||
|
+static int do_load_image(const char *file, const char *tag, const char *type)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
im_load_request *request = NULL;
|
||||||
|
@@ -210,7 +210,7 @@ static int image_load_cb(const image_load_image_request *request, image_load_ima
|
||||||
|
|
||||||
|
EVENT("Image Event: {Object: %s, Type: Loading}", request->file);
|
||||||
|
|
||||||
|
- ret = docker_load_image(request->file, request->tag, request->type);
|
||||||
|
+ ret = do_load_image(request->file, request->tag, request->type);
|
||||||
|
if (ret != 0) {
|
||||||
|
ERROR("Failed to load docker image %s with tag %s and type %s", request->file, request->tag, request->type);
|
||||||
|
cc = EINVALIDARGS;
|
||||||
|
@@ -233,7 +233,7 @@ out:
|
||||||
|
return (ret < 0) ? ECOMMON : ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int docker_login(const char *username, const char *password, const char *server, const char *type)
|
||||||
|
+static int do_login(const char *username, const char *password, const char *server, const char *type)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
im_login_request *request = NULL;
|
||||||
|
@@ -290,7 +290,7 @@ static int login_cb(const image_login_request *request, image_login_response **r
|
||||||
|
|
||||||
|
EVENT("Image Event: {Object: %s, Type: Logining}", request->server);
|
||||||
|
|
||||||
|
- ret = docker_login(request->username, request->password, request->server, request->type);
|
||||||
|
+ ret = do_login(request->username, request->password, request->server, request->type);
|
||||||
|
if (ret != 0) {
|
||||||
|
ERROR("Failed to login %s", request->server);
|
||||||
|
cc = EINVALIDARGS;
|
||||||
|
@@ -312,7 +312,7 @@ out:
|
||||||
|
return (ret < 0) ? ECOMMON : ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int docker_logout(const char *server, const char *type)
|
||||||
|
+static int do_logout(const char *server, const char *type)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
im_logout_request *request = NULL;
|
||||||
|
@@ -367,7 +367,7 @@ static int logout_cb(const image_logout_request *request, image_logout_response
|
||||||
|
|
||||||
|
EVENT("Image Event: {Object: %s, Type: Logouting}", request->server);
|
||||||
|
|
||||||
|
- ret = docker_logout(request->server, request->type);
|
||||||
|
+ ret = do_logout(request->server, request->type);
|
||||||
|
if (ret != 0) {
|
||||||
|
ERROR("Failed to logout %s", request->server);
|
||||||
|
cc = EINVALIDARGS;
|
||||||
|
@@ -442,7 +442,7 @@ out:
|
||||||
|
}
|
||||||
|
|
||||||
|
/* tag image */
|
||||||
|
-static int tag_image(const char *src_name, const char *dest_name)
|
||||||
|
+static int do_tag_image(const char *src_name, const char *dest_name)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
im_tag_request *im_request = NULL;
|
||||||
|
@@ -524,7 +524,7 @@ static int image_tag_cb(const image_tag_image_request *request, image_tag_image_
|
||||||
|
|
||||||
|
EVENT("Image Event: {Object: %s, Type: Tagging}", src_name);
|
||||||
|
|
||||||
|
- ret = tag_image(src_name, dest_name);
|
||||||
|
+ ret = do_tag_image(src_name, dest_name);
|
||||||
|
if (ret != 0) {
|
||||||
|
cc = ISULAD_ERR_EXEC;
|
||||||
|
goto out;
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
1078
0009-fix-small-probability-of-coredump-in-CRI-streaming-s.patch
Normal file
1078
0009-fix-small-probability-of-coredump-in-CRI-streaming-s.patch
Normal file
File diff suppressed because it is too large
Load Diff
18
iSulad.spec
18
iSulad.spec
@ -1,5 +1,5 @@
|
|||||||
%global _version 2.0.8
|
%global _version 2.0.8
|
||||||
%global _release 20201230.155843.git6557a6eb
|
%global _release 20210118.195254.git077e10f2
|
||||||
%global is_systemd 1
|
%global is_systemd 1
|
||||||
|
|
||||||
Name: iSulad
|
Name: iSulad
|
||||||
@ -12,6 +12,16 @@ Source: https://gitee.com/openeuler/iSulad/repository/archive/v%{version}.tar
|
|||||||
BuildRoot: {_tmppath}/iSulad-%{version}
|
BuildRoot: {_tmppath}/iSulad-%{version}
|
||||||
ExclusiveArch: x86_64 aarch64
|
ExclusiveArch: x86_64 aarch64
|
||||||
|
|
||||||
|
Patch1: 0001-make-thread-detach-to-avoid-resource-leak.patch
|
||||||
|
Patch2: 0002-devmapper-fix-udev-wait-thread-resource-leak.patch
|
||||||
|
Patch3: 0003-clean-code-fix-clean-code.patch
|
||||||
|
Patch4: 0004-judge-isula-load-file-exists.patch
|
||||||
|
Patch5: 0005-modify-image_load.sh-CI-to-test-file-not-exist.patch
|
||||||
|
Patch6: 0006-do-not-pause-container-when-copy.patch
|
||||||
|
Patch7: 0007-add-testcases-for-isula-cp.patch
|
||||||
|
Patch8: 0008-image_cb-rename-the-function-isula_-docker_-to-do_.patch
|
||||||
|
Patch9: 0009-fix-small-probability-of-coredump-in-CRI-streaming-s.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)
|
||||||
@ -213,6 +223,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 18 2020 lifeng <lifeng68@huawei.com> - 2.0.8-20210118.195254.git077e10f2
|
||||||
|
- Type: sync from upstream
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: update from master
|
||||||
|
|
||||||
* Wed Dec 30 2020 lifeng <lifeng68@huawei.com> - 2.0.8-20201230.155843.git6557a6eb
|
* Wed Dec 30 2020 lifeng <lifeng68@huawei.com> - 2.0.8-20201230.155843.git6557a6eb
|
||||||
- Type: update to v2.0.8
|
- Type: update to v2.0.8
|
||||||
- ID: NA
|
- ID: NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user