代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/iSulad 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 3b0f34c7cd55686cf18f65efbdc0be8a84f13e3e Mon Sep 17 00:00:00 2001
From: zhongtao <[email protected]>
Date: Mon, 20 May 2024 17:54:04 +1400
Subject: [PATCH 090/108] modify the user error log to be the same as before
Signed-off-by: zhongtao <[email protected]>
---
src/daemon/common/id_name_manager.c | 4 +--
.../executor/container_cb/execution_create.c | 26 +++++++++++--------
.../container_cb/execution_information.c | 4 ++-
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/daemon/common/id_name_manager.c b/src/daemon/common/id_name_manager.c
index 263a584d..f64094b9 100644
--- a/src/daemon/common/id_name_manager.c
+++ b/src/daemon/common/id_name_manager.c
@@ -242,7 +242,7 @@ static bool try_add_name(const char *name)
}
if (!util_valid_container_name(name)) {
- ERROR("Failed to add invalid name: %s", name);
+ ERROR("Invalid container name (%s), only [a-zA-Z0-9][a-zA-Z0-9_.-]+$ are allowed.", name);
return false;
}
@@ -262,7 +262,7 @@ static bool try_remove_name(const char *name)
}
if (!util_valid_container_name(name)) {
- ERROR("Failed to remove invalid name: %s", name);
+ ERROR("Invalid container name (%s), only [a-zA-Z0-9][a-zA-Z0-9_.-]+$ are allowed.", name);
return false;
}
diff --git a/src/daemon/executor/container_cb/execution_create.c b/src/daemon/executor/container_cb/execution_create.c
index 785b4e27..041089dd 100644
--- a/src/daemon/executor/container_cb/execution_create.c
+++ b/src/daemon/executor/container_cb/execution_create.c
@@ -761,8 +761,17 @@ static int maintain_container_id(const container_create_request *request, char *
#endif
if (!nret) {
- ERROR("Failed to add entry to id name manager with new id and name");
- isulad_set_error_message("Failed to add entry to id name manager with new id and name");
+ __isula_auto_free char *used_id = NULL;
+ used_id = container_name_index_get(name);
+ if(used_id != NULL) {
+ ERROR("Name %s is in use by container %s", name, used_id);
+ isulad_set_error_message("Conflict. The name \"%s\" is already in use by container %s. "
+ "You have to remove (or rename) that container to be able to reuse that name.",
+ name, used_id);
+ } else {
+ ERROR("Failed to add entry to id name manager with new id and name");
+ isulad_set_error_message("Failed to add entry to id name manager with new id and name");
+ }
ret = -1;
goto out;
}
@@ -775,19 +784,14 @@ static int maintain_container_id(const container_create_request *request, char *
goto out;
}
- char *used_id = NULL;
- used_id = container_name_index_get(name);
- ERROR("Name %s is in use by container %s", name, used_id);
- isulad_set_error_message("Conflict. The name \"%s\" is already in use by container %s. "
- "You have to remove (or rename) that container to be able to reuse that name.",
- name, used_id);
- free(used_id);
- used_id = NULL;
- ret = -1;
if (!skip_id_name_manage && !id_name_manager_remove_entry(id, name)) {
WARN("Failed to remove %s and %s from id name manager", id, name);
}
+ ERROR("Failed to add %s to container name index", name);
+ isulad_set_error_message("Failed to add %s to container name index", name);
+ ret = -1;
+
out:
*out_id = id;
*out_name = name;
diff --git a/src/daemon/executor/container_cb/execution_information.c b/src/daemon/executor/container_cb/execution_information.c
index c02cc830..58924257 100644
--- a/src/daemon/executor/container_cb/execution_information.c
+++ b/src/daemon/executor/container_cb/execution_information.c
@@ -1149,7 +1149,9 @@ static int container_rename(container_t *cont, const char *new_name)
if (!id_name_manager_rename(new_name, old_name)) {
ERROR("Failed to rename %s to %s in id-name manager", old_name, new_name);
- isulad_set_error_message("Failed to rename %s to %s in id-name manager", old_name, new_name);
+ isulad_set_error_message("Conflict. The name \"%s\" is already in use by container %s. "
+ "You have to remove (or rename) that container to be able to reuse that name.",
+ new_name, new_name);
ret = -1;
goto out;
}
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。