Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
a21b9a21
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,发现更多精彩内容 >>
提交
a21b9a21
编写于
4月 07, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
4月 07, 2020
浏览文件
操作
浏览文件
下载
差异文件
!176 Do not use rootfs to fill field image_name
Merge pull request !176 from wangfengtu/ps_image
上级
48b2eccf
05c84d9f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
36 deletion
+28
-36
CMakeLists.txt
CMakeLists.txt
+1
-1
iSulad.spec
iSulad.spec
+1
-1
src/image/external/ext_image.c
src/image/external/ext_image.c
+8
-8
src/image/image.c
src/image/image.c
+6
-7
src/image/image.h
src/image/image.h
+2
-3
src/services/execution/execute/execution_create.c
src/services/execution/execute/execution_create.c
+10
-16
未找到文件。
CMakeLists.txt
浏览文件 @
a21b9a21
...
...
@@ -9,7 +9,7 @@ include(cmake/set_build_flags.cmake)
#set(CMAKE_C_COMPILER "gcc" CACHE PATH "c compiler")
set
(
GIT_COMMIT_HASH
"
836228b6be4f000597c484a2862564134d25d9d0
"
)
set
(
GIT_COMMIT_HASH
"
f2a6e59b14e430d166e350cac06ec188fb7ca47e
"
)
message
(
"-- commit id: "
${
GIT_COMMIT_HASH
}
)
add_definitions
(
-DISULAD_GIT_COMMIT=
"
${
GIT_COMMIT_HASH
}
"
)
...
...
iSulad.spec
浏览文件 @
a21b9a21
%global _version 2.0.0
%global _release 2020040
3.055852.git836228b6
%global _release 2020040
6.224326.gitf2a6e59b
%global is_systemd 1
%global debug_package %{nil}
...
...
src/image/external/ext_image.c
浏览文件 @
a21b9a21
...
...
@@ -60,16 +60,16 @@ int ext_prepare_rf(const im_prepare_request *request, char **real_rootfs)
}
if
(
real_rootfs
!=
NULL
)
{
if
(
request
->
image_name
!=
NULL
)
{
if
(
request
->
rootfs
!=
NULL
)
{
char
real_path
[
PATH_MAX
]
=
{
0
};
if
(
request
->
image_name
[
0
]
!=
'/'
)
{
if
(
request
->
rootfs
[
0
]
!=
'/'
)
{
ERROR
(
"Rootfs should be absolutely path"
);
isulad_set_error_message
(
"Rootfs should be absolutely path"
);
return
-
1
;
}
if
(
realpath
(
request
->
image_name
,
real_path
)
==
NULL
)
{
ERROR
(
"Failed to clean rootfs path '%s': %s"
,
request
->
image_name
,
strerror
(
errno
));
isulad_set_error_message
(
"Failed to clean rootfs path '%s': %s"
,
request
->
image_name
,
strerror
(
errno
));
if
(
realpath
(
request
->
rootfs
,
real_path
)
==
NULL
)
{
ERROR
(
"Failed to clean rootfs path '%s': %s"
,
request
->
rootfs
,
strerror
(
errno
));
isulad_set_error_message
(
"Failed to clean rootfs path '%s': %s"
,
request
->
rootfs
,
strerror
(
errno
));
return
-
1
;
}
*
real_rootfs
=
util_strdup_s
(
real_path
);
...
...
@@ -128,15 +128,15 @@ int ext_merge_conf(const host_config *host_spec, container_config *container_spe
}
// No config neeed merge if NULL.
if
(
request
->
ext_config_imag
e
==
NULL
)
{
if
(
request
->
image_nam
e
==
NULL
)
{
ret
=
0
;
goto
out
;
}
// Get image's config and merge configs.
resolved_name
=
oci_resolve_image_name
(
request
->
ext_config_imag
e
);
resolved_name
=
oci_resolve_image_name
(
request
->
image_nam
e
);
if
(
resolved_name
==
NULL
)
{
ERROR
(
"Resolve external config image name failed, image name is %s"
,
request
->
ext_config_imag
e
);
ERROR
(
"Resolve external config image name failed, image name is %s"
,
request
->
image_nam
e
);
ret
=
-
1
;
goto
out
;
}
...
...
src/image/image.c
浏览文件 @
a21b9a21
...
...
@@ -534,8 +534,8 @@ void free_im_prepare_request(im_prepare_request *request)
request
->
image_name
=
NULL
;
free
(
request
->
container_id
);
request
->
container_id
=
NULL
;
free
(
request
->
ext_config_image
);
request
->
ext_config_image
=
NULL
;
free
(
request
->
rootfs
);
request
->
rootfs
=
NULL
;
free_json_map_string_string
(
request
->
storage_opt
);
request
->
storage_opt
=
NULL
;
...
...
@@ -706,8 +706,7 @@ bool im_config_image_exist(const char *image_name)
}
int
im_merge_image_config
(
const
char
*
id
,
const
char
*
image_type
,
const
char
*
image_name
,
const
char
*
ext_config_image
,
host_config
*
host_spec
,
container_config
*
container_spec
,
const
char
*
rootfs
,
host_config
*
host_spec
,
container_config
*
container_spec
,
char
**
real_rootfs
)
{
int
ret
=
0
;
...
...
@@ -720,7 +719,7 @@ int im_merge_image_config(const char *id, const char *image_type, const char *im
goto
out
;
}
bim
=
bim_get
(
image_type
,
image_name
,
ext_config_image
,
id
);
bim
=
bim_get
(
image_type
,
image_name
,
rootfs
,
id
);
if
(
bim
==
NULL
)
{
ERROR
(
"Failed to init bim of image %s"
,
image_name
);
ret
=
-
1
;
...
...
@@ -739,7 +738,7 @@ int im_merge_image_config(const char *id, const char *image_type, const char *im
}
request
->
container_id
=
util_strdup_s
(
id
);
request
->
image_name
=
util_strdup_s
(
image_name
);
request
->
ext_config_image
=
util_strdup_s
(
ext_config_image
);
request
->
rootfs
=
util_strdup_s
(
rootfs
);
if
(
host_spec
!=
NULL
)
{
request
->
storage_opt
=
host_spec
->
storage_opt
;
}
...
...
@@ -749,7 +748,7 @@ int im_merge_image_config(const char *id, const char *image_type, const char *im
ret
=
bim
->
ops
->
merge_conf
(
host_spec
,
container_spec
,
request
,
real_rootfs
);
request
->
storage_opt
=
NULL
;
if
(
ret
!=
0
)
{
ERROR
(
"Failed to merge image %s config
, config image is %s"
,
image_name
,
ext_config_imag
e
);
ERROR
(
"Failed to merge image %s config
"
,
image_nam
e
);
ret
=
-
1
;
goto
out
;
}
...
...
src/image/image.h
浏览文件 @
a21b9a21
...
...
@@ -187,7 +187,7 @@ typedef struct {
typedef
struct
{
char
*
image_name
;
char
*
container_id
;
char
*
ext_config_image
;
char
*
rootfs
;
json_map_string_string
*
storage_opt
;
}
im_prepare_request
;
...
...
@@ -300,8 +300,7 @@ int im_umount_container_rootfs(const char *image_type, const char *image_name, c
int
im_remove_container_rootfs
(
const
char
*
image_type
,
const
char
*
container_id
);
int
im_merge_image_config
(
const
char
*
id
,
const
char
*
image_type
,
const
char
*
image_name
,
const
char
*
ext_config_image
,
host_config
*
host_spec
,
container_config
*
container_spec
,
const
char
*
rootfs
,
host_config
*
host_spec
,
container_config
*
container_spec
,
char
**
real_rootfs
);
int
im_get_user_conf
(
const
char
*
image_type
,
const
char
*
basefs
,
host_config
*
hc
,
const
char
*
userstr
,
...
...
src/services/execution/execute/execution_create.c
浏览文件 @
a21b9a21
...
...
@@ -776,27 +776,21 @@ static int get_request_container_info(const container_create_request *request, c
return
0
;
}
static
int
get_request_image_info
(
const
container_create_request
*
request
,
char
**
image_type
,
const
char
**
ext_config_image
,
const
char
**
image_name
)
static
int
get_request_image_info
(
const
container_create_request
*
request
,
char
**
image_type
,
char
**
image_name
)
{
*
image_type
=
im_get_image_type
(
request
->
image
,
request
->
rootfs
);
if
(
*
image_type
==
NULL
)
{
return
-
1
;
}
if
(
request
->
rootfs
!=
NULL
)
{
*
image_name
=
request
->
rootfs
;
// Do not use none image because none image has no config.
if
(
strcmp
(
request
->
image
,
"none"
)
&&
strcmp
(
request
->
image
,
"none:latest"
))
{
*
ext_config_image
=
request
->
image
;
}
}
else
{
*
image_name
=
request
->
image
;
// Do not use none image because none image has no config.
if
(
strcmp
(
request
->
image
,
"none"
)
&&
strcmp
(
request
->
image
,
"none:latest"
))
{
*
image_name
=
util_strdup_s
(
request
->
image
);
}
// Check if config image exist if provided.
if
(
*
ext_config_imag
e
!=
NULL
)
{
if
(
!
im_config_image_exist
(
*
ext_config_imag
e
))
{
if
(
*
image_nam
e
!=
NULL
)
{
if
(
!
im_config_image_exist
(
*
image_nam
e
))
{
return
-
1
;
}
}
...
...
@@ -881,8 +875,7 @@ int container_create_cb(const container_create_request *request,
char
*
runtime
=
NULL
;
char
*
name
=
NULL
;
char
*
id
=
NULL
;
const
char
*
image_name
=
NULL
;
const
char
*
ext_config_image
=
NULL
;
char
*
image_name
=
NULL
;
oci_runtime_spec
*
oci_spec
=
NULL
;
host_config
*
host_spec
=
NULL
;
container_config
*
container_spec
=
NULL
;
...
...
@@ -900,7 +893,7 @@ int container_create_cb(const container_create_request *request,
goto
pack_response
;
}
if
(
get_request_image_info
(
request
,
&
image_type
,
&
ext_config_image
,
&
image_name
)
!=
0
)
{
if
(
get_request_image_info
(
request
,
&
image_type
,
&
image_name
)
!=
0
)
{
cc
=
ISULAD_ERR_EXEC
;
goto
clean_nameindex
;
}
...
...
@@ -941,7 +934,7 @@ int container_create_cb(const container_create_request *request,
goto
clean_container_root_dir
;
}
ret
=
im_merge_image_config
(
id
,
image_type
,
image_name
,
ext_config_image
,
host_spec
,
ret
=
im_merge_image_config
(
id
,
image_type
,
image_name
,
request
->
rootfs
,
host_spec
,
v2_spec
->
config
,
&
real_rootfs
);
if
(
ret
!=
0
)
{
ERROR
(
"Can not merge container_spec with image config"
);
...
...
@@ -1042,6 +1035,7 @@ pack_response:
free
(
runtime_root
);
free
(
real_rootfs
);
free
(
image_type
);
free
(
image_name
);
free
(
name
);
free
(
id
);
free_oci_runtime_spec
(
oci_spec
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录