Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
96a91f30
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,发现更多精彩内容 >>
提交
96a91f30
编写于
6月 29, 2020
作者:
G
gaohuatao
提交者:
lifeng68
7月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify oci_load return value format
Signed-off-by:
N
gaohuatao
<
gaohuatao@huawei.com
>
上级
5646e5f7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
50 deletion
+44
-50
src/daemon/image/oci/oci_load.c
src/daemon/image/oci/oci_load.c
+44
-50
未找到文件。
src/daemon/image/oci/oci_load.c
浏览文件 @
96a91f30
...
@@ -367,8 +367,8 @@ static int oci_load_set_image_name(const char *img_id, const char *img_name)
...
@@ -367,8 +367,8 @@ static int oci_load_set_image_name(const char *img_id, const char *img_name)
goto
out
;
goto
out
;
}
}
ret
=
storage_img_add_name
(
img_id
,
normalized_name
);
if
(
storage_img_add_name
(
img_id
,
normalized_name
)
!=
0
)
{
if
(
ret
!=
0
)
{
ret
=
-
1
;
ERROR
(
"add image name failed"
);
ERROR
(
"add image name failed"
);
}
}
...
@@ -411,8 +411,7 @@ static int oci_load_create_image(load_image_t *desc, const char *dst_tag)
...
@@ -411,8 +411,7 @@ static int oci_load_create_image(load_image_t *desc, const char *dst_tag)
goto
out
;
goto
out
;
}
}
ret
=
storage_img_create
(
desc
->
im_id
,
top_layer_id
,
NULL
,
&
opts
);
if
(
storage_img_create
(
desc
->
im_id
,
top_layer_id
,
NULL
,
&
opts
)
!=
0
)
{
if
(
ret
!=
0
)
{
pre_top_layer
=
storage_get_img_top_layer
(
desc
->
im_id
);
pre_top_layer
=
storage_get_img_top_layer
(
desc
->
im_id
);
if
(
pre_top_layer
==
NULL
)
{
if
(
pre_top_layer
==
NULL
)
{
ERROR
(
"create image %s failed"
,
desc
->
im_id
);
ERROR
(
"create image %s failed"
,
desc
->
im_id
);
...
@@ -426,21 +425,20 @@ static int oci_load_create_image(load_image_t *desc, const char *dst_tag)
...
@@ -426,21 +425,20 @@ static int oci_load_create_image(load_image_t *desc, const char *dst_tag)
ret
=
-
1
;
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
0
;
}
}
if
(
dst_tag
!=
NULL
)
{
if
(
dst_tag
!=
NULL
)
{
ret
=
oci_load_set_image_name
(
desc
->
im_id
,
dst_tag
);
if
(
oci_load_set_image_name
(
desc
->
im_id
,
dst_tag
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Failed to set image:%s name by using tag:%s"
,
desc
->
im_id
,
dst_tag
);
ERROR
(
"Failed to set image:%s name by using tag:%s"
,
desc
->
im_id
,
dst_tag
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
}
else
{
}
else
{
for
(;
i
<
desc
->
repo_tags_len
;
i
++
)
{
for
(;
i
<
desc
->
repo_tags_len
;
i
++
)
{
ret
=
oci_load_set_image_name
(
desc
->
im_id
,
desc
->
repo_tags
[
i
]);
if
(
oci_load_set_image_name
(
desc
->
im_id
,
desc
->
repo_tags
[
i
])
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Failed to set image:%s name by using tag:%s"
,
desc
->
im_id
,
desc
->
repo_tags
[
i
]);
ERROR
(
"Failed to set image:%s name by using tag:%s"
,
desc
->
im_id
,
desc
->
repo_tags
[
i
]);
break
;
ret
=
-
1
;
goto
out
;
}
}
}
}
}
}
...
@@ -469,10 +467,9 @@ static int oci_load_set_manifest(const oci_image_manifest *m, char *image_id)
...
@@ -469,10 +467,9 @@ static int oci_load_set_manifest(const oci_image_manifest *m, char *image_id)
goto
out
;
goto
out
;
}
}
ret
=
storage_img_set_big_data
(
image_id
,
MANIFEST_BIG_DATA_KEY
,
manifest_str
);
if
(
storage_img_set_big_data
(
image_id
,
MANIFEST_BIG_DATA_KEY
,
manifest_str
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set big data failed"
);
ERROR
(
"set big data failed"
);
goto
out
;
ret
=
-
1
;
}
}
out:
out:
...
@@ -498,10 +495,9 @@ static int oci_load_set_config(load_image_t *desc)
...
@@ -498,10 +495,9 @@ static int oci_load_set_config(load_image_t *desc)
goto
out
;
goto
out
;
}
}
ret
=
storage_img_set_big_data
(
desc
->
im_id
,
desc
->
im_digest
,
config_str
);
if
(
storage_img_set_big_data
(
desc
->
im_id
,
desc
->
im_digest
,
config_str
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set big data failed"
);
ERROR
(
"set big data failed"
);
goto
out
;
ret
=
-
1
;
}
}
out:
out:
...
@@ -521,10 +517,9 @@ static int oci_load_set_loaded_time(char *image_id)
...
@@ -521,10 +517,9 @@ static int oci_load_set_loaded_time(char *image_id)
goto
out
;
goto
out
;
}
}
ret
=
storage_img_set_loaded_time
(
image_id
,
&
now
);
if
(
storage_img_set_loaded_time
(
image_id
,
&
now
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set loaded time failed"
);
ERROR
(
"set loaded time failed"
);
goto
out
;
ret
=
-
1
;
}
}
out:
out:
...
@@ -541,41 +536,40 @@ static int oci_load_register_image(load_image_t *desc, const char *dst_tag)
...
@@ -541,41 +536,40 @@ static int oci_load_register_image(load_image_t *desc, const char *dst_tag)
return
-
1
;
return
-
1
;
}
}
ret
=
oci_load_register_layers
(
desc
);
if
(
oci_load_register_layers
(
desc
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"registry layers failed"
);
ERROR
(
"registry layers failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
oci_load_create_image
(
desc
,
dst_tag
);
if
(
oci_load_create_image
(
desc
,
dst_tag
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"create image failed"
);
ERROR
(
"create image failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
image_created
=
true
;
image_created
=
true
;
ret
=
oci_load_set_config
(
desc
);
if
(
oci_load_set_config
(
desc
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set image config failed"
);
ERROR
(
"set image config failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
oci_load_set_manifest
(
desc
->
manifest
,
desc
->
im_id
);
if
(
oci_load_set_manifest
(
desc
->
manifest
,
desc
->
im_id
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set manifest failed"
);
ERROR
(
"set manifest failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
oci_load_set_loaded_time
(
desc
->
im_id
);
if
(
oci_load_set_loaded_time
(
desc
->
im_id
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set loaded time failed"
);
ERROR
(
"set loaded time failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
storage_img_set_image_size
(
desc
->
im_id
);
if
(
storage_img_set_image_size
(
desc
->
im_id
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"set image size failed for %s failed"
,
desc
->
im_id
);
ERROR
(
"set image size failed for %s failed"
,
desc
->
im_id
);
goto
out
;
ret
=
-
1
;
}
}
out:
out:
...
@@ -617,14 +611,14 @@ static int oci_load_set_layers_info(load_image_t *im, const image_manifest_items
...
@@ -617,14 +611,14 @@ static int oci_load_set_layers_info(load_image_t *im, const image_manifest_items
layer_fpath
=
util_path_join
(
dstdir
,
manifest
->
layers
[
i
]);
layer_fpath
=
util_path_join
(
dstdir
,
manifest
->
layers
[
i
]);
if
(
layer_fpath
==
NULL
)
{
if
(
layer_fpath
==
NULL
)
{
ret
=
-
1
;
ERROR
(
"Path join failed"
);
ERROR
(
"Path join failed"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
util_gzip_compressed
(
layer_fpath
,
&
gzip
);
if
(
util_gzip_compressed
(
layer_fpath
,
&
gzip
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Judge layer file gzip attribute err"
);
ERROR
(
"Judge layer file gzip attribute err"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
@@ -701,14 +695,14 @@ static load_image_t *oci_load_process_manifest(const image_manifest_items_elemen
...
@@ -701,14 +695,14 @@ static load_image_t *oci_load_process_manifest(const image_manifest_items_elemen
im
->
repo_tags_len
=
manifest
->
repo_tags_len
;
im
->
repo_tags_len
=
manifest
->
repo_tags_len
;
im
->
repo_tags
=
manifest
->
repo_tags_len
==
0
?
NULL
:
str_array_copy
(
manifest
->
repo_tags
,
manifest
->
repo_tags_len
);
im
->
repo_tags
=
manifest
->
repo_tags_len
==
0
?
NULL
:
str_array_copy
(
manifest
->
repo_tags
,
manifest
->
repo_tags_len
);
ret
=
oci_load_set_layers_info
(
im
,
manifest
,
dstdir
);
if
(
oci_load_set_layers_info
(
im
,
manifest
,
dstdir
)
!=
0
)
{
if
(
ret
!=
0
)
{
ret
=
-
1
;
ERROR
(
"Image load set layers info err"
);
ERROR
(
"Image load set layers info err"
);
goto
out
;
goto
out
;
}
}
ret
=
oci_load_set_chain_id
(
im
);
if
(
oci_load_set_chain_id
(
im
)
!=
0
)
{
if
(
ret
!=
0
)
{
ret
=
-
1
;
ERROR
(
"Calc image chain id failed"
);
ERROR
(
"Calc image chain id failed"
);
}
}
...
@@ -735,8 +729,8 @@ static int oci_load_set_manifest_info(load_image_t *im)
...
@@ -735,8 +729,8 @@ static int oci_load_set_manifest_info(load_image_t *im)
im
->
manifest
=
util_common_calloc_s
(
sizeof
(
oci_image_manifest
));
im
->
manifest
=
util_common_calloc_s
(
sizeof
(
oci_image_manifest
));
if
(
im
->
manifest
==
NULL
)
{
if
(
im
->
manifest
==
NULL
)
{
ret
=
-
1
;
ERROR
(
"Out of memory"
);
ERROR
(
"Out of memory"
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
@@ -908,9 +902,9 @@ int oci_do_load(const im_load_request *request)
...
@@ -908,9 +902,9 @@ int oci_do_load(const im_load_request *request)
return
-
1
;
return
-
1
;
}
}
ret
=
util_mkdir_p
(
OCI_LOAD_TMP_WORK_DIR
,
TEMP_DIRECTORY_MODE
);
if
(
util_mkdir_p
(
OCI_LOAD_TMP_WORK_DIR
,
TEMP_DIRECTORY_MODE
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Unable to create oci image load tmp work dir:%s"
,
OCI_LOAD_TMP_WORK_DIR
);
ERROR
(
"Unable to create oci image load tmp work dir:%s"
,
OCI_LOAD_TMP_WORK_DIR
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
@@ -927,9 +921,9 @@ int oci_do_load(const im_load_request *request)
...
@@ -927,9 +921,9 @@ int oci_do_load(const im_load_request *request)
}
}
options
.
whiteout_format
=
NONE_WHITEOUT_FORMATE
;
options
.
whiteout_format
=
NONE_WHITEOUT_FORMATE
;
ret
=
archive_unpack
(
&
reader
,
dstdir
,
&
options
);
if
(
archive_unpack
(
&
reader
,
dstdir
,
&
options
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Failed to unpack to :%s"
,
dstdir
);
ERROR
(
"Failed to unpack to :%s"
,
dstdir
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
@@ -967,22 +961,22 @@ int oci_do_load(const im_load_request *request)
...
@@ -967,22 +961,22 @@ int oci_do_load(const im_load_request *request)
goto
out
;
goto
out
;
}
}
ret
=
oci_load_set_manifest_info
(
im
);
if
(
oci_load_set_manifest_info
(
im
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Image %s set manifest info err"
,
im
->
im_id
);
ERROR
(
"Image %s set manifest info err"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
ret
=
oci_load_check_image_layers
(
im
);
if
(
oci_load_check_image_layers
(
im
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"Image %s check err"
,
im
->
im_id
);
ERROR
(
"Image %s check err"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
im
->
manifest_digest
=
util_strdup_s
(
digest
);
im
->
manifest_digest
=
util_strdup_s
(
digest
);
ret
=
oci_load_register_image
(
im
,
request
->
tag
);
if
(
oci_load_register_image
(
im
,
request
->
tag
)
!=
0
)
{
if
(
ret
!=
0
)
{
ERROR
(
"error register image %s to store"
,
im
->
im_id
);
ERROR
(
"error register image %s to store"
,
im
->
im_id
);
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
oci_load_free_image
(
im
);
oci_load_free_image
(
im
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录