Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
8345022e
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,发现更多精彩内容 >>
提交
8345022e
编写于
5月 26, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upgrade: add update v1 ociconfig.json to config.json
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
0c3bc44a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
8 deletion
+38
-8
src/constants.h
src/constants.h
+1
-2
src/services/execution/manager/container_unix.c
src/services/execution/manager/container_unix.c
+37
-6
未找到文件。
src/constants.h
浏览文件 @
8345022e
...
...
@@ -58,7 +58,7 @@
#define DEFAULT_KEY_FILE "key.pem"
#define DEFAULT_CERT_FILE "cert.pem"
#define OCI_CONFIG_JSON "config.json"
#define OCI_CONFIG_JSON_V1 "ociconfig.json"
#define LOG_MAX_RETRIES 10
...
...
@@ -76,4 +76,3 @@
#define CONTAINER_LOG_CONFIG_KEY_SYSLOG_FACILITY "log.console.facility"
#endif
src/services/execution/manager/container_unix.c
浏览文件 @
8345022e
...
...
@@ -106,8 +106,7 @@ container_t *container_new(const char *runtime, const char *rootpath, const char
goto
error_out
;
}
cont
->
rm
=
restart_manager_new
(
tmp_host_config
->
restart_policy
,
tmp_common_config
->
restart_count
);
cont
->
rm
=
restart_manager_new
(
tmp_host_config
->
restart_policy
,
tmp_common_config
->
restart_count
);
if
(
cont
->
rm
==
NULL
)
{
ERROR
(
"Out of memory"
);
goto
error_out
;
...
...
@@ -245,7 +244,6 @@ int container_timedlock(container_t *cont, int timeout)
}
}
/* container unlock */
void
container_unlock
(
container_t
*
cont
)
{
...
...
@@ -458,8 +456,7 @@ out:
}
/* save json config file */
static
int
save_json_config_file
(
const
char
*
id
,
const
char
*
rootpath
,
const
char
*
json_data
,
const
char
*
fname
)
static
int
save_json_config_file
(
const
char
*
id
,
const
char
*
rootpath
,
const
char
*
json_data
,
const
char
*
fname
)
{
int
ret
=
0
;
int
nret
;
...
...
@@ -711,6 +708,36 @@ out:
return
ret
;
}
// cp old container config file "ociconfig.json" to "config.json"
static
int
update_v1_config_to_v2
(
const
char
*
rootpath
,
const
char
*
id
)
{
int
ret
=
0
;
int
nret
=
0
;
char
v1_filename
[
PATH_MAX
]
=
{
0x00
};
char
v2_filename
[
PATH_MAX
]
=
{
0x00
};
nret
=
snprintf
(
v1_filename
,
sizeof
(
v1_filename
),
"%s/%s/%s"
,
rootpath
,
id
,
OCI_CONFIG_JSON_V1
);
if
(
nret
<
0
||
(
size_t
)
nret
>=
sizeof
(
v1_filename
))
{
ERROR
(
"Failed to print string"
);
ret
=
-
1
;
goto
out
;
}
nret
=
snprintf
(
v2_filename
,
sizeof
(
v2_filename
),
"%s/%s/%s"
,
rootpath
,
id
,
OCI_CONFIG_JSON
);
if
(
nret
<
0
||
(
size_t
)
nret
>=
sizeof
(
v2_filename
))
{
ERROR
(
"Failed to print string"
);
ret
=
-
1
;
goto
out
;
}
if
(
util_file_exists
(
v1_filename
)
&&
!
util_file_exists
(
v2_filename
))
{
ret
=
util_copy_file
(
v1_filename
,
v2_filename
,
CONFIG_FILE_MODE
);
}
out:
return
ret
;
}
/* container load */
container_t
*
container_load
(
const
char
*
runtime
,
const
char
*
rootpath
,
const
char
*
statepath
,
const
char
*
id
)
{
...
...
@@ -736,6 +763,11 @@ container_t *container_load(const char *runtime, const char *rootpath, const cha
goto
error_out
;
}
if
(
update_v1_config_to_v2
(
rootpath
,
id
)
!=
0
)
{
ERROR
(
"Failed to update config to v2 for container: %s"
,
id
);
goto
error_out
;
}
common_config
=
v2config
->
common_config
;
v2config
->
common_config
=
NULL
;
image_id
=
v2config
->
image
;
...
...
@@ -1100,4 +1132,3 @@ bool has_mount_for(container_t *cont, const char *mpath)
return
false
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录