Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
058adb5b
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 搜索 >>
提交
058adb5b
编写于
6月 30, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: add api head files to api directory
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
de229b28
变更
55
隐藏空白更改
内联
并排
Showing
55 changed file
with
196 addition
and
210 deletion
+196
-210
src/cmd/isulad/main.c
src/cmd/isulad/main.c
+5
-5
src/daemon/entry/cri/cri_image_service.cc
src/daemon/entry/cri/cri_image_service.cc
+2
-2
src/daemon/executor/container_cb/execution.c
src/daemon/executor/container_cb/execution.c
+5
-5
src/daemon/executor/container_cb/execution_create.c
src/daemon/executor/container_cb/execution_create.c
+5
-5
src/daemon/executor/container_cb/execution_extend.c
src/daemon/executor/container_cb/execution_extend.c
+5
-5
src/daemon/executor/container_cb/execution_information.c
src/daemon/executor/container_cb/execution_information.c
+10
-7
src/daemon/executor/container_cb/execution_stream.c
src/daemon/executor/container_cb/execution_stream.c
+3
-3
src/daemon/executor/container_cb/io_handler.c
src/daemon/executor/container_cb/io_handler.c
+3
-3
src/daemon/executor/image_cb/image_cb.c
src/daemon/executor/image_cb/image_cb.c
+2
-2
src/daemon/modules/api/container_api.h
src/daemon/modules/api/container_api.h
+0
-2
src/daemon/modules/api/event_type.h
src/daemon/modules/api/event_type.h
+0
-0
src/daemon/modules/api/events_collector_api.h
src/daemon/modules/api/events_collector_api.h
+0
-0
src/daemon/modules/api/events_sender_api.h
src/daemon/modules/api/events_sender_api.h
+0
-0
src/daemon/modules/api/log_gather_api.h
src/daemon/modules/api/log_gather_api.h
+0
-0
src/daemon/modules/api/plugin_api.h
src/daemon/modules/api/plugin_api.h
+13
-14
src/daemon/modules/api/runtime_api.h
src/daemon/modules/api/runtime_api.h
+0
-0
src/daemon/modules/api/service_container_api.h
src/daemon/modules/api/service_container_api.h
+1
-5
src/daemon/modules/api/service_image_api.h
src/daemon/modules/api/service_image_api.h
+0
-0
src/daemon/modules/api/specs_api.h
src/daemon/modules/api/specs_api.h
+5
-9
src/daemon/modules/container/container_events_handler.c
src/daemon/modules/container/container_events_handler.c
+2
-2
src/daemon/modules/container/container_gc/containers_gc.c
src/daemon/modules/container/container_gc/containers_gc.c
+2
-2
src/daemon/modules/container/health_check/health_check.c
src/daemon/modules/container/health_check/health_check.c
+10
-15
src/daemon/modules/container/restart_manager/restartmanager.c
...daemon/modules/container/restart_manager/restartmanager.c
+2
-1
src/daemon/modules/container/restore/restore.c
src/daemon/modules/container/restore/restore.c
+2
-2
src/daemon/modules/container/supervisor/supervisor.c
src/daemon/modules/container/supervisor/supervisor.c
+2
-2
src/daemon/modules/events/collector.c
src/daemon/modules/events/collector.c
+1
-1
src/daemon/modules/events/monitord.c
src/daemon/modules/events/monitord.c
+2
-2
src/daemon/modules/events_sender/event_sender.c
src/daemon/modules/events_sender/event_sender.c
+11
-13
src/daemon/modules/log/log_gather.c
src/daemon/modules/log/log_gather.c
+2
-3
src/daemon/modules/plugin/plugin.c
src/daemon/modules/plugin/plugin.c
+2
-2
src/daemon/modules/plugin/pspec.c
src/daemon/modules/plugin/pspec.c
+7
-10
src/daemon/modules/runtime/engines/engine.h
src/daemon/modules/runtime/engines/engine.h
+1
-1
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
+1
-1
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.h
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.h
+1
-1
src/daemon/modules/runtime/isula/isula_rt_ops.c
src/daemon/modules/runtime/isula/isula_rt_ops.c
+3
-3
src/daemon/modules/runtime/isula/isula_rt_ops.h
src/daemon/modules/runtime/isula/isula_rt_ops.h
+1
-1
src/daemon/modules/runtime/runtime.c
src/daemon/modules/runtime/runtime.c
+1
-1
src/daemon/modules/service/service_container.c
src/daemon/modules/service/service_container.c
+5
-5
src/daemon/modules/service/service_image.c
src/daemon/modules/service/service_image.c
+2
-2
src/daemon/modules/spec/specs.c
src/daemon/modules/spec/specs.c
+4
-4
src/daemon/modules/spec/specs_security.c
src/daemon/modules/spec/specs_security.c
+32
-35
src/daemon/modules/spec/verify.c
src/daemon/modules/spec/verify.c
+1
-1
test/image/oci/oci_config_merge/CMakeLists.txt
test/image/oci/oci_config_merge/CMakeLists.txt
+1
-0
test/image/oci/storage/layers/CMakeLists.txt
test/image/oci/storage/layers/CMakeLists.txt
+1
-0
test/mocks/collector_mock.h
test/mocks/collector_mock.h
+2
-2
test/mocks/container_operator_mock.h
test/mocks/container_operator_mock.h
+1
-1
test/mocks/runtime_mock.h
test/mocks/runtime_mock.h
+1
-1
test/mocks/specs_mock.h
test/mocks/specs_mock.h
+3
-3
test/runtime/isula/CMakeLists.txt
test/runtime/isula/CMakeLists.txt
+1
-0
test/runtime/lcr/CMakeLists.txt
test/runtime/lcr/CMakeLists.txt
+1
-0
test/services/execution/execute/execution_extend/CMakeLists.txt
...ervices/execution/execute/execution_extend/CMakeLists.txt
+1
-0
test/specs/specs/CMakeLists.txt
test/specs/specs/CMakeLists.txt
+1
-0
test/specs/specs/specs_ut.cpp
test/specs/specs/specs_ut.cpp
+11
-11
test/specs/specs_extend/CMakeLists.txt
test/specs/specs_extend/CMakeLists.txt
+1
-0
test/specs/specs_extend/specs_extend_ut.cpp
test/specs/specs_extend/specs_extend_ut.cpp
+15
-15
未找到文件。
src/cmd/isulad/main.c
浏览文件 @
058adb5b
...
...
@@ -39,7 +39,7 @@
#endif
#include "constants.h"
#include "
collector
.h"
#include "
events_collector_api
.h"
#include "isulad_commands.h"
#include "isula_libutils/log.h"
#include "utils.h"
...
...
@@ -49,13 +49,13 @@
#include "verify.h"
#include "service_common.h"
#include "callback.h"
#include "log_gather.h"
#include "log_gather
_api
.h"
#include "container_api.h"
#include "service_container.h"
#include "plugin.h"
#include "service_container
_api
.h"
#include "plugin
_api
.h"
#include "selinux_label.h"
#include "http.h"
#include "runtime.h"
#include "runtime
_api
.h"
#ifdef GRPC_CONNECTOR
#include "clibcni/api.h"
...
...
src/daemon/entry/cri/cri_image_service.cc
浏览文件 @
058adb5b
...
...
@@ -26,8 +26,8 @@
#include "isula_libutils/log.h"
#include "utils.h"
#include "cri_helpers.h"
#include "event
_sender
.h"
#include "service_image.h"
#include "event
s_sender_api
.h"
#include "service_image
_api
.h"
static
void
conv_image_to_grpc
(
const
imagetool_image
*
element
,
std
::
unique_ptr
<
runtime
::
v1alpha2
::
Image
>
&
image
)
{
...
...
src/daemon/executor/container_cb/execution.c
浏览文件 @
058adb5b
...
...
@@ -43,15 +43,15 @@
#include "execution_stream.h"
#include "execution_create.h"
#include "io_handler.h"
#include "plugin.h"
#include "plugin
_api
.h"
#include "execution_network.h"
#include "runtime.h"
#include "runtime
_api
.h"
#include "specs_extend.h"
#include "utils.h"
#include "error.h"
#include "event
_sender
.h"
#include "specs.h"
#include "service_container.h"
#include "event
s_sender_api
.h"
#include "specs
_api
.h"
#include "service_container
_api
.h"
static
int
filter_by_label
(
const
container_t
*
cont
,
const
container_get_id_request
*
request
)
{
...
...
src/daemon/executor/container_cb/execution_create.c
浏览文件 @
058adb5b
...
...
@@ -32,20 +32,20 @@
#include "io_wrapper.h"
#include "isulad_config.h"
#include "config.h"
#include "specs.h"
#include "specs
_api
.h"
#include "verify.h"
#include "container_api.h"
#include "execution_network.h"
#include "runtime.h"
#include "plugin.h"
#include "runtime
_api
.h"
#include "plugin
_api
.h"
#include "image_api.h"
#include "utils.h"
#include "error.h"
#include "constants.h"
#include "namespace.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
#include "sysinfo.h"
#include "service_container.h"
#include "service_container
_api
.h"
static
int
runtime_check
(
const
char
*
name
,
bool
*
runtime_res
)
{
...
...
src/daemon/executor/container_cb/execution_extend.c
浏览文件 @
058adb5b
...
...
@@ -27,8 +27,8 @@
#include <sys/sysinfo.h>
#include "isula_libutils/log.h"
#include "event
_sender
.h"
#include "
collector
.h"
#include "event
s_sender_api
.h"
#include "
events_collector_api
.h"
#include "io_wrapper.h"
#include "isulad_config.h"
#include "config.h"
...
...
@@ -36,10 +36,10 @@
#include "verify.h"
#include "isula_libutils/container_inspect.h"
#include "container_api.h"
#include "service_container.h"
#include "service_container
_api
.h"
#include "sysinfo.h"
#include "specs.h"
#include "runtime.h"
#include "specs
_api
.h"
#include "runtime
_api
.h"
#include "filters.h"
#include "utils.h"
...
...
src/daemon/executor/container_cb/execution_information.c
浏览文件 @
058adb5b
...
...
@@ -37,11 +37,11 @@
#include "execution_information.h"
#include "sysinfo.h"
#include "runtime.h"
#include "runtime
_api
.h"
#include "list.h"
#include "utils.h"
#include "error.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
static
int
container_version_cb
(
const
container_version_request
*
request
,
container_version_response
**
response
)
{
...
...
@@ -928,11 +928,14 @@ static int dup_health_check_config(const container_config *src, container_inspec
dest
->
health_check
->
test
[
i
]
=
util_strdup_s
(
src
->
healthcheck
->
test
[
i
]);
dest
->
health_check
->
test_len
++
;
}
dest
->
health_check
->
interval
=
timeout_with_default
(
src
->
healthcheck
->
interval
,
DEFAULT_PROBE_INTERVAL
);
dest
->
health_check
->
start_period
=
timeout_with_default
(
src
->
healthcheck
->
start_period
,
DEFAULT_START_PERIOD
);
dest
->
health_check
->
timeout
=
timeout_with_default
(
src
->
healthcheck
->
timeout
,
DEFAULT_PROBE_TIMEOUT
);
dest
->
health_check
->
retries
=
src
->
healthcheck
->
retries
!=
0
?
src
->
healthcheck
->
retries
:
DEFAULT_PROBE_RETRIES
;
dest
->
health_check
->
interval
=
(
src
->
healthcheck
->
interval
==
0
)
?
DEFAULT_PROBE_INTERVAL
:
src
->
healthcheck
->
interval
;
dest
->
health_check
->
start_period
=
(
src
->
healthcheck
->
start_period
==
0
)
?
DEFAULT_START_PERIOD
:
src
->
healthcheck
->
start_period
;
dest
->
health_check
->
timeout
=
(
src
->
healthcheck
->
timeout
==
0
)
?
DEFAULT_PROBE_TIMEOUT
:
src
->
healthcheck
->
timeout
;
dest
->
health_check
->
retries
=
(
src
->
healthcheck
->
retries
!=
0
)
?
src
->
healthcheck
->
retries
:
DEFAULT_PROBE_RETRIES
;
dest
->
health_check
->
exit_on_unhealthy
=
src
->
healthcheck
->
exit_on_unhealthy
;
}
...
...
src/daemon/executor/container_cb/execution_stream.c
浏览文件 @
058adb5b
...
...
@@ -41,9 +41,9 @@
#include "error.h"
#include "isula_libutils/logger_json_file.h"
#include "constants.h"
#include "runtime.h"
#include "event
_sender
.h"
#include "service_container.h"
#include "runtime
_api
.h"
#include "event
s_sender_api
.h"
#include "service_container
_api
.h"
#include "io_handler.h"
struct
container_log_config
{
...
...
src/daemon/executor/container_cb/io_handler.c
浏览文件 @
058adb5b
...
...
@@ -41,9 +41,9 @@
#include "error.h"
#include "isula_libutils/logger_json_file.h"
#include "constants.h"
#include "runtime.h"
#include "event
_sender
.h"
#include "service_container.h"
#include "runtime
_api
.h"
#include "event
s_sender_api
.h"
#include "service_container
_api
.h"
static
char
*
create_single_fifo
(
const
char
*
statepath
,
const
char
*
subpath
,
const
char
*
stdflag
)
{
...
...
src/daemon/executor/image_cb/image_cb.c
浏览文件 @
058adb5b
...
...
@@ -33,8 +33,8 @@
#include "isulad_config.h"
#include "mediatype.h"
#include "filters.h"
#include "event
_sender
.h"
#include "service_image.h"
#include "event
s_sender_api
.h"
#include "service_image
_api
.h"
#ifdef ENABLE_OCI_IMAGE
#include "oci_common_operators.h"
#endif
...
...
src/daemon/modules/api/container_api.h
浏览文件 @
058adb5b
...
...
@@ -225,8 +225,6 @@ int dup_health_check_status(defs_health **dst, const defs_health *src);
void
update_health_monitor
(
const
char
*
container_id
);
int64_t
timeout_with_default
(
int64_t
configured_value
,
int64_t
default_value
);
extern
int
supervisor_add_exit_monitor
(
int
fd
,
const
container_pid_t
*
pid_info
,
const
char
*
name
,
const
char
*
runtime
);
extern
char
*
exit_fifo_create
(
const
char
*
cont_state_path
);
...
...
src/daemon/modules/
events_sender
/event_type.h
→
src/daemon/modules/
api
/event_type.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
events/collector
.h
→
src/daemon/modules/
api/events_collector_api
.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
events_sender/event_sender
.h
→
src/daemon/modules/
api/events_sender_api
.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
log/log_gather
.h
→
src/daemon/modules/
api/log_gather_api
.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
plugin/plugin
.h
→
src/daemon/modules/
api/plugin_api
.h
浏览文件 @
058adb5b
...
...
@@ -19,8 +19,8 @@
#include <pthread.h>
#include "map.h"
#include "specs
.h"
/* oci_runtime_spec */
#include "container_
unix.h"
/* container_t */
#include "specs
_api.h"
/* oci_runtime_spec */
#include "container_
api.h"
/* container_t */
/*
* returned int should means:
...
...
@@ -32,14 +32,14 @@
* comment.
*/
#define PLUGIN_INIT_SKIP
0
#define PLUGIN_INIT_WITH_CONTAINER_RUNNING
1
#define PLUGIN_INIT_WITH_CONTAINER_ALL
2
#define PLUGIN_INIT_SKIP 0
#define PLUGIN_INIT_WITH_CONTAINER_RUNNING 1
#define PLUGIN_INIT_WITH_CONTAINER_ALL 2
#define PLUGIN_EVENT_CONTAINER_PRE_CREATE
1UL
#define PLUGIN_EVENT_CONTAINER_PRE_START
(1UL << 1)
#define PLUGIN_EVENT_CONTAINER_POST_STOP
(1UL << 2)
#define PLUGIN_EVENT_CONTAINER_POST_REMOVE
(1UL << 3)
#define PLUGIN_EVENT_CONTAINER_PRE_CREATE 1UL
#define PLUGIN_EVENT_CONTAINER_PRE_START (1UL << 1)
#define PLUGIN_EVENT_CONTAINER_POST_STOP (1UL << 2)
#define PLUGIN_EVENT_CONTAINER_POST_REMOVE (1UL << 3)
typedef
struct
plugin_manifest
{
uint64_t
init_type
;
...
...
@@ -65,8 +65,8 @@ typedef struct plugin {
* more plugint_put() shall be called.
*/
plugin_t
*
plugin_new
(
const
char
*
name
,
const
char
*
addr
);
void
plugin_get
(
plugin_t
*
plugin
);
/* ref++ */
void
plugin_put
(
plugin_t
*
plugin
);
/* ref-- */
void
plugin_get
(
plugin_t
*
plugin
);
/* ref++ */
void
plugin_put
(
plugin_t
*
plugin
);
/* ref-- */
int
plugin_set_activated
(
plugin_t
*
plugin
,
bool
activated
,
const
char
*
errmsg
);
int
plugin_set_manifest
(
plugin_t
*
plugin
,
const
plugin_manifest_t
*
manifest
);
...
...
@@ -74,8 +74,8 @@ bool plugin_is_watching(plugin_t *plugin, uint64_t pe);
typedef
struct
plugin_manager
{
pthread_rwlock_t
pm_rwlock
;
map_t
*
np
;
/* name:plugin */
map_t
*
eps
;
/* watch_event:plugins */
map_t
*
np
;
/* name:plugin */
map_t
*
eps
;
/* watch_event:plugins */
}
plugin_manager_t
;
/*
...
...
@@ -112,4 +112,3 @@ int plugin_event_container_post_remove(const container_t *cont);
int
plugin_event_container_post_remove2
(
const
char
*
cid
,
const
oci_runtime_spec
*
oci
);
#endif
/* _PLUGIN_H_ */
src/daemon/modules/
runtime/runtime
.h
→
src/daemon/modules/
api/runtime_api
.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
service/service_container
.h
→
src/daemon/modules/
api/service_container_api
.h
浏览文件 @
058adb5b
...
...
@@ -14,9 +14,7 @@
******************************************************************************/
#ifndef __ISULAD_SERVICE_CONTAINER_OPERATOR_H
#define __ISULAD_SERVICE_CONTAINER_OPERATOR_H
#include <pthread.h>
#include <semaphore.h>
#include "container_unix.h"
#include "container_api.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -40,8 +38,6 @@ int set_container_to_removal(const container_t *cont);
int
delete_container
(
container_t
*
cont
,
bool
force
);
int
container_module_init
(
char
**
msg
);
#ifdef __cplusplus
}
#endif
...
...
src/daemon/modules/
service/service_image
.h
→
src/daemon/modules/
api/service_image_api
.h
浏览文件 @
058adb5b
文件已移动
src/daemon/modules/
spec/specs
.h
→
src/daemon/modules/
api/specs_api
.h
浏览文件 @
058adb5b
...
...
@@ -26,20 +26,17 @@
extern
"C"
{
#endif
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_oci_cgroups_path
(
const
char
*
id
,
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_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
merge_oci_cgroups_path
(
const
char
*
id
,
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
);
int
merge_global_config
(
oci_runtime_spec
*
oci_spec
);
oci_runtime_spec
*
load_oci_config
(
const
char
*
rootpath
,
const
char
*
name
);
oci_runtime_spec
*
default_spec
(
bool
system_container
);
int
merge_conf_cgroup
(
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
);
int
save_oci_config
(
const
char
*
id
,
const
char
*
rootpath
,
const
oci_runtime_spec
*
oci_spec
);
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
merge_share_namespace
(
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
);
#ifdef __cplusplus
...
...
@@ -47,4 +44,3 @@ int merge_share_namespace(oci_runtime_spec *oci_spec, const host_config *host_sp
#endif
#endif
src/daemon/modules/container/container_events_handler.c
浏览文件 @
058adb5b
...
...
@@ -27,8 +27,8 @@
#include "container_events_handler.h"
#include "utils.h"
#include "container_api.h"
#include "service_container.h"
#include "plugin.h"
#include "service_container
_api
.h"
#include "plugin
_api
.h"
#include "restartmanager.h"
#include "health_check.h"
...
...
src/daemon/modules/container/container_gc/containers_gc.c
浏览文件 @
058adb5b
...
...
@@ -23,9 +23,9 @@
#include "isula_libutils/container_garbage_config.h"
#include "isula_libutils/log.h"
#include "utils.h"
#include "service_container.h"
#include "service_container
_api
.h"
#include "container_api.h"
#include "runtime.h"
#include "runtime
_api
.h"
#include "restartmanager.h"
static
containers_gc_t
g_gc_containers
;
...
...
src/daemon/modules/container/health_check/health_check.c
浏览文件 @
058adb5b
...
...
@@ -26,10 +26,10 @@
#include "utils.h"
#include "health_check.h"
#include "callback.h"
#include "service_container.h"
#include "service_container
_api
.h"
#include "isula_libutils/container_exec_request.h"
#include "isula_libutils/container_exec_response.h"
#include "log_gather.h"
#include "log_gather
_api
.h"
#include "container_state.h"
/* container state lock */
...
...
@@ -147,15 +147,6 @@ void stop_health_checks(const char *container_id)
container_unref
(
cont
);
}
// If configuredValue is zero, use defaultValue instead.
int64_t
timeout_with_default
(
int64_t
configured_value
,
int64_t
default_value
)
{
if
(
configured_value
==
0
)
{
return
default_value
;
}
return
configured_value
;
}
/* health check manager free */
void
health_check_manager_free
(
health_check_manager_t
*
health_check
)
{
...
...
@@ -357,8 +348,9 @@ static int handle_unhealthy_case(container_t *cont, const defs_health_log_elemen
health_status
=
get_health_status
(
cont
->
state
);
if
(
strcmp
(
health_status
,
HEALTH_STARTING
)
==
0
)
{
int64_t
start_period
=
timeout_with_default
(
cont
->
common_config
->
config
->
healthcheck
->
start_period
,
DEFAULT_START_PERIOD
);
int64_t
start_period
=
(
cont
->
common_config
->
config
->
healthcheck
->
start_period
==
0
)
?
DEFAULT_START_PERIOD
:
cont
->
common_config
->
config
->
healthcheck
->
start_period
;
int64_t
first
,
last
;
if
(
to_unix_nanos_from_str
(
cont
->
state
->
state
->
started_at
,
&
first
))
{
ERROR
(
"Parse container started time failed: %s"
,
cont
->
state
->
state
->
started_at
);
...
...
@@ -557,7 +549,8 @@ void *health_check_run(void *arg)
container_req
->
attach_stdin
=
false
;
container_req
->
attach_stdout
=
true
;
container_req
->
attach_stderr
=
true
;
container_req
->
timeout
=
timeout_with_default
(
config
->
healthcheck
->
timeout
,
DEFAULT_PROBE_TIMEOUT
)
/
Time_Second
;
container_req
->
timeout
=
((
config
->
healthcheck
->
timeout
==
0
)
?
DEFAULT_PROBE_TIMEOUT
:
config
->
healthcheck
->
timeout
)
/
Time_Second
;
container_req
->
container_id
=
util_strdup_s
(
cont
->
common_config
->
id
);
container_req
->
argv
=
cmd_slice
;
container_req
->
argv_len
=
util_array_len
((
const
char
**
)
cmd_slice
);
...
...
@@ -704,7 +697,9 @@ static void *health_check_monitor(void *arg)
ERROR
(
"Failed to monitor start time stamp"
);
goto
out
;
}
probe_interval
=
timeout_with_default
(
cont
->
common_config
->
config
->
healthcheck
->
interval
,
DEFAULT_PROBE_INTERVAL
);
probe_interval
=
(
cont
->
common_config
->
config
->
healthcheck
->
interval
==
0
)
?
DEFAULT_PROBE_INTERVAL
:
cont
->
common_config
->
config
->
healthcheck
->
interval
;
set_monitor_idle_status
(
cont
->
health_check
);
while
(
true
)
{
switch
(
get_health_check_monitor_state
(
cont
->
health_check
))
{
...
...
src/daemon/modules/container/restart_manager/restartmanager.c
浏览文件 @
058adb5b
...
...
@@ -26,7 +26,8 @@
#include "isula_libutils/log.h"
#include "isulad_config.h"
#include "utils.h"
#include "service_container.h"
#include "service_container_api.h"
#include "container_unix.h"
#define backoffMultipulier 2U
// unit nanos
...
...
src/daemon/modules/container/restore/restore.c
浏览文件 @
058adb5b
...
...
@@ -28,8 +28,8 @@
#include "container_unix.h"
#include "error.h"
#include "image_api.h"
#include "runtime.h"
#include "service_container.h"
#include "runtime
_api
.h"
#include "service_container
_api
.h"
#include "restartmanager.h"
#include "health_check.h"
...
...
src/daemon/modules/container/supervisor/supervisor.c
浏览文件 @
058adb5b
...
...
@@ -22,9 +22,9 @@
#include "supervisor.h"
#include "mainloop.h"
#include "libisulad.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
#include "containers_gc.h"
#include "service_container.h"
#include "service_container
_api
.h"
pthread_mutex_t
g_supervisor_lock
=
PTHREAD_MUTEX_INITIALIZER
;
struct
epoll_descr
g_supervisor_descr
;
...
...
src/daemon/modules/events/collector.c
浏览文件 @
058adb5b
...
...
@@ -27,7 +27,7 @@
#include "error.h"
#include "isula_libutils/log.h"
#include "
collector
.h"
#include "
events_collector_api
.h"
#include "monitord.h"
#include "isulad_config.h"
#include "libisulad.h"
...
...
src/daemon/modules/events/monitord.c
浏览文件 @
058adb5b
...
...
@@ -27,9 +27,9 @@
#include "monitord.h"
#include "mainloop.h"
#include "isulad_config.h"
#include "
collector
.h"
#include "
events_collector_api
.h"
#include "utils.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
struct
monitord_handler
{
struct
epoll_descr
*
pdescr
;
...
...
src/daemon/modules/events_sender/event_sender.c
浏览文件 @
058adb5b
...
...
@@ -13,7 +13,7 @@
* Description: provide container collector definition
******************************************************************************/
#define _GNU_SOURCE
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -78,13 +78,12 @@ int isulad_monitor_send_container_event(const char *name, runtime_state_t state,
{
int
ret
=
0
;
struct
monitord_msg
msg
=
{
.
type
=
MONITORD_MSG_STATE
,
.
event_type
=
CONTAINER_EVENT
,
.
value
=
state
,
.
pid
=
-
1
,
.
exit_code
=
-
1
,
.
args
=
{
0x00
},
.
extra_annations
=
{
0x00
}
};
.
event_type
=
CONTAINER_EVENT
,
.
value
=
state
,
.
pid
=
-
1
,
.
exit_code
=
-
1
,
.
args
=
{
0x00
},
.
extra_annations
=
{
0x00
}
};
if
(
name
==
NULL
)
{
CRIT
(
"Invalid input arguments"
);
...
...
@@ -124,11 +123,10 @@ int isulad_monitor_send_image_event(const char *name, image_state_t state)
int
ret
=
0
;
struct
monitord_msg
msg
=
{
.
type
=
MONITORD_MSG_STATE
,
.
event_type
=
IMAGE_EVENT
,
.
value
=
state
,
.
args
=
{
0x00
},
.
extra_annations
=
{
0x00
}
};
.
event_type
=
IMAGE_EVENT
,
.
value
=
state
,
.
args
=
{
0x00
},
.
extra_annations
=
{
0x00
}
};
if
(
name
==
NULL
)
{
CRIT
(
"Invalid input arguments"
);
...
...
src/daemon/modules/log/log_gather.c
浏览文件 @
058adb5b
...
...
@@ -13,7 +13,7 @@
* Description: provide log gather functions
******************************************************************************/
#define _GNU_SOURCE
#include "log_gather.h"
#include "log_gather
_api
.h"
#include <unistd.h>
#include <string.h>
...
...
@@ -28,7 +28,7 @@
#include "utils.h"
#include "isulad_tar.h"
typedef
int
(
*
log_save_t
)(
const
void
*
buf
,
size_t
count
);
typedef
int
(
*
log_save_t
)(
const
void
*
buf
,
size_t
count
);
static
log_save_t
g_save_log_op
=
NULL
;
static
int
g_fifo_fd
=
-
1
;
...
...
@@ -407,4 +407,3 @@ err_out:
pexit:
return
NULL
;
}
src/daemon/modules/plugin/plugin.c
浏览文件 @
058adb5b
...
...
@@ -22,13 +22,13 @@
#include <sys/stat.h>
#include "isula_libutils/log.h"
#include "plugin.h"
#include "plugin
_api
.h"
#include "pspec.h"
#include "utils.h"
#include "parser.h"
#include "buffer.h"
#include "isulad_config.h"
#include "specs.h"
#include "specs
_api
.h"
#include "specs_extend.h"
#include "rest_common.h"
#include "container_api.h"
...
...
src/daemon/modules/plugin/pspec.c
浏览文件 @
058adb5b
...
...
@@ -17,7 +17,7 @@
#include "isula_libutils/log.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "isula_libutils/oci_runtime_pspec.h"
#include "plugin.h"
#include "plugin
_api
.h"
#include "pspec.h"
/*
...
...
@@ -26,12 +26,12 @@
*/
#define PTR_UPDATE(old, new, field, ffree) \
do { \
if ((new)->field == NULL) {
\
if ((new)->field == NULL) { \
break; \
} \
ffree((old)->field);
\
(old)->field = (new)->field;
\
(new)->field = NULL;
\
ffree((old)->field); \
(old)->field = (new)->field; \
(new)->field = NULL; \
} while (0)
/*
...
...
@@ -87,8 +87,7 @@ static oci_runtime_pspec *raw_get_pspec(oci_runtime_spec *oci)
PPR_UPDATE
(
pspec
,
oci
->
process
,
env
,
env_len
,
free
);
PPR_UPDATE
(
pspec
,
oci
->
linux
,
devices
,
devices_len
,
free_defs_device
);
PPR_UPDATE
(
pspec
->
resources
,
oci
->
linux
->
resources
,
devices
,
devices_len
,
free_defs_device_cgroup
);
PPR_UPDATE
(
pspec
->
resources
,
oci
->
linux
->
resources
,
devices
,
devices_len
,
free_defs_device_cgroup
);
return
pspec
;
}
...
...
@@ -113,8 +112,7 @@ static void raw_set_pspec(oci_runtime_spec *oci, oci_runtime_pspec *pspec)
PPR_UPDATE
(
oci
->
process
,
pspec
,
env
,
env_len
,
free
);
PPR_UPDATE
(
oci
->
linux
,
pspec
,
devices
,
devices_len
,
free_defs_device
);
PPR_UPDATE
(
oci
->
linux
->
resources
,
pspec
->
resources
,
devices
,
devices_len
,
free_defs_device_cgroup
);
PPR_UPDATE
(
oci
->
linux
->
resources
,
pspec
->
resources
,
devices
,
devices_len
,
free_defs_device_cgroup
);
}
char
*
get_pspec
(
oci_runtime_spec
*
oci
)
...
...
@@ -254,4 +252,3 @@ revert_free_old:
return
dst
;
}
src/daemon/modules/runtime/engines/engine.h
浏览文件 @
058adb5b
...
...
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "runtime.h"
#include "runtime
_api
.h"
#ifdef __cplusplus
extern
"C"
{
...
...
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
浏览文件 @
058adb5b
...
...
@@ -23,7 +23,7 @@
#include "error.h"
#include "isulad_config.h"
#include "libisulad.h"
#include "runtime.h"
#include "runtime
_api
.h"
bool
rt_lcr_detect
(
const
char
*
runtime
)
{
...
...
src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.h
浏览文件 @
058adb5b
...
...
@@ -16,7 +16,7 @@
#ifndef __RUNTIME_LCR_OPS_INTERFACE_H_
#define __RUNTIME_LCR_OPS_INTERFACE_H_
#include "runtime.h"
#include "runtime
_api
.h"
#ifdef __cplusplus
extern
"C"
{
...
...
src/daemon/modules/runtime/isula/isula_rt_ops.c
浏览文件 @
058adb5b
...
...
@@ -22,7 +22,7 @@
#include "isula_rt_ops.h"
#include "isula_libutils/log.h"
#include "error.h"
#include "runtime.h"
#include "runtime
_api
.h"
#include "constants.h"
#include "isula_libutils/shim_client_process_state.h"
#include "isula_libutils/shim_client_runtime_stats.h"
...
...
@@ -673,7 +673,7 @@ static int shim_create(bool fg, const char *id, const char *workdir, const char
_exit
(
EXIT_SUCCESS
);
}
realexec:
realexec:
/* real shim process. */
close
(
exec_fd
[
0
]);
if
(
setsid
()
<
0
)
{
...
...
@@ -685,7 +685,7 @@ realexec:
(
void
)
dprintf
(
exec_fd
[
1
],
"close inherited fds failed"
);
}
execvp
(
SHIM_BINARY
,
(
char
*
const
*
)
params
);
execvp
(
SHIM_BINARY
,
(
char
*
const
*
)
params
);
(
void
)
dprintf
(
exec_fd
[
1
],
"exec failed: %s"
,
strerror
(
errno
));
}
...
...
src/daemon/modules/runtime/isula/isula_rt_ops.h
浏览文件 @
058adb5b
...
...
@@ -16,7 +16,7 @@
#ifndef ISULA_RT_OPS_H
#define ISULA_RT_OPS_H
/* ISULA_RT_OPS_H */
#include "runtime.h"
#include "runtime
_api
.h"
#ifdef __cplusplus
extern
"C"
{
...
...
src/daemon/modules/runtime/runtime.c
浏览文件 @
058adb5b
...
...
@@ -21,7 +21,7 @@
#include <sys/utsname.h>
#include <ctype.h>
#include "runtime.h"
#include "runtime
_api
.h"
#include "engine.h"
#include "isulad_config.h"
#include "isula_libutils/log.h"
...
...
src/daemon/modules/service/service_container.c
浏览文件 @
058adb5b
...
...
@@ -13,7 +13,7 @@
* Description: provide container supervisor functions
******************************************************************************/
#define _GNU_SOURCE
#include "service_container.h"
#include "service_container
_api
.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
...
...
@@ -23,15 +23,15 @@
#include "utils.h"
#include "mainloop.h"
#include "libisulad.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
#include "image_api.h"
#include "specs.h"
#include "specs
_api
.h"
#include "isulad_config.h"
#include "verify.h"
#include "plugin.h"
#include "plugin
_api
.h"
#include "container_api.h"
#include "namespace.h"
#include "runtime.h"
#include "runtime
_api
.h"
int
set_container_to_removal
(
const
container_t
*
cont
)
{
...
...
src/daemon/modules/service/service_image.c
浏览文件 @
058adb5b
...
...
@@ -13,7 +13,7 @@
* Description: provide container supervisor functions
******************************************************************************/
#define _GNU_SOURCE
#include "service_image.h"
#include "service_image
_api
.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
...
...
@@ -23,7 +23,7 @@
#include "image_api.h"
#include "utils.h"
#include "container_api.h"
#include "event
_sender
.h"
#include "event
s_sender_api
.h"
static
bool
check_image_in_used
(
const
char
*
image_ref
)
{
...
...
src/daemon/modules/spec/specs.c
浏览文件 @
058adb5b
...
...
@@ -30,7 +30,7 @@
#include "error.h"
#include "isula_libutils/log.h"
#include "specs.h"
#include "specs
_api
.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "isula_libutils/oci_runtime_hooks.h"
#include "isula_libutils/docker_seccomp.h"
...
...
@@ -688,16 +688,16 @@ static int merge_hugetlbs(oci_runtime_spec *oci_spec, host_config_hugetlbs_eleme
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
));
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
;
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
);
util_strdup_s
(
hugetlbs
[
i
]
->
page_size
);
oci_spec
->
linux
->
resources
->
hugepage_limits_len
++
;
}
out:
...
...
src/daemon/modules/spec/specs_security.c
浏览文件 @
058adb5b
...
...
@@ -44,18 +44,17 @@
#include "libisulad.h"
#include "specs_extend.h"
#include "selinux_label.h"
#include "specs.h"
#include "specs
_api
.h"
#include "constants.h"
#define MAX_CAP_LEN 32
static
const
char
*
const
g_system_caps
[]
=
{
"SYS_BOOT"
,
"SETPCAP"
,
"NET_RAW"
,
"NET_BIND_SERVICE"
,
static
const
char
*
const
g_system_caps
[]
=
{
"SYS_BOOT"
,
"SETPCAP"
,
"NET_RAW"
,
"NET_BIND_SERVICE"
,
#ifdef CAP_AUDIT_WRITE
"AUDIT_WRITE"
,
"AUDIT_WRITE"
,
#endif
"DAC_OVERRIDE"
,
"SETFCAP"
,
"SETGID"
,
"SETUID"
,
"MKNOD"
,
"CHOWN"
,
"FOWNER"
,
"FSETID"
,
"KILL"
,
"SYS_CHROOT"
};
"DAC_OVERRIDE"
,
"SETFCAP"
,
"SETGID"
,
"SETUID"
,
"MKNOD"
,
"CHOWN"
,
"FOWNER"
,
"FSETID"
,
"KILL"
,
"SYS_CHROOT"
};
static
int
append_capability
(
char
***
dstcaps
,
size_t
*
dstcaps_len
,
const
char
*
cap
)
{
...
...
@@ -311,25 +310,24 @@ static char *seccomp_trans_arch_for_docker(const char *arch)
{
size_t
i
=
0
;
char
*
arch_map
[][
2
]
=
{
{
"SCMP_ARCH_X86"
,
"x86"
},
{
"SCMP_ARCH_X86_64"
,
"amd64"
},
{
"SCMP_ARCH_X32"
,
"x32"
},
{
"SCMP_ARCH_ARM"
,
"arm"
},
{
"SCMP_ARCH_AARCH64"
,
"arm64"
},
{
"SCMP_ARCH_MIPS"
,
"mips"
},
{
"SCMP_ARCH_MIPS64"
,
"mips64"
},
{
"SCMP_ARCH_MIPS64N32"
,
"mips64n32"
},
{
"SCMP_ARCH_MIPSEL"
,
"mipsel"
},
{
"SCMP_ARCH_MIPSEL64"
,
"mipsel64"
},
{
"SCMP_ARCH_MIPSEL64N32"
,
"mipsel64n32"
},
{
"SCMP_ARCH_PPC"
,
"ppc"
},
{
"SCMP_ARCH_PPC64"
,
"ppc64"
},
{
"SCMP_ARCH_PPC64LE"
,
"ppc64le"
},
{
"SCMP_ARCH_S390"
,
"s390"
},
{
"SCMP_ARCH_S390X"
,
"s390x"
},
{
"SCMP_ARCH_PARISC"
,
"parisc"
},
{
"SCMP_ARCH_PARISC64"
,
"parisc64"
},
{
"SCMP_ARCH_ALL"
,
"all"
}
};
{
"SCMP_ARCH_X86_64"
,
"amd64"
},
{
"SCMP_ARCH_X32"
,
"x32"
},
{
"SCMP_ARCH_ARM"
,
"arm"
},
{
"SCMP_ARCH_AARCH64"
,
"arm64"
},
{
"SCMP_ARCH_MIPS"
,
"mips"
},
{
"SCMP_ARCH_MIPS64"
,
"mips64"
},
{
"SCMP_ARCH_MIPS64N32"
,
"mips64n32"
},
{
"SCMP_ARCH_MIPSEL"
,
"mipsel"
},
{
"SCMP_ARCH_MIPSEL64"
,
"mipsel64"
},
{
"SCMP_ARCH_MIPSEL64N32"
,
"mipsel64n32"
},
{
"SCMP_ARCH_PPC"
,
"ppc"
},
{
"SCMP_ARCH_PPC64"
,
"ppc64"
},
{
"SCMP_ARCH_PPC64LE"
,
"ppc64le"
},
{
"SCMP_ARCH_S390"
,
"s390"
},
{
"SCMP_ARCH_S390X"
,
"s390x"
},
{
"SCMP_ARCH_PARISC"
,
"parisc"
},
{
"SCMP_ARCH_PARISC64"
,
"parisc64"
},
{
"SCMP_ARCH_ALL"
,
"all"
}
};
for
(
i
=
0
;
i
<
sizeof
(
arch_map
)
/
sizeof
(
arch_map
[
0
]);
i
++
)
{
if
(
strcmp
(
arch
,
arch_map
[
i
][
0
])
==
0
)
{
return
util_strdup_s
(
arch_map
[
i
][
1
]);
...
...
@@ -493,10 +491,10 @@ static int dup_architectures_to_oci_spec(const docker_seccomp *docker_seccomp_sp
}
for
(
i
=
0
;
i
<
docker_seccomp_spec
->
arch_map_len
;
i
++
)
{
oci_seccomp_spec
->
architectures
[
oci_seccomp_spec
->
architectures_len
++
]
=
util_strdup_s
(
docker_seccomp_spec
->
arch_map
[
i
]
->
architecture
);
util_strdup_s
(
docker_seccomp_spec
->
arch_map
[
i
]
->
architecture
);
for
(
j
=
0
;
j
<
docker_seccomp_spec
->
arch_map
[
i
]
->
sub_architectures_len
;
j
++
)
{
oci_seccomp_spec
->
architectures
[
oci_seccomp_spec
->
architectures_len
++
]
=
util_strdup_s
(
docker_seccomp_spec
->
arch_map
[
i
]
->
sub_architectures
[
j
]);
util_strdup_s
(
docker_seccomp_spec
->
arch_map
[
i
]
->
sub_architectures
[
j
]);
}
}
}
...
...
@@ -574,7 +572,7 @@ static int dup_syscall_to_oci_spec(const docker_seccomp *docker_seccomp_spec,
}
oci_seccomp_spec
->
syscalls
[
k
]
->
names
=
util_common_calloc_s
(
docker_seccomp_spec
->
syscalls
[
i
]
->
names_len
*
sizeof
(
char
*
));
util_common_calloc_s
(
docker_seccomp_spec
->
syscalls
[
i
]
->
names_len
*
sizeof
(
char
*
));
if
(
oci_seccomp_spec
->
syscalls
[
k
]
->
names
==
NULL
)
{
return
-
1
;
}
...
...
@@ -961,8 +959,7 @@ int adapt_settings_for_system_container(oci_runtime_spec *oci_spec, const host_c
{
int
ret
=
0
;
char
*
unblocked_systemcall_for_system_container
[]
=
{
"mount"
,
"umount2"
,
"reboot"
,
"name_to_handle_at"
,
"unshare"
};
"unshare"
};
char
**
adds
=
NULL
;
size_t
adds_len
=
0
;
bool
no_new_privileges
=
false
;
...
...
@@ -1005,11 +1002,11 @@ int adapt_settings_for_system_container(oci_runtime_spec *oci_spec, const host_c
}
ret
=
append_systemcall_to_seccomp
(
oci_spec
->
linux
->
seccomp
,
make_seccomp_syscalls_element
((
const
char
**
)
unblocked_systemcall_for_system_container
,
sizeof
(
unblocked_systemcall_for_system_container
)
/
sizeof
(
unblocked_systemcall_for_system_container
[
0
]),
"SCMP_ACT_ALLOW"
,
0
,
NULL
));
oci_spec
->
linux
->
seccomp
,
make_seccomp_syscalls_element
((
const
char
**
)
unblocked_systemcall_for_system_container
,
sizeof
(
unblocked_systemcall_for_system_container
)
/
sizeof
(
unblocked_systemcall_for_system_container
[
0
]),
"SCMP_ACT_ALLOW"
,
0
,
NULL
));
if
(
ret
!=
0
)
{
ERROR
(
"Failed to append systemcall to seccomp file"
);
ret
=
-
1
;
...
...
src/daemon/modules/spec/verify.c
浏览文件 @
058adb5b
...
...
@@ -30,7 +30,7 @@
#include "libisulad.h"
#include "isula_libutils/log.h"
#include "sysinfo.h"
#include "specs.h"
#include "specs
_api
.h"
#include "verify.h"
#include "isulad_config.h"
#include "selinux_label.h"
...
...
test/image/oci/oci_config_merge/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -38,6 +38,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/common
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/utils/cutils/map
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/daemon/modules/runtime/engines
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/daemon/modules/spec/
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../src/daemon/modules/container/
...
...
test/image/oci/storage/layers/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -40,6 +40,7 @@ target_include_directories(${DRIVER_EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/utils/sha256
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/utils/console
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/image
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/image/oci/storage
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver
...
...
test/mocks/collector_mock.h
浏览文件 @
058adb5b
...
...
@@ -17,7 +17,7 @@
#define COLLECTOR_MOCK_H_
#include <gmock/gmock.h>
#include "
collector
.h"
#include "
events_collector_api
.h"
class
MockCollector
{
public:
...
...
@@ -29,6 +29,6 @@ public:
const
char
*
args
,
const
char
*
extra_annations
));
};
void
MockCollector_SetMock
(
MockCollector
*
mock
);
void
MockCollector_SetMock
(
MockCollector
*
mock
);
#endif
test/mocks/container_operator_mock.h
浏览文件 @
058adb5b
...
...
@@ -17,7 +17,7 @@
#define CONTAINERS_OPERATOR_MOCK_H_
#include <gmock/gmock.h>
#include "service_container.h"
#include "service_container
_api
.h"
class
MockContainersOperator
{
public:
...
...
test/mocks/runtime_mock.h
浏览文件 @
058adb5b
...
...
@@ -17,7 +17,7 @@
#define RUNTIME_MOCK_H_
#include <gmock/gmock.h>
#include "runtime.h"
#include "runtime
_api
.h"
class
MockRuntime
{
public:
...
...
test/mocks/specs_mock.h
浏览文件 @
058adb5b
...
...
@@ -17,15 +17,15 @@
#define SPECS_MOCK_H_
#include <gmock/gmock.h>
#include "specs.h"
#include "specs
_api
.h"
class
MockSpecs
{
public:
MOCK_METHOD2
(
LoadOciConfig
,
oci_runtime_spec
*
(
const
char
*
rootpath
,
const
char
*
name
));
MOCK_METHOD2
(
LoadOciConfig
,
oci_runtime_spec
*
(
const
char
*
rootpath
,
const
char
*
name
));
MOCK_METHOD2
(
MergeConfCgroup
,
int
(
oci_runtime_spec
*
oci_spec
,
const
host_config
*
host_spec
));
MOCK_METHOD3
(
SaveOciConfig
,
int
(
const
char
*
id
,
const
char
*
rootpath
,
const
oci_runtime_spec
*
oci_spec
));
};
void
MockSpecs_SetMock
(
MockSpecs
*
mock
);
void
MockSpecs_SetMock
(
MockSpecs
*
mock
);
#endif
test/runtime/isula/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -34,6 +34,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/utils/cutils
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/common
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/utils/cutils/map
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/services/execution/manager
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/events
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/runtime
...
...
test/runtime/lcr/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -35,6 +35,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/common
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/utils/cutils/map
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container/restart_manager
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container/health_check
...
...
test/services/execution/execute/execution_extend/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -57,6 +57,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/utils/console
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/utils/cutils
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/image
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/service
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../../../src/daemon/modules/container
...
...
test/specs/specs/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -42,6 +42,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/utils/cutils/map
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/cmd/isulad
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/runtime
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container/restart_manager
...
...
test/specs/specs/specs_ut.cpp
浏览文件 @
058adb5b
...
...
@@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include "mock.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "specs.h"
#include "specs
_api
.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "oci_ut_common.h"
...
...
@@ -69,7 +69,7 @@ TEST(merge_conf_cgroup_ut, test_merge_conf_cgroup_2)
oci_runtime_spec
*
oci_spec
=
NULL
;
// Parameter host_spec is NULL
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_NE
(
merge_conf_cgroup
(
oci_spec
,
NULL
),
0
);
free_oci_runtime_spec
(
oci_spec
);
...
...
@@ -113,7 +113,7 @@ TEST(merge_conf_cgroup_ut, test_merge_conf_cgroup)
free
(
host_config_file
);
host_config_file
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_EQ
(
merge_conf_cgroup
(
oci_spec
,
host_spec
),
0
);
...
...
@@ -245,10 +245,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_2)
oci_runtime_spec
*
oci_spec
=
nullptr
;
host_config
*
host_spec
=
nullptr
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
ASSERT_TRUE
(
host_spec
!=
NULL
);
EXPECT_CALL
(
m_isulad_conf
,
GetCgroupParent
()).
WillRepeatedly
(
Invoke
(
invoke_conf_get_isulad_cgroup_parent_null
));
...
...
@@ -268,10 +268,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_3)
oci_runtime_spec
*
oci_spec
=
nullptr
;
host_config
*
host_spec
=
nullptr
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
ASSERT_TRUE
(
host_spec
!=
NULL
);
host_spec
->
cgroup_parent
=
util_strdup_s
(
"/test"
);
...
...
@@ -293,10 +293,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_4)
oci_runtime_spec
*
oci_spec
=
nullptr
;
host_config
*
host_spec
=
nullptr
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
ASSERT_TRUE
(
host_spec
!=
NULL
);
EXPECT_CALL
(
m_isulad_conf
,
GetCgroupParent
()).
WillRepeatedly
(
Invoke
(
invoke_conf_get_isulad_cgroup_parent
));
...
...
@@ -316,10 +316,10 @@ TEST_F(SpecsUnitTest, test_merge_oci_cgroups_path_5)
oci_runtime_spec
*
oci_spec
=
nullptr
;
host_config
*
host_spec
=
nullptr
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
host_spec
=
(
host_config
*
)
util_common_calloc_s
(
sizeof
(
host_config
));
ASSERT_TRUE
(
host_spec
!=
NULL
);
host_spec
->
cgroup_parent
=
util_strdup_s
(
"/test"
);
...
...
test/specs/specs_extend/CMakeLists.txt
浏览文件 @
058adb5b
...
...
@@ -42,6 +42,7 @@ target_include_directories(${EXE} PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/utils/cutils/map
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/cmd/isulad
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/api
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container/restart_manager
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../src/daemon/modules/container/health_check
...
...
test/specs/specs_extend/specs_extend_ut.cpp
浏览文件 @
058adb5b
...
...
@@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include "mock.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "specs.h"
#include "specs
_api
.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/container_config.h"
#include "oci_ut_common.h"
...
...
@@ -47,7 +47,7 @@ using namespace std;
TEST
(
make_sure_oci_spec_linux_ut
,
test_make_sure_oci_spec_linux
)
{
oci_runtime_spec
*
oci_spec
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_EQ
(
make_sure_oci_spec_linux
(
oci_spec
),
0
);
ASSERT_TRUE
(
oci_spec
->
linux
!=
NULL
);
...
...
@@ -58,7 +58,7 @@ TEST(make_sure_oci_spec_linux_ut, test_make_sure_oci_spec_linux)
TEST
(
make_sure_oci_spec_process_ut
,
test_make_sure_oci_spec_process
)
{
oci_runtime_spec
*
oci_spec
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_EQ
(
make_sure_oci_spec_process
(
oci_spec
),
0
);
ASSERT_TRUE
(
oci_spec
->
process
!=
NULL
);
...
...
@@ -69,7 +69,7 @@ TEST(make_sure_oci_spec_process_ut, test_make_sure_oci_spec_process)
TEST
(
make_sure_oci_spec_linux_resources_ut
,
test_make_sure_oci_spec_linux_resources
)
{
oci_runtime_spec
*
oci_spec
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_EQ
(
make_sure_oci_spec_linux_resources
(
oci_spec
),
0
);
ASSERT_TRUE
(
oci_spec
->
linux
!=
NULL
);
...
...
@@ -81,7 +81,7 @@ TEST(make_sure_oci_spec_linux_resources_ut, test_make_sure_oci_spec_linux_resour
TEST
(
make_sure_oci_spec_linux_resources_blkio_ut
,
test_make_sure_oci_spec_linux_resources_blkio
)
{
oci_runtime_spec
*
oci_spec
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
ASSERT_EQ
(
make_sure_oci_spec_linux_resources_blkio
(
oci_spec
),
0
);
ASSERT_TRUE
(
oci_spec
->
linux
!=
NULL
);
...
...
@@ -100,9 +100,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_2)
{
oci_runtime_spec
*
oci_spec
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
ASSERT_NE
(
merge_hooks
(
oci_spec
->
hooks
,
NULL
),
0
);
free_oci_runtime_spec
(
oci_spec
);
oci_spec
=
NULL
;
...
...
@@ -144,9 +144,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_4)
free
(
hooks_config_file
);
hooks_config_file
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
ASSERT_EQ
(
merge_hooks
(
oci_spec
->
hooks
,
hooks_spec
),
0
);
...
...
@@ -172,9 +172,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_prestart)
free
(
hooks_config_file
);
hooks_config_file
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
ASSERT_EQ
(
merge_hooks
(
oci_spec
->
hooks
,
hooks_spec
),
0
);
ASSERT_EQ
(
oci_spec
->
hooks
->
prestart_len
,
1
);
...
...
@@ -210,9 +210,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_poststart)
free
(
hooks_config_file
);
hooks_config_file
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
ASSERT_EQ
(
merge_hooks
(
oci_spec
->
hooks
,
hooks_spec
),
0
);
ASSERT_EQ
(
oci_spec
->
hooks
->
poststart_len
,
2
);
...
...
@@ -257,9 +257,9 @@ TEST(merge_hooks_ut, test_merge_hooks_ut_poststop)
free
(
hooks_config_file
);
hooks_config_file
=
NULL
;
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
oci_spec
=
(
oci_runtime_spec
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec
));
ASSERT_TRUE
(
oci_spec
!=
NULL
);
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
oci_spec
->
hooks
=
(
oci_runtime_spec_hooks
*
)
util_common_calloc_s
(
sizeof
(
oci_runtime_spec_hooks
));
ASSERT_EQ
(
merge_hooks
(
oci_spec
->
hooks
,
hooks_spec
),
0
);
ASSERT_EQ
(
oci_spec
->
hooks
->
poststop_len
,
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录