Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
3bb24761
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3bb24761
编写于
7月 31, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
7月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
!623 try print error message like before
Merge pull request !623 from wangfengtu/echo_back
上级
5d75b845
88f0b94d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
9 deletion
+31
-9
src/daemon/common/err_msg.c
src/daemon/common/err_msg.c
+1
-1
src/daemon/modules/image/oci/oci_export.c
src/daemon/modules/image/oci/oci_export.c
+4
-4
src/daemon/modules/image/oci/oci_import.c
src/daemon/modules/image/oci/oci_import.c
+3
-0
src/daemon/modules/image/oci/oci_load.c
src/daemon/modules/image/oci/oci_load.c
+15
-0
src/daemon/modules/image/oci/oci_login.c
src/daemon/modules/image/oci/oci_login.c
+3
-2
src/daemon/modules/image/oci/oci_logout.c
src/daemon/modules/image/oci/oci_logout.c
+2
-1
src/daemon/modules/image/oci/oci_pull.c
src/daemon/modules/image/oci/oci_pull.c
+3
-0
src/daemon/modules/image/oci/registry/registry_apiv2.c
src/daemon/modules/image/oci/registry/registry_apiv2.c
+0
-1
未找到文件。
src/daemon/common/err_msg.c
浏览文件 @
3bb24761
...
...
@@ -30,7 +30,6 @@ void isulad_set_error_message(const char *format, ...)
int
ret
=
0
;
char
errbuf
[
BUFSIZ
+
1
]
=
{
0
};
DAEMON_CLEAR_ERRMSG
();
va_list
argp
;
va_start
(
argp
,
format
);
...
...
@@ -40,6 +39,7 @@ void isulad_set_error_message(const char *format, ...)
return
;
}
DAEMON_CLEAR_ERRMSG
();
g_isulad_errmsg
=
util_strdup_s
(
errbuf
);
}
...
...
src/daemon/modules/image/oci/oci_export.c
浏览文件 @
3bb24761
...
...
@@ -36,14 +36,14 @@ int oci_do_export(char *id, char *file)
mount_point
=
storage_rootfs_mount
(
id
);
if
(
mount_point
==
NULL
)
{
ERROR
(
"mount container %s failed"
,
id
);
isulad_
try_set_error_message
(
"
failed to mount rootfs"
);
isulad_
set_error_message
(
"Failed to export rootfs with error:
failed to mount rootfs"
);
return
-
1
;
}
ret
=
chroot_tar
(
mount_point
,
file
,
&
errmsg
);
if
(
ret
!=
0
)
{
ERROR
(
"
export container %s to file %s failed"
,
id
,
file
);
isulad_
try_set_error_message
(
"
%s"
,
errmsg
);
ERROR
(
"
failed to export container %s to file %s: %s"
,
id
,
file
,
errmsg
);
isulad_
set_error_message
(
"Failed to export rootfs with error:
%s"
,
errmsg
);
goto
out
;
}
...
...
@@ -57,7 +57,7 @@ out:
if
(
ret2
!=
0
)
{
ret
=
ret2
;
ERROR
(
"umount container %s failed"
,
id
);
isulad_try_set_error_message
(
"failed to umount rootfs"
);
isulad_try_set_error_message
(
"
Failed to export rootfs with error:
failed to umount rootfs"
);
}
return
ret
;
...
...
src/daemon/modules/image/oci/oci_import.c
浏览文件 @
3bb24761
...
...
@@ -528,6 +528,9 @@ int oci_do_import(char *file, char *tag, char **id)
out:
free_imagetool_image
(
image
);
if
(
ret
!=
0
)
{
isulad_set_error_message
(
"Import image %s failed: %s"
,
file
,
g_isulad_errmsg
);
}
return
ret
;
}
src/daemon/modules/image/oci/oci_load.c
浏览文件 @
3bb24761
...
...
@@ -924,18 +924,21 @@ int oci_do_load(const im_load_request *request)
if
(
util_mkdir_p
(
OCI_LOAD_TMP_WORK_DIR
,
TEMP_DIRECTORY_MODE
)
!=
0
)
{
ERROR
(
"Unable to create oci image load tmp work dir:%s"
,
OCI_LOAD_TMP_WORK_DIR
);
isulad_try_set_error_message
(
"Unable to create oci image load tmp work dir:%s"
,
OCI_LOAD_TMP_WORK_DIR
);
ret
=
-
1
;
goto
out
;
}
if
(
mkdtemp
(
dstdir
)
==
NULL
)
{
ERROR
(
"make temporary direcory failed: %s"
,
strerror
(
errno
));
isulad_try_set_error_message
(
"make temporary direcory failed: %s"
,
strerror
(
errno
));
ret
=
-
1
;
goto
out
;
}
if
(
file_read_wrapper
(
request
->
file
,
&
reader
)
!=
0
)
{
ERROR
(
"Failed to fill layer read wrapper"
);
isulad_try_set_error_message
(
"Failed to fill layer read wrapper"
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -943,6 +946,7 @@ int oci_do_load(const im_load_request *request)
options
.
whiteout_format
=
NONE_WHITEOUT_FORMATE
;
if
(
archive_unpack
(
&
reader
,
dstdir
,
&
options
)
!=
0
)
{
ERROR
(
"Failed to unpack to :%s"
,
dstdir
);
isulad_try_set_error_message
(
"Failed to unpack to :%s"
,
dstdir
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -950,6 +954,7 @@ int oci_do_load(const im_load_request *request)
manifest_fpath
=
util_path_join
(
dstdir
,
"manifest.json"
);
if
(
manifest_fpath
==
NULL
)
{
ERROR
(
"Failed to join manifest.json path:%s"
,
dstdir
);
isulad_try_set_error_message
(
"Failed to join manifest.json path:%s"
,
dstdir
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -957,12 +962,14 @@ int oci_do_load(const im_load_request *request)
manifest
=
load_manifest
(
manifest_fpath
,
&
manifest_len
);
if
(
manifest
==
NULL
)
{
ERROR
(
"Failed to load manifest.json file from path:%s"
,
manifest_fpath
);
isulad_try_set_error_message
(
"Failed to load manifest.json file from path:%s"
,
manifest_fpath
);
ret
=
-
1
;
goto
out
;
}
if
(
!
oci_check_load_tags
(
manifest
,
manifest_len
,
request
->
tag
))
{
ERROR
(
"Value of --tags or repo tags invalid"
);
isulad_try_set_error_message
(
"Value of --tags or repo tags invalid"
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -971,6 +978,7 @@ int oci_do_load(const im_load_request *request)
if
(
digest
==
NULL
)
{
ret
=
-
1
;
ERROR
(
"calculate digest failed for manifest file %s"
,
manifest_fpath
);
isulad_try_set_error_message
(
"calculate digest failed for manifest file %s"
,
manifest_fpath
);
goto
out
;
}
...
...
@@ -978,17 +986,20 @@ int oci_do_load(const im_load_request *request)
im
=
oci_load_process_manifest
(
manifest
[
i
],
dstdir
);
if
(
im
==
NULL
)
{
ret
=
-
1
;
isulad_try_set_error_message
(
"process manifest failed"
);
goto
out
;
}
if
(
oci_load_set_manifest_info
(
im
)
!=
0
)
{
ERROR
(
"Image %s set manifest info err"
,
im
->
im_id
);
isulad_try_set_error_message
(
"Image %s set manifest info err"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
}
if
(
oci_load_check_image_layers
(
im
)
!=
0
)
{
ERROR
(
"Image %s check err"
,
im
->
im_id
);
isulad_try_set_error_message
(
"Image %s check err"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -996,6 +1007,7 @@ int oci_do_load(const im_load_request *request)
im
->
manifest_digest
=
util_strdup_s
(
digest
);
if
(
oci_load_register_image
(
im
,
request
->
tag
)
!=
0
)
{
ERROR
(
"error register image %s to store"
,
im
->
im_id
);
isulad_try_set_error_message
(
"error register image %s to store"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1004,6 +1016,9 @@ int oci_do_load(const im_load_request *request)
}
out:
if
(
ret
!=
0
)
{
isulad_set_error_message
(
"Load image %s failed: %s"
,
request
->
file
,
g_isulad_errmsg
);
}
free
(
manifest_fpath
);
free
(
digest
);
for
(
i
=
0
;
i
<
manifest_len
;
i
++
)
{
...
...
src/daemon/modules/image/oci/oci_login.c
浏览文件 @
3bb24761
...
...
@@ -27,12 +27,12 @@
static
int
is_valid_arguments
(
const
char
*
server
,
const
char
*
username
,
const
char
*
password
)
{
if
(
server
==
NULL
)
{
isulad_set_error_message
(
"
L
ogin requires server address"
);
isulad_set_error_message
(
"
Failed to login with error: l
ogin requires server address"
);
return
-
1
;
}
if
(
username
==
NULL
||
password
==
NULL
)
{
isulad_set_error_message
(
"
M
issing username or password"
);
isulad_set_error_message
(
"
Failed to login with error: m
issing username or password"
);
return
-
1
;
}
...
...
@@ -74,6 +74,7 @@ int oci_do_login(const char *server, const char *username, const char *password)
ret
=
registry_login
(
&
options
);
if
(
ret
!=
0
)
{
ERROR
(
"registry login failed"
);
isulad_set_error_message
(
"Failed to login with error: %s"
,
g_isulad_errmsg
);
goto
out
;
}
...
...
src/daemon/modules/image/oci/oci_logout.c
浏览文件 @
3bb24761
...
...
@@ -25,7 +25,7 @@
static
inline
int
is_valid_arguments
(
const
char
*
server
)
{
if
(
server
==
NULL
)
{
isulad_set_error_message
(
"
L
ogout requires server address"
);
isulad_set_error_message
(
"
Failed to logout with error: l
ogout requires server address"
);
return
-
1
;
}
return
0
;
...
...
@@ -52,6 +52,7 @@ int oci_do_logout(const char *server)
ret
=
registry_logout
((
char
*
)
host
);
if
(
ret
!=
0
)
{
ERROR
(
"registry logout failed"
);
isulad_set_error_message
(
"Failed to logout with error: %s"
,
g_isulad_errmsg
);
goto
out
;
}
...
...
src/daemon/modules/image/oci/oci_pull.c
浏览文件 @
3bb24761
...
...
@@ -184,6 +184,7 @@ int oci_do_pull_image(const im_pull_request *request, im_pull_response *response
ret
=
pull_image
(
request
,
&
dest_image_name
);
if
(
ret
!=
0
)
{
ERROR
(
"pull image %s failed"
,
request
->
image
);
isulad_set_error_message
(
"Failed to pull image %s with error: %s"
,
dest_image_name
,
g_isulad_errmsg
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -191,6 +192,8 @@ int oci_do_pull_image(const im_pull_request *request, im_pull_response *response
image
=
storage_img_get
(
dest_image_name
);
if
(
image
==
NULL
)
{
ERROR
(
"get image %s failed after pulling"
,
request
->
image
);
isulad_set_error_message
(
"Failed to pull image %s with error: image not found after pulling"
,
dest_image_name
);
ret
=
-
1
;
goto
out
;
}
...
...
src/daemon/modules/image/oci/registry/registry_apiv2.c
浏览文件 @
3bb24761
...
...
@@ -766,7 +766,6 @@ static int fetch_data(pull_descriptor *desc, char *path, char *file, char *conte
if
(
strcmp
(
content_type
,
DOCKER_MANIFEST_SCHEMA1_PRETTYJWS
)
&&
digest
!=
NULL
)
{
if
(
!
sha256_valid_digest_file
(
file
,
digest
))
{
type
=
BODY_ONLY
;
(
void
)
util_path_remove
(
file
);
// remove the invalid file to avoid resume pulling
if
(
retry_times
>
0
)
{
continue
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录