Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
848008ad
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,发现更多精彩内容 >>
提交
848008ad
编写于
6月 05, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CI: fix testcases error
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
7c34fd25
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
88 addition
and
79 deletion
+88
-79
CI/test_cases/container_cases/check_fd_leakage_of_isulad.bash
...est_cases/container_cases/check_fd_leakage_of_isulad.bash
+1
-1
CI/test_cases/container_cases/cni_test.bash
CI/test_cases/container_cases/cni_test.bash
+9
-3
CI/test_cases/container_cases/create.bash
CI/test_cases/container_cases/create.bash
+1
-1
CI/test_cases/container_cases/create_mtab_test.bash
CI/test_cases/container_cases/create_mtab_test.bash
+1
-1
CI/test_cases/container_cases/export.bash
CI/test_cases/container_cases/export.bash
+3
-1
CI/test_cases/container_cases/kill.bash
CI/test_cases/container_cases/kill.bash
+1
-1
CI/test_cases/container_cases/ps.bash
CI/test_cases/container_cases/ps.bash
+1
-1
CI/test_cases/container_cases/restart.bash
CI/test_cases/container_cases/restart.bash
+1
-1
CI/test_cases/container_cases/restartpolicy.bash
CI/test_cases/container_cases/restartpolicy.bash
+1
-1
CI/test_cases/container_cases/rm.bash
CI/test_cases/container_cases/rm.bash
+1
-1
CI/test_cases/container_cases/run.bash
CI/test_cases/container_cases/run.bash
+1
-1
CI/test_cases/container_cases/share_ns_test.bash
CI/test_cases/container_cases/share_ns_test.bash
+4
-5
CI/test_cases/container_cases/update.bash
CI/test_cases/container_cases/update.bash
+1
-1
CI/test_cases/helpers.bash
CI/test_cases/helpers.bash
+1
-1
CI/test_cases/image_cases/image_inspect.bash
CI/test_cases/image_cases/image_inspect.bash
+1
-1
CI/test_cases/image_cases/image_remove.bash
CI/test_cases/image_cases/image_remove.bash
+1
-1
CI/test_cases/image_cases/image_tag.bash
CI/test_cases/image_cases/image_tag.bash
+1
-1
CI/test_cases/image_cases/images_list.bash
CI/test_cases/image_cases/images_list.bash
+1
-1
CI/test_cases/image_cases/img_fs_info.bash
CI/test_cases/image_cases/img_fs_info.bash
+1
-1
CI/test_cases/image_cases/registry.bash
CI/test_cases/image_cases/registry.bash
+1
-1
src/image/oci/oci_load.c
src/image/oci/oci_load.c
+12
-2
src/image/oci/registry/registry_apiv2.c
src/image/oci/registry/registry_apiv2.c
+1
-0
src/image/oci/storage/image_store/image_store.c
src/image/oci/storage/image_store/image_store.c
+1
-1
src/services/execution/execute/execution_stream.c
src/services/execution/execute/execution_stream.c
+1
-1
src/services/execution/spec/specs.c
src/services/execution/spec/specs.c
+40
-49
未找到文件。
CI/test_cases/container_cases/check_fd_leakage_of_isulad.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance fd
# concurrent: NO
# spend time: 1
6
# spend time: 1
4
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
# - iSulad licensed under the Mulan PSL v2.
...
...
CI/test_cases/container_cases/cni_test.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad cri cni
# concurrent: NA
# spend time: 4
5
# spend time: 4
3
curr_path
=
$(
dirname
$(
readlink
-f
"
$0
"
))
data_path
=
$(
realpath
$curr_path
/criconfigs
)
...
...
@@ -41,9 +41,15 @@ function do_test_help()
{
msg_info
"this is
$0
do_test"
crictl
images |
grep
busybox
crictl
pull
busybox
if
[
$?
-ne
0
]
;
then
msg_err
"Failed to find busybox image"
msg_err
"Failed to pull busybox image"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
crictl images |
grep
"mirrorgooglecontainers/pause-amd64"
if
[
$?
-ne
0
]
;
then
msg_err
"Failed to find mirrorgooglecontainers/pause-amd64 image"
TC_RET_T
=
$((
$TC_RET_T
+
1
))
fi
...
...
CI/test_cases/container_cases/create.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance create
# concurrent: YES
# spend time:
23
# spend time:
5
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/create_mtab_test.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance start
# concurrent: YES
# spend time:
6
# spend time:
2
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/export.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad basic export container
# concurrent: NA
# spend time:
5
# spend time:
6
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
@@ -47,6 +47,8 @@ function test_image_export()
isula
export
-o
nonexistdir/export.tar
${
CONT
}
[[
$?
-eq
0
]]
&&
msg_err
"
${
FUNCNAME
[0]
}
:
${
LINENO
}
- export to nonexist directory success"
&&
((
ret++
))
isula
rm
-f
${
CONT
}
msg_info
"
${
test
}
finished with return
${
ret
}
..."
return
${
ret
}
}
...
...
CI/test_cases/container_cases/kill.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance kill
# concurrent: YES
# spend time:
4
# spend time:
9
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/ps.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance ps list
# concurrent: NO
# spend time: 1
3
# spend time: 1
1
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/restart.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance restart
# concurrent: YES
# spend time: 3
8
# spend time: 3
2
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/restartpolicy.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance restartpolicy
# concurrent: NO
# spend time: 2
5
# spend time: 2
4
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/rm.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance rm
# concurrent: YES
# spend time: 1
5
# spend time: 1
2
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/run.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance run
# concurrent: YES
# spend time:
5
# spend time:
3
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/container_cases/share_ns_test.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad share namepaces
# concurrent: NO
# spend time:
4
5
# spend time:
2
5
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
@@ -36,14 +36,13 @@ function do_test_t()
cid[
$i
]=
`
isula create
-ti
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"create
${
cid
[
$i
]
}
"
msg
=
`
isula run
-tid
${
arr_ns_type
[
$i
]
}
=
"container:
${
cid
[
$i
]
}
"
busybox /bin/sh 2>&1
`
msg
=
`
isula run
-
-name
test1
-
tid
${
arr_ns_type
[
$i
]
}
=
"container:
${
cid
[
$i
]
}
"
busybox /bin/sh 2>&1
`
echo
$msg
|
grep
"Can not join namespace of a non running container"
fn_check_eq
"
$?
"
"0"
"share ipc fail test"
isula
rm
-f
${
cid
[
$i
]
}
isula
rm
-f
test1
rid[
$i
]=
`
isula run
-tid
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"run
${
rid
[
$i
]
}
"
isula
rm
-f
${
cid
[
$i
]
}
id
=
`
isula run
-tid
busybox /bin/sh
`
fn_check_eq
"
$?
"
"0"
"run
$id
"
...
...
CI/test_cases/container_cases/update.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance update
# concurrent: YES
# spend time: 1
4
# spend time: 1
5
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/helpers.bash
浏览文件 @
848008ad
...
...
@@ -24,7 +24,7 @@ LCR_ROOT_PATH="/var/lib/isulad/engines/lcr"
valgrind_log
=
"/tmp/valgrind.log"
ISUALD_LOG
=
"/var/lib/isulad/isulad.log"
declare
-r
-i
FAILURE
=
-
1
declare
-r
-i
FAILURE
=
1
function
cut_output_lines
()
{
message
=
`
$@
2>&1
`
...
...
CI/test_cases/image_cases/image_inspect.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad basic image list ps inspect
# concurrent: NA
# spend time:
8
# spend time:
4
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/image_cases/image_remove.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad basic remove image
# concurrent: NA
# spend time:
12
# spend time:
8
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/image_cases/image_tag.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance tag
# concurrent: YES
# spend time:
59
# spend time:
33
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/image_cases/images_list.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad basic image
# concurrent: NA
# spend time:
7
# spend time:
11
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/image_cases/img_fs_info.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad basic image
# concurrent: NA
# spend time:
5
# spend time:
3
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
CI/test_cases/image_cases/registry.bash
浏览文件 @
848008ad
...
...
@@ -2,7 +2,7 @@
#
# attributes: isulad inheritance version
# concurrent: YES
# spend time:
22
# spend time:
9
#######################################################################
##- @Copyright (C) Huawei Technologies., Ltd. 2020. All rights reserved.
...
...
src/image/oci/oci_load.c
浏览文件 @
848008ad
...
...
@@ -24,7 +24,7 @@
#define MANIFEST_BIG_DATA_KEY "manifest"
#define OCI_SCHEMA_VERSION 2
#define OCI_LOAD_TMP_DIR
OCI_LOAD_TMP_WORK_DIR
"/oci-image-load-XXXXXX"
#define OCI_LOAD_TMP_DIR
OCI_LOAD_TMP_WORK_DIR
"/oci-image-load-XXXXXX"
static
image_manifest_items_element
**
load_manifest
(
const
char
*
fname
,
size_t
*
length
)
{
...
...
@@ -358,6 +358,7 @@ static int oci_load_create_image(load_image_t *desc)
struct
storage_img_create_options
opts
=
{
0
};
char
*
top_layer_id
=
NULL
;
char
*
pre_top_layer
=
NULL
;
char
*
normalized_name
=
NULL
;
oci_image_spec
*
conf
=
NULL
;
types_timestamp_t
timestamp
=
{
0
};
...
...
@@ -403,16 +404,25 @@ static int oci_load_create_image(load_image_t *desc)
}
for
(;
i
<
desc
->
repo_tags_len
;
i
++
)
{
ret
=
storage_img_add_name
(
desc
->
im_id
,
desc
->
repo_tags
[
i
]);
normalized_name
=
oci_normalize_image_name
(
desc
->
repo_tags
[
i
]);
if
(
normalized_name
==
NULL
)
{
ret
=
-
1
;
ERROR
(
"Failed to normalized name %s"
,
desc
->
repo_tags
[
i
]);
goto
out
;
}
ret
=
storage_img_add_name
(
desc
->
im_id
,
normalized_name
);
if
(
ret
!=
0
)
{
ERROR
(
"add image name failed"
);
goto
out
;
}
free
(
normalized_name
);
normalized_name
=
NULL
;
}
out:
free_oci_image_spec
(
conf
);
free
(
pre_top_layer
);
free
(
normalized_name
);
return
ret
;
}
...
...
src/image/oci/registry/registry_apiv2.c
浏览文件 @
848008ad
...
...
@@ -667,6 +667,7 @@ static int fetch_data(pull_descriptor *desc, char *path, char *file, char *conte
if
(
strcmp
(
content_type
,
DOCKER_MANIFEST_SCHEMA1_PRETTYJWS
)
&&
digest
!=
NULL
)
{
if
(
!
util_valid_digest_file
(
file
,
digest
))
{
ERROR
(
"data from %s does not have digest %s"
,
path
,
digest
);
ret
=
-
1
;
goto
out
;
}
}
...
...
src/image/oci/storage/image_store/image_store.c
浏览文件 @
848008ad
...
...
@@ -1931,7 +1931,7 @@ bool image_store_exists(const char *id)
img
=
lookup
(
id
);
if
(
img
==
NULL
)
{
ERROR
(
"Image
not known"
);
ERROR
(
"Image
%s not known"
,
id
);
ret
=
false
;
goto
out
;
}
...
...
src/services/execution/execute/execution_stream.c
浏览文件 @
848008ad
...
...
@@ -487,7 +487,7 @@ static defs_process *make_exec_process_spec(const container_config *container_sp
}
spec
->
terminal
=
request
->
tty
;
spec
->
cwd
=
util_strdup_s
(
container_spec
->
working_dir
?
container_spec
->
working_dir
:
"/"
);
spec
->
cwd
=
util_strdup_s
(
util_valid_str
(
container_spec
->
working_dir
)
?
container_spec
->
working_dir
:
"/"
);
return
spec
;
...
...
src/services/execution/spec/specs.c
浏览文件 @
848008ad
...
...
@@ -49,31 +49,31 @@
#include "selinux_label.h"
#ifndef CLONE_NEWUTS
#define CLONE_NEWUTS
0x04000000
#define CLONE_NEWUTS 0x04000000
#endif
#ifndef CLONE_NEWUSER
#define CLONE_NEWUSER
0x10000000
#define CLONE_NEWUSER 0x10000000
#endif
#ifndef CLONE_NEWNET
#define CLONE_NEWNET
0x40000000
#define CLONE_NEWNET 0x40000000
#endif
#ifndef CLONE_NEWNS
#define CLONE_NEWNS
0x00020000
#define CLONE_NEWNS 0x00020000
#endif
#ifndef CLONE_NEWPID
#define CLONE_NEWPID
0x20000000
#define CLONE_NEWPID 0x20000000
#endif
#ifndef CLONE_NEWIPC
#define CLONE_NEWIPC
0x08000000
#define CLONE_NEWIPC 0x08000000
#endif
#ifndef CLONE_NEWCGROUP
#define CLONE_NEWCGROUP
0x02000000
#define CLONE_NEWCGROUP 0x02000000
#endif
static
int
make_sure_oci_spec_annotations
(
oci_runtime_spec
*
oci_spec
)
...
...
@@ -274,7 +274,8 @@ static int add_native_umask(const container_config *container_spec)
if
(
strcmp
(
container_spec
->
annotations
->
keys
[
i
],
ANNOTATION_UMAKE_KEY
)
==
0
)
{
if
(
!
is_valid_umask_value
(
container_spec
->
annotations
->
values
[
i
]))
{
ERROR
(
"native.umask option %s not supported"
,
container_spec
->
annotations
->
values
[
i
]);
isulad_set_error_message
(
"native.umask option %s not supported"
,
container_spec
->
annotations
->
values
[
i
]);
isulad_set_error_message
(
"native.umask option %s not supported"
,
container_spec
->
annotations
->
values
[
i
]);
ret
=
-
1
;
}
goto
out
;
...
...
@@ -668,18 +669,16 @@ static int merge_hugetlbs(oci_runtime_spec *oci_spec, host_config_hugetlbs_eleme
goto
out
;
}
if
(
hugetlbs_len
>
SIZE_MAX
/
sizeof
(
defs_resources_hugepage_limits_element
*
)
-
oci_spec
->
linux
->
resources
->
hugepage_limits_len
)
{
if
(
hugetlbs_len
>
SIZE_MAX
/
sizeof
(
defs_resources_hugepage_limits_element
*
)
-
oci_spec
->
linux
->
resources
->
hugepage_limits_len
)
{
ERROR
(
"Too many hugetlbs to merge!"
);
ret
=
-
1
;
goto
out
;
}
old_size
=
oci_spec
->
linux
->
resources
->
hugepage_limits_len
*
old_size
=
oci_spec
->
linux
->
resources
->
hugepage_limits_len
*
sizeof
(
defs_resources_hugepage_limits_element
*
);
new_size
=
(
oci_spec
->
linux
->
resources
->
hugepage_limits_len
+
hugetlbs_len
)
*
sizeof
(
defs_resources_hugepage_limits_element
*
);
new_size
=
(
oci_spec
->
linux
->
resources
->
hugepage_limits_len
+
hugetlbs_len
)
*
sizeof
(
defs_resources_hugepage_limits_element
*
);
ret
=
mem_realloc
((
void
**
)
&
hugepage_limits_temp
,
new_size
,
oci_spec
->
linux
->
resources
->
hugepage_limits
,
old_size
);
ret
=
mem_realloc
((
void
**
)
&
hugepage_limits_temp
,
new_size
,
oci_spec
->
linux
->
resources
->
hugepage_limits
,
old_size
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to realloc memory for hugepage limits"
);
ret
=
-
1
;
...
...
@@ -689,17 +688,17 @@ static int merge_hugetlbs(oci_runtime_spec *oci_spec, host_config_hugetlbs_eleme
oci_spec
->
linux
->
resources
->
hugepage_limits
=
hugepage_limits_temp
;
for
(
i
=
0
;
i
<
hugetlbs_len
;
i
++
)
{
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
=
util_common_calloc_s
(
sizeof
(
defs_resources_hugepage_limits_element
));
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
=
util_common_calloc_s
(
sizeof
(
defs_resources_hugepage_limits_element
));
if
(
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
==
NULL
)
{
ERROR
(
"Failed to malloc memory for hugepage limits"
);
ret
=
-
1
;
goto
out
;
}
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
->
limit
=
hugetlbs
[
i
]
->
limit
;
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
->
page_size
=
util_strdup_s
(
hugetlbs
[
i
]
->
page_size
);
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
->
limit
=
hugetlbs
[
i
]
->
limit
;
oci_spec
->
linux
->
resources
->
hugepage_limits
[
oci_spec
->
linux
->
resources
->
hugepage_limits_len
]
->
page_size
=
util_strdup_s
(
hugetlbs
[
i
]
->
page_size
);
oci_spec
->
linux
->
resources
->
hugepage_limits_len
++
;
}
out:
...
...
@@ -896,8 +895,7 @@ out:
return
ret
;
}
static
int
merge_hostname
(
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
,
container_config
*
container_spec
)
static
int
merge_hostname
(
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
,
container_config
*
container_spec
)
{
free
(
oci_spec
->
hostname
);
oci_spec
->
hostname
=
util_strdup_s
(
container_spec
->
hostname
);
...
...
@@ -1086,8 +1084,7 @@ out:
return
ret
;
}
static
int
do_merge_one_ulimit_override
(
const
oci_runtime_spec
*
oci_spec
,
defs_process_rlimits_element
*
rlimit
)
static
int
do_merge_one_ulimit_override
(
const
oci_runtime_spec
*
oci_spec
,
defs_process_rlimits_element
*
rlimit
)
{
size_t
j
;
bool
exists
=
false
;
...
...
@@ -1386,8 +1383,8 @@ static int merge_share_namespace_helper(const oci_runtime_spec *oci_spec, const
goto
out
;
}
ret
=
mem_realloc
((
void
**
)
&
work_ns
,
(
len
+
1
)
*
sizeof
(
defs_namespace_reference
*
),
(
void
*
)
work_ns
,
len
*
sizeof
(
defs_namespace_reference
*
));
ret
=
mem_realloc
((
void
**
)
&
work_ns
,
(
len
+
1
)
*
sizeof
(
defs_namespace_reference
*
),
(
void
*
)
work_ns
,
len
*
sizeof
(
defs_namespace_reference
*
));
if
(
ret
!=
0
)
{
ERROR
(
"Out of memory"
);
goto
out
;
...
...
@@ -1480,7 +1477,7 @@ static int merge_working_dir(oci_runtime_spec *oci_spec, const char *working_dir
{
int
ret
=
0
;
if
(
working_dir
==
NULL
)
{
if
(
!
util_valid_str
(
working_dir
)
)
{
return
0
;
}
...
...
@@ -1519,8 +1516,8 @@ static int change_tmpfs_mount_size(const oci_runtime_spec *oci_spec, int64_t mem
if
(
strcmp
(
"tmpfs"
,
oci_spec
->
mounts
[
i
]
->
type
)
!=
0
)
{
continue
;
}
if
(
strcmp
(
"/run"
,
oci_spec
->
mounts
[
i
]
->
destination
)
==
0
||
\
strcmp
(
"/run/lock"
,
oci_spec
->
mounts
[
i
]
->
destination
)
==
0
||
\
if
(
strcmp
(
"/run"
,
oci_spec
->
mounts
[
i
]
->
destination
)
==
0
||
strcmp
(
"/run/lock"
,
oci_spec
->
mounts
[
i
]
->
destination
)
==
0
||
strcmp
(
"/tmp"
,
oci_spec
->
mounts
[
i
]
->
destination
)
==
0
)
{
ret
=
util_array_append
(
&
oci_spec
->
mounts
[
i
]
->
options
,
size_opt
);
if
(
ret
!=
0
)
{
...
...
@@ -1687,9 +1684,8 @@ out:
return
ret
;
}
int
parse_security_opt
(
const
host_config
*
host_spec
,
bool
*
no_new_privileges
,
char
***
label_opts
,
size_t
*
label_opts_len
,
char
**
seccomp_profile
)
int
parse_security_opt
(
const
host_config
*
host_spec
,
bool
*
no_new_privileges
,
char
***
label_opts
,
size_t
*
label_opts_len
,
char
**
seccomp_profile
)
{
int
ret
=
0
;
size_t
i
;
...
...
@@ -1794,8 +1790,8 @@ static int handle_host_or_privileged_mode(host_config *hc)
goto
out
;
}
if
(
to_host_config_selinux_labels
((
const
char
**
)
labels
,
labels_len
,
&
hc
->
security_opt
,
&
hc
->
security_opt_len
)
!=
0
)
{
if
(
to_host_config_selinux_labels
((
const
char
**
)
labels
,
labels_len
,
&
hc
->
security_opt
,
&
hc
->
security_opt_len
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1805,8 +1801,8 @@ out:
return
ret
;
}
static
int
handle_ipc_pid_label
(
host_config
*
hc
,
const
char
**
ipc_label
,
size_t
ipc_label_len
,
const
char
**
pid_label
,
size_t
pid_label_len
)
static
int
handle_ipc_pid_label
(
host_config
*
hc
,
const
char
**
ipc_label
,
size_t
ipc_label_len
,
const
char
**
pid_label
,
size_t
pid_label_len
)
{
int
ret
=
0
;
size_t
i
;
...
...
@@ -1824,8 +1820,8 @@ static int handle_ipc_pid_label(host_config *hc, const char **ipc_label, size_t
goto
out
;
}
}
if
(
to_host_config_selinux_labels
((
const
char
**
)
pid_label
,
pid_label_len
,
&
hc
->
security_opt
,
&
hc
->
security_opt
_len
)
!=
0
)
{
if
(
to_host_config_selinux_labels
((
const
char
**
)
pid_label
,
pid_label_len
,
&
hc
->
security_opt
,
&
hc
->
security_opt_len
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1882,8 +1878,8 @@ static int handle_connected_container_mode(host_config *hc)
free
(
pid_process_label
);
}
if
(
handle_ipc_pid_label
(
hc
,
(
const
char
**
)
ipc_label
,
ipc_label_len
,
(
const
char
**
)
pid_label
,
pid_label_len
)
!=
0
)
{
if
(
handle_ipc_pid_label
(
hc
,
(
const
char
**
)
ipc_label
,
ipc_label_len
,
(
const
char
**
)
pid_label
,
pid_label_len
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1921,7 +1917,6 @@ static int generate_security_opt(host_config *hc)
return
handle_connected_container_mode
(
hc
);
}
static
int
merge_security_conf
(
oci_runtime_spec
*
oci_spec
,
host_config
*
host_spec
,
container_config_v2_common_config
*
v2_spec
)
{
...
...
@@ -1950,8 +1945,7 @@ static int merge_security_conf(oci_runtime_spec *oci_spec, host_config *host_spe
goto
out
;
}
ret
=
parse_security_opt
(
host_spec
,
&
no_new_privileges
,
&
label_opts
,
&
label_opts_len
,
&
seccomp_profile
);
ret
=
parse_security_opt
(
host_spec
,
&
no_new_privileges
,
&
label_opts
,
&
label_opts_len
,
&
seccomp_profile
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to parse security opt"
);
goto
out
;
...
...
@@ -1984,9 +1978,8 @@ out:
return
ret
;
}
int
merge_all_specs
(
host_config
*
host_spec
,
const
char
*
real_rootfs
,
container_config_v2_common_config
*
v2_spec
,
oci_runtime_spec
*
oci_spec
)
int
merge_all_specs
(
host_config
*
host_spec
,
const
char
*
real_rootfs
,
container_config_v2_common_config
*
v2_spec
,
oci_runtime_spec
*
oci_spec
)
{
int
ret
=
0
;
...
...
@@ -2174,5 +2167,3 @@ out_free:
free
(
json_container
);
return
ret
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录