Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
5dbf3ebe
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,发现更多精彩内容 >>
提交
5dbf3ebe
编写于
6月 22, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: move lcr engines to runtime directory
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
14eddc4c
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
203 addition
and
260 deletion
+203
-260
src/cmd/isulad/main.c
src/cmd/isulad/main.c
+1
-1
src/daemon/CMakeLists.txt
src/daemon/CMakeLists.txt
+3
-3
src/daemon/callback/container_cb/execution.c
src/daemon/callback/container_cb/execution.c
+34
-45
src/daemon/callback/container_cb/execution_create.c
src/daemon/callback/container_cb/execution_create.c
+0
-1
src/daemon/callback/container_cb/execution_extend.c
src/daemon/callback/container_cb/execution_extend.c
+0
-1
src/daemon/callback/container_cb/execution_information.c
src/daemon/callback/container_cb/execution_information.c
+0
-1
src/daemon/callback/container_cb/execution_stream.c
src/daemon/callback/container_cb/execution_stream.c
+1
-3
src/daemon/callback/image_cb/image_cb.c
src/daemon/callback/image_cb/image_cb.c
+0
-1
src/daemon/container/container_state.h
src/daemon/container/container_state.h
+1
-3
src/daemon/container/container_unix.c
src/daemon/container/container_unix.c
+0
-34
src/daemon/container/container_unix.h
src/daemon/container/container_unix.h
+0
-3
src/daemon/container/monitord.h
src/daemon/container/monitord.h
+0
-1
src/daemon/container/restartmanager.h
src/daemon/container/restartmanager.h
+0
-3
src/daemon/container/restore.h
src/daemon/container/restore.h
+0
-3
src/daemon/engines/CMakeLists.txt
src/daemon/engines/CMakeLists.txt
+0
-3
src/daemon/engines/engine.c
src/daemon/engines/engine.c
+2
-3
src/daemon/engines/engine.h
src/daemon/engines/engine.h
+25
-34
src/daemon/engines/lcr/CMakeLists.txt
src/daemon/engines/lcr/CMakeLists.txt
+0
-7
src/daemon/libisulad.c
src/daemon/libisulad.c
+33
-1
src/daemon/libisulad.h
src/daemon/libisulad.h
+8
-0
src/daemon/runtime/CMakeLists.txt
src/daemon/runtime/CMakeLists.txt
+1
-1
src/daemon/runtime/isula/isula_rt_ops.c
src/daemon/runtime/isula/isula_rt_ops.c
+57
-74
src/daemon/runtime/lcr/CMakeLists.txt
src/daemon/runtime/lcr/CMakeLists.txt
+15
-2
src/daemon/runtime/lcr/lcr_engine.c
src/daemon/runtime/lcr/lcr_engine.c
+0
-0
src/daemon/runtime/lcr/lcr_engine.h
src/daemon/runtime/lcr/lcr_engine.h
+0
-1
src/daemon/runtime/lcr/lcr_rt_ops.c
src/daemon/runtime/lcr/lcr_rt_ops.c
+17
-23
src/daemon/runtime/runtime.h
src/daemon/runtime/runtime.h
+5
-8
未找到文件。
src/cmd/isulad/main.c
浏览文件 @
5dbf3ebe
...
...
@@ -42,7 +42,6 @@
#include "collector.h"
#include "isulad_commands.h"
#include "isula_libutils/log.h"
#include "engine.h"
#include "utils.h"
#include "isulad_config.h"
#include "image.h"
...
...
@@ -59,6 +58,7 @@
#include "plugin.h"
#include "selinux_label.h"
#include "http.h"
#include "engine.h"
#ifdef GRPC_CONNECTOR
#include "clibcni/api.h"
...
...
src/daemon/CMakeLists.txt
浏览文件 @
5dbf3ebe
# get current directory sources files
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
daemon_top_srcs
)
add_subdirectory
(
engines
)
add_subdirectory
(
runtime
)
add_subdirectory
(
image
)
add_subdirectory
(
plugin
)
...
...
@@ -11,10 +10,10 @@ add_subdirectory(container)
add_subdirectory
(
connect
)
add_subdirectory
(
log
)
add_subdirectory
(
events
)
add_subdirectory
(
engines
)
set
(
local_daemon_srcs
${
daemon_top_srcs
}
${
ENGINES_SRCS
}
${
RUNTIME_SRCS
}
${
IMAGE_SRCS
}
${
PLUGIN_SRCS
}
...
...
@@ -24,11 +23,11 @@ set(local_daemon_srcs
${
SERVER_CONNECT_SRCS
}
${
LOG_GATHER_SRCS
}
${
EVENTS_SRCS
}
${
ENGINES_SRCS
}
)
set
(
local_daemon_incs
${
CMAKE_CURRENT_SOURCE_DIR
}
${
ENGINES_INCS
}
${
RUNTIME_INCS
}
${
IMAGE_INCS
}
${
PLUGIN_INCS
}
...
...
@@ -38,6 +37,7 @@ set(local_daemon_incs
${
SERVER_CONNECT_INCS
}
${
LOG_GATHER_INCS
}
${
EVENTS_INCS
}
${
ENGINES_INCS
}
)
if
(
GRPC_CONNECTOR
)
...
...
src/daemon/callback/container_cb/execution.c
浏览文件 @
5dbf3ebe
...
...
@@ -30,7 +30,6 @@
#include "constants.h"
#include "isula_libutils/log.h"
#include "engine.h"
#include "console.h"
#include "isulad_config.h"
#include "config.h"
...
...
@@ -55,7 +54,6 @@
#include "collector.h"
#include "specs.h"
static
int
filter_by_label
(
const
container_t
*
cont
,
const
container_get_id_request
*
request
)
{
int
ret
=
0
;
...
...
@@ -68,7 +66,7 @@ static int filter_by_label(const container_t *cont, const container_get_id_reque
goto
out
;
}
if
(
cont
->
common_config
->
config
==
NULL
||
cont
->
common_config
->
config
->
labels
==
NULL
||
\
if
(
cont
->
common_config
->
config
==
NULL
||
cont
->
common_config
->
config
->
labels
==
NULL
||
cont
->
common_config
->
config
->
labels
->
len
==
0
)
{
ERROR
(
"No such container: %s"
,
request
->
id_or_name
);
isulad_set_error_message
(
"No such container: %s"
,
request
->
id_or_name
);
...
...
@@ -86,7 +84,7 @@ static int filter_by_label(const container_t *cont, const container_get_id_reque
len_val
=
(
strlen
(
request
->
label
)
-
len_key
)
-
1
;
labels
=
cont
->
common_config
->
config
->
labels
;
for
(
i
=
0
;
i
<
labels
->
len
;
i
++
)
{
if
(
strlen
(
labels
->
keys
[
i
])
==
len_key
&&
strncmp
(
labels
->
keys
[
i
],
request
->
label
,
len_key
)
==
0
&&
\
if
(
strlen
(
labels
->
keys
[
i
])
==
len_key
&&
strncmp
(
labels
->
keys
[
i
],
request
->
label
,
len_key
)
==
0
&&
strlen
(
labels
->
values
[
i
])
==
len_val
&&
strncmp
(
labels
->
values
[
i
],
p_equal
+
1
,
len_val
)
==
0
)
{
ret
=
0
;
goto
out
;
...
...
@@ -479,15 +477,13 @@ static int mount_host_channel(const host_config_host_channel *host_channel, cons
if
(
util_detect_mounted
(
host_channel
->
path_on_host
))
{
return
0
;
}
int
nret
=
snprintf
(
properties
,
sizeof
(
properties
),
"mode=1777,size=%llu"
,
(
long
long
unsigned
int
)
host_channel
->
size
);
int
nret
=
snprintf
(
properties
,
sizeof
(
properties
),
"mode=1777,size=%llu"
,
(
long
long
unsigned
int
)
host_channel
->
size
);
if
(
nret
<
0
||
(
size_t
)
nret
>=
sizeof
(
properties
))
{
ERROR
(
"Failed to generate mount properties"
);
return
-
1
;
}
if
(
mount
(
"tmpfs"
,
host_channel
->
path_on_host
,
"tmpfs"
,
MS_NOEXEC
|
MS_NOSUID
|
MS_NODEV
,
(
void
*
)
properties
))
{
if
(
mount
(
"tmpfs"
,
host_channel
->
path_on_host
,
"tmpfs"
,
MS_NOEXEC
|
MS_NOSUID
|
MS_NODEV
,
(
void
*
)
properties
))
{
ERROR
(
"Failed to mount host path '%s'"
,
host_channel
->
path_on_host
);
return
-
1
;
}
...
...
@@ -712,15 +708,13 @@ static int write_env_to_target_file(const container_t *cont, const oci_runtime_s
ERROR
(
"Failed to get env target file path: %s"
,
cont
->
hostconfig
->
env_target_file
);
return
-
1
;
}
ret
=
write_env_content
(
env_path
,
(
const
char
**
)
oci_spec
->
process
->
env
,
oci_spec
->
process
->
env_len
);
ret
=
write_env_content
(
env_path
,
(
const
char
**
)
oci_spec
->
process
->
env
,
oci_spec
->
process
->
env_len
);
free
(
env_path
);
return
ret
;
}
static
int
do_post_start_on_success
(
const
char
*
id
,
const
char
*
runtime
,
const
c
har
*
pidfile
,
int
exit_fifo_fd
,
const
c
ontainer_pid_t
*
pid_info
)
static
int
do_post_start_on_success
(
const
char
*
id
,
const
char
*
runtime
,
const
char
*
pidfile
,
int
exit_fifo_fd
,
const
container_pid_t
*
pid_info
)
{
int
ret
=
0
;
...
...
@@ -846,8 +840,7 @@ out:
return
ret
;
}
static
int
do_start_container
(
container_t
*
cont
,
const
char
*
console_fifos
[],
bool
reset_rm
,
container_pid_t
*
pid_info
)
static
int
do_start_container
(
container_t
*
cont
,
const
char
*
console_fifos
[],
bool
reset_rm
,
container_pid_t
*
pid_info
)
{
int
ret
=
0
;
int
nret
=
0
;
...
...
@@ -1071,7 +1064,8 @@ int start_container(container_t *cont, const char *console_fifos[], bool reset_r
}
if
(
gc_is_gc_progress
(
cont
->
common_config
->
id
))
{
isulad_set_error_message
(
"You cannot start container %s in garbage collector progress."
,
cont
->
common_config
->
id
);
isulad_set_error_message
(
"You cannot start container %s in garbage collector progress."
,
cont
->
common_config
->
id
);
ERROR
(
"You cannot start container %s in garbage collector progress."
,
cont
->
common_config
->
id
);
ret
=
-
1
;
goto
out
;
...
...
@@ -1109,8 +1103,8 @@ out:
return
ret
;
}
static
int
prepare_start_io
(
container_t
*
cont
,
const
container_start_request
*
request
,
char
**
fifopath
,
char
*
fifos
[],
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
static
int
prepare_start_io
(
container_t
*
cont
,
const
container_start_request
*
request
,
char
**
fifopath
,
char
*
fifos
[],
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
struct
io_write_wrapper
*
stderr_handler
)
{
int
ret
=
0
;
...
...
@@ -1126,8 +1120,8 @@ static int prepare_start_io(container_t *cont, const container_start_request *re
goto
out
;
}
if
(
ready_copy_io_data
(
-
1
,
true
,
request
->
stdin
,
request
->
stdout
,
request
->
stderr
,
std
infd
,
stdout_handler
,
std
err_handler
,
(
const
char
**
)
fifos
,
&
tid
))
{
if
(
ready_copy_io_data
(
-
1
,
true
,
request
->
stdin
,
request
->
stdout
,
request
->
stderr
,
stdinfd
,
stdout_handler
,
stderr_handler
,
(
const
char
**
)
fifos
,
&
tid
))
{
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1153,9 +1147,8 @@ static void pack_start_response(container_start_response *response, uint32_t cc,
}
}
static
int
container_start_prepare
(
container_t
*
cont
,
const
container_start_request
*
request
,
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
struct
io_write_wrapper
*
stderr_handler
,
static
int
container_start_prepare
(
container_t
*
cont
,
const
container_start_request
*
request
,
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
struct
io_write_wrapper
*
stderr_handler
,
char
**
fifopath
,
char
*
fifos
[])
{
const
char
*
id
=
cont
->
common_config
->
id
;
...
...
@@ -1173,9 +1166,8 @@ static int container_start_prepare(container_t *cont, const container_start_requ
return
0
;
}
static
int
container_start_cb
(
const
container_start_request
*
request
,
container_start_response
**
response
,
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
struct
io_write_wrapper
*
stderr_handler
)
static
int
container_start_cb
(
const
container_start_request
*
request
,
container_start_response
**
response
,
int
stdinfd
,
struct
io_write_wrapper
*
stdout_handler
,
struct
io_write_wrapper
*
stderr_handler
)
{
uint32_t
cc
=
ISULAD_SUCCESS
;
char
*
id
=
NULL
;
...
...
@@ -1258,7 +1250,7 @@ static int kill_with_signal(container_t *cont, uint32_t signal)
const
char
*
id
=
cont
->
common_config
->
id
;
bool
need_unpause
=
is_paused
(
cont
->
state
);
rt_resume_params_t
params
=
{
0
};
char
annotations
[
EXTRA_ANNOTATION_MAX
]
=
{
0
};
char
annotations
[
EXTRA_ANNOTATION_MAX
]
=
{
0
};
if
(
container_exit_on_next
(
cont
))
{
ERROR
(
"Failed to cancel restart manager"
);
...
...
@@ -1367,8 +1359,7 @@ int stop_container(container_t *cont, int timeout, bool force, bool restart)
}
ret
=
container_wait_stop
(
cont
,
timeout
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to wait Container(%s) 'STOPPED' for %d seconds, force killing"
,
id
,
timeout
);
ERROR
(
"Failed to wait Container(%s) 'STOPPED' for %d seconds, force killing"
,
id
,
timeout
);
ret
=
force_kill
(
cont
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to force kill container %s"
,
id
);
...
...
@@ -1498,8 +1489,7 @@ static uint32_t do_restart_container(container_t *cont, int timeout)
return
ISULAD_SUCCESS
;
}
static
int
container_restart_cb
(
const
container_restart_request
*
request
,
container_restart_response
**
response
)
static
int
container_restart_cb
(
const
container_restart_request
*
request
,
container_restart_response
**
response
)
{
int
timeout
=
0
;
uint32_t
cc
=
ISULAD_SUCCESS
;
...
...
@@ -1582,8 +1572,7 @@ static void pack_stop_response(container_stop_response *response, uint32_t cc, c
}
}
static
int
container_stop_cb
(
const
container_stop_request
*
request
,
container_stop_response
**
response
)
static
int
container_stop_cb
(
const
container_stop_request
*
request
,
container_stop_response
**
response
)
{
int
timeout
=
0
;
bool
force
=
false
;
...
...
@@ -1705,8 +1694,7 @@ static void pack_kill_response(container_kill_response *response, uint32_t cc, c
}
}
static
int
container_kill_cb
(
const
container_kill_request
*
request
,
container_kill_response
**
response
)
static
int
container_kill_cb
(
const
container_kill_request
*
request
,
container_kill_response
**
response
)
{
int
ret
=
0
;
char
*
name
=
NULL
;
...
...
@@ -1765,7 +1753,6 @@ static int container_kill_cb(const container_kill_request *request,
EVENT
(
"Event: {Object: %s, Type: Killing, Signal:%u}"
,
id
,
signal
);
if
(
gc_is_gc_progress
(
id
))
{
isulad_set_error_message
(
"You cannot kill container %s in garbage collector progress."
,
id
);
ERROR
(
"You cannot kill container %s in garbage collector progress."
,
id
);
...
...
@@ -1822,7 +1809,7 @@ int umount_residual_shm(const char *mount_info, const char *target)
int
cleanup_mounts_by_id
(
const
char
*
id
,
const
char
*
engine_root_path
)
{
char
target
[
PATH_MAX
]
=
{
0
};
char
target
[
PATH_MAX
]
=
{
0
};
int
nret
=
0
;
nret
=
snprintf
(
target
,
PATH_MAX
,
"%s/%s"
,
engine_root_path
,
id
);
...
...
@@ -1967,14 +1954,18 @@ int cleanup_container(container_t *cont, bool force)
if
(
is_paused
(
cont
->
state
))
{
isulad_set_error_message
(
"You cannot remove a paused container %s. "
"Unpause and then stop the container before "
"attempting removal or force remove"
,
id
);
"attempting removal or force remove"
,
id
);
ERROR
(
"You cannot remove a paused container %s. Unpause and then stop the container before "
"attempting removal or force remove"
,
id
);
"attempting removal or force remove"
,
id
);
}
else
{
isulad_set_error_message
(
"You cannot remove a running container %s. "
"Stop the container before attempting removal or use -f"
,
id
);
"Stop the container before attempting removal or use -f"
,
id
);
ERROR
(
"You cannot remove a running container %s."
" Stop the container before attempting removal or use -f"
,
id
);
" Stop the container before attempting removal or use -f"
,
id
);
}
ret
=
-
1
;
goto
reset_removal_progress
;
...
...
@@ -2018,8 +2009,7 @@ static void pack_delete_response(container_delete_response *response, uint32_t c
}
}
static
int
container_delete_cb
(
const
container_delete_request
*
request
,
container_delete_response
**
response
)
static
int
container_delete_cb
(
const
container_delete_request
*
request
,
container_delete_response
**
response
)
{
bool
force
=
false
;
uint32_t
cc
=
ISULAD_SUCCESS
;
...
...
@@ -2101,4 +2091,3 @@ void container_callback_init(service_container_callback_t *cb)
container_stream_callback_init
(
cb
);
container_extend_callback_init
(
cb
);
}
src/daemon/callback/container_cb/execution_create.c
浏览文件 @
5dbf3ebe
...
...
@@ -29,7 +29,6 @@
#include <malloc.h>
#include "isula_libutils/log.h"
#include "engine.h"
#include "console.h"
#include "isulad_config.h"
#include "config.h"
...
...
src/daemon/callback/container_cb/execution_extend.c
浏览文件 @
5dbf3ebe
...
...
@@ -27,7 +27,6 @@
#include <sys/sysinfo.h>
#include "isula_libutils/log.h"
#include "engine.h"
#include "collector.h"
#include "console.h"
#include "isulad_config.h"
...
...
src/daemon/callback/container_cb/execution_information.c
浏览文件 @
5dbf3ebe
...
...
@@ -27,7 +27,6 @@
#include <sys/sysinfo.h>
#include "isula_libutils/log.h"
#include "engine.h"
#include "console.h"
#include "isulad_config.h"
#include "config.h"
...
...
src/daemon/callback/container_cb/execution_stream.c
浏览文件 @
5dbf3ebe
...
...
@@ -30,7 +30,6 @@
#include <libgen.h>
#include "isula_libutils/log.h"
#include "engine.h"
#include "console.h"
#include "isulad_config.h"
#include "config.h"
...
...
@@ -496,8 +495,7 @@ err_out:
return
NULL
;
}
static
int
exec_container
(
container_t
*
cont
,
const
char
*
runtime
,
char
*
const
console_fifos
[],
defs_process_user
*
puser
,
static
int
exec_container
(
container_t
*
cont
,
const
char
*
runtime
,
char
*
const
console_fifos
[],
defs_process_user
*
puser
,
const
container_exec_request
*
request
,
int
*
exit_code
)
{
int
ret
=
0
;
...
...
src/daemon/callback/image_cb/image_cb.c
浏览文件 @
5dbf3ebe
...
...
@@ -30,7 +30,6 @@
#include "libisulad.h"
#include "isula_libutils/log.h"
#include "image.h"
#include "engine.h"
#include "isulad_config.h"
#include "mediatype.h"
#include "filters.h"
...
...
src/daemon/container/container_state.h
浏览文件 @
5dbf3ebe
...
...
@@ -19,7 +19,7 @@
#include "libisulad.h"
#include "isula_libutils/container_config_v2.h"
#include "
engin
e.h"
#include "
runtim
e.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern
"C"
{
...
...
@@ -30,7 +30,6 @@ typedef struct _container_state_t_ {
container_config_v2_state
*
state
;
}
container_state_t
;
container_state_t
*
container_state_new
(
void
);
void
container_state_free
(
container_state_t
*
state
);
...
...
@@ -97,4 +96,3 @@ int dup_health_check_status(defs_health **dst, const defs_health *src);
#endif
#endif
/* __ISULAD_CONTAINER_STATE_H__ */
src/daemon/container/container_unix.c
浏览文件 @
5dbf3ebe
...
...
@@ -1056,40 +1056,6 @@ char *container_get_env_nolock(const container_t *cont, const char *key)
return
val
;
}
int
container_read_proc
(
uint32_t
pid
,
container_pid_t
*
pid_info
)
{
int
ret
=
0
;
proc_t
*
proc
=
NULL
;
proc_t
*
p_proc
=
NULL
;
if
(
pid
==
0
)
{
ret
=
-
1
;
goto
out
;
}
proc
=
util_get_process_proc_info
((
pid_t
)
pid
);
if
(
proc
==
NULL
)
{
ret
=
-
1
;
goto
out
;
}
p_proc
=
util_get_process_proc_info
((
pid_t
)
proc
->
ppid
);
if
(
p_proc
==
NULL
)
{
ret
=
-
1
;
goto
out
;
}
pid_info
->
pid
=
proc
->
pid
;
pid_info
->
start_time
=
proc
->
start_time
;
pid_info
->
ppid
=
proc
->
ppid
;
pid_info
->
pstart_time
=
p_proc
->
start_time
;
out:
free
(
proc
);
free
(
p_proc
);
return
ret
;
}
/*
* @cont: check container
* @mpath: target mount path
...
...
src/daemon/container/container_unix.h
浏览文件 @
5dbf3ebe
...
...
@@ -107,8 +107,6 @@ int container_wait_rm_locking(container_t *cont, int timeout);
int
save_host_config
(
const
char
*
id
,
const
char
*
rootpath
,
const
char
*
hostconfigstr
);
int
save_config_v2_json
(
const
char
*
id
,
const
char
*
rootpath
,
const
char
*
v2configstr
);
int
container_read_proc
(
uint32_t
pid
,
container_pid_t
*
pid_info
);
bool
has_mount_for
(
container_t
*
cont
,
const
char
*
mpath
);
#if defined(__cplusplus) || defined(c_plusplus)
...
...
@@ -116,4 +114,3 @@ bool has_mount_for(container_t *cont, const char *mpath);
#endif
#endif
/* __ISULAD_CONTAINER_UNIX_H__ */
src/daemon/container/monitord.h
浏览文件 @
5dbf3ebe
...
...
@@ -17,7 +17,6 @@
#include <pthread.h>
#include <semaphore.h>
#include <limits.h>
#include "engine.h"
#include "libisulad.h"
#include "utils.h"
...
...
src/daemon/container/restartmanager.h
浏览文件 @
5dbf3ebe
...
...
@@ -17,7 +17,6 @@
#include <stdint.h>
#include <pthread.h>
#include "engine.h"
#include "isula_libutils/host_config.h"
struct
restart_policy
{
...
...
@@ -59,6 +58,4 @@ int restart_manager_wait_cancel(restart_manager_t *rm, uint64_t timeout);
int
container_restart_in_thread
(
const
char
*
id
,
uint64_t
timeout
,
int
exit_code
);
#endif
/* __RESTARTMANAGER_H */
src/daemon/container/restore.h
浏览文件 @
5dbf3ebe
...
...
@@ -18,8 +18,6 @@
#include <stdbool.h>
#include <stdint.h>
#include "engine.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -31,4 +29,3 @@ extern void containers_restore(void);
#endif
#endif
src/daemon/engines/CMakeLists.txt
浏览文件 @
5dbf3ebe
# get current directory sources files
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
engines_top_srcs
)
add_subdirectory
(
lcr
)
set
(
ENGINES_SRCS
${
engines_top_srcs
}
${
ENGINES_LCR_SRCS
}
PARENT_SCOPE
)
set
(
ENGINES_INCS
${
CMAKE_CURRENT_SOURCE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/lcr
PARENT_SCOPE
)
src/daemon/engines/engine.c
浏览文件 @
5dbf3ebe
...
...
@@ -90,8 +90,8 @@ static int engine_routine_log_init(const struct engine_operation *eop)
goto
unlock_out
;
}
// log throught fifo, so we need disable stderr by quiet (set to 1)
ret
=
eop
->
engine_log_init_op
(
args
->
progname
,
engine_log_path
,
args
->
json_confs
->
log_level
,
eop
->
engine_type
,
1
,
NULL
);
ret
=
eop
->
engine_log_init_op
(
args
->
progname
,
engine_log_path
,
args
->
json_confs
->
log_level
,
eop
->
engine_type
,
1
,
NULL
);
if
(
ret
!=
0
)
{
ret
=
-
1
;
goto
unlock_out
;
...
...
@@ -327,4 +327,3 @@ struct engine_operation *engines_get_handler(const char *name)
out:
return
engine_op
;
}
src/daemon/engines/engine.h
浏览文件 @
5dbf3ebe
...
...
@@ -23,19 +23,6 @@
extern
"C"
{
#endif
struct
engine_cgroup_resources
{
uint64_t
blkio_weight
;
uint64_t
cpu_shares
;
uint64_t
cpu_period
;
uint64_t
cpu_quota
;
char
*
cpuset_cpus
;
char
*
cpuset_mems
;
uint64_t
memory_limit
;
uint64_t
memory_swap
;
uint64_t
memory_reservation
;
uint64_t
kernel_memory_limit
;
};
typedef
enum
{
ENGINE_CONTAINER_STATUS_UNKNOWN
=
0
,
ENGINE_CONTAINER_STATUS_CREATED
=
1
,
...
...
@@ -47,19 +34,6 @@ typedef enum {
ENGINE_CONTAINER_STATUS_MAX_STATE
=
7
}
Engine_Container_Status
;
struct
engine_container_summary_info
{
char
*
id
;
uint32_t
has_pid
;
uint32_t
pid
;
Engine_Container_Status
status
;
char
*
image
;
char
*
command
;
uint32_t
exit_code
;
uint32_t
restart_count
;
char
*
startat
;
char
*
finishat
;
};
struct
engine_container_status_info
{
bool
has_pid
;
uint32_t
pid
;
...
...
@@ -82,12 +56,31 @@ struct engine_container_resources_stats_info {
uint64_t
kmem_limit
;
};
typedef
struct
_container_pid_t
{
int
pid
;
/* process id */
int
ppid
;
/* pid of parent process */
unsigned
long
long
start_time
,
/* start time of process -- seconds since 1-1-70 */
pstart_time
;
/* start time of parent process -- seconds since 1-1-70 */
}
container_pid_t
;
struct
engine_cgroup_resources
{
uint64_t
blkio_weight
;
uint64_t
cpu_shares
;
uint64_t
cpu_period
;
uint64_t
cpu_quota
;
char
*
cpuset_cpus
;
char
*
cpuset_mems
;
uint64_t
memory_limit
;
uint64_t
memory_swap
;
uint64_t
memory_reservation
;
uint64_t
kernel_memory_limit
;
};
struct
engine_container_summary_info
{
char
*
id
;
uint32_t
has_pid
;
uint32_t
pid
;
Engine_Container_Status
status
;
char
*
image
;
char
*
command
;
uint32_t
exit_code
;
uint32_t
restart_count
;
char
*
startat
;
char
*
finishat
;
};
typedef
struct
_engine_start_request_t
{
const
char
*
name
;
...
...
@@ -129,7 +122,6 @@ typedef struct _engine_exec_request_t {
bool
open_stdin
;
}
engine_exec_request_t
;
typedef
bool
(
*
engine_create_t
)(
const
char
*
,
const
char
*
,
void
*
);
typedef
bool
(
*
engine_start_t
)(
const
engine_start_request_t
*
request
);
...
...
@@ -208,4 +200,3 @@ extern struct engine_operation *engines_get_handler(const char *name);
#endif
#endif
src/daemon/engines/lcr/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
14eddc4c
# get current directory sources files
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
local_lcr_srcs
)
set
(
ENGINES_LCR_SRCS
${
local_lcr_srcs
}
PARENT_SCOPE
)
src/daemon/libisulad.c
浏览文件 @
5dbf3ebe
...
...
@@ -193,7 +193,6 @@ void isulad_container_resize_response_free(struct isulad_container_resize_respon
free
(
response
);
}
void
isulad_logs_request_free
(
struct
isulad_logs_request
*
request
)
{
if
(
request
==
NULL
)
{
...
...
@@ -258,3 +257,36 @@ void isulad_events_format_free(struct isulad_events_format *value)
free
(
value
);
}
int
container_read_proc
(
uint32_t
pid
,
container_pid_t
*
pid_info
)
{
int
ret
=
0
;
proc_t
*
proc
=
NULL
;
proc_t
*
p_proc
=
NULL
;
if
(
pid
==
0
)
{
ret
=
-
1
;
goto
out
;
}
proc
=
util_get_process_proc_info
((
pid_t
)
pid
);
if
(
proc
==
NULL
)
{
ret
=
-
1
;
goto
out
;
}
p_proc
=
util_get_process_proc_info
((
pid_t
)
proc
->
ppid
);
if
(
p_proc
==
NULL
)
{
ret
=
-
1
;
goto
out
;
}
pid_info
->
pid
=
proc
->
pid
;
pid_info
->
start_time
=
proc
->
start_time
;
pid_info
->
ppid
=
proc
->
ppid
;
pid_info
->
pstart_time
=
p_proc
->
start_time
;
out:
free
(
proc
);
free
(
p_proc
);
return
ret
;
}
src/daemon/libisulad.h
浏览文件 @
5dbf3ebe
...
...
@@ -36,6 +36,13 @@ extern __thread char *g_isulad_errmsg;
} \
} while (0)
typedef
struct
_container_pid_t
{
int
pid
;
/* process id */
int
ppid
;
/* pid of parent process */
unsigned
long
long
start_time
,
/* start time of process -- seconds since 1-1-70 */
pstart_time
;
/* start time of parent process -- seconds since 1-1-70 */
}
container_pid_t
;
typedef
enum
{
EVENTS_TYPE_EXIT
=
0
,
EVENTS_TYPE_STOPPED1
=
1
,
...
...
@@ -244,6 +251,7 @@ void isulad_logs_response_free(struct isulad_logs_response *response);
void
isulad_events_format_free
(
struct
isulad_events_format
*
value
);
int
container_read_proc
(
uint32_t
pid
,
container_pid_t
*
pid_info
);
#ifdef __cplusplus
}
#endif
...
...
src/daemon/runtime/CMakeLists.txt
浏览文件 @
5dbf3ebe
...
...
@@ -12,7 +12,7 @@ set(local_runtime_srcs
set
(
local_runtime_incs
${
CMAKE_CURRENT_SOURCE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/lcr
${
LCR_INCS
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/isula
)
...
...
src/daemon/runtime/isula/isula_rt_ops.c
浏览文件 @
5dbf3ebe
...
...
@@ -23,7 +23,6 @@
#include "isula_libutils/log.h"
#include "error.h"
#include "runtime.h"
#include "engine.h"
#include "constants.h"
#include "isula_libutils/shim_client_process_state.h"
#include "isula_libutils/shim_client_runtime_stats.h"
...
...
@@ -33,10 +32,9 @@
#include "libisulad.h"
#define SHIM_BINARY "isulad-shim"
#define SHIM_LOG_SIZE ((BUFSIZ
-100)/
2)
#define SHIM_LOG_SIZE ((BUFSIZ
- 100) /
2)
#define PID_WAIT_TIME 120
static
void
copy_process
(
shim_client_process_state
*
p
,
defs_process
*
dp
)
{
p
->
args
=
dp
->
args
;
...
...
@@ -83,7 +81,7 @@ static void copy_annotations(shim_client_process_state *p, json_map_string_strin
static
int
file_write_int
(
const
char
*
fname
,
int
val
)
{
char
sint
[
UINT_LEN
]
=
{
0
};
char
sint
[
UINT_LEN
]
=
{
0
};
if
(
snprintf
(
sint
,
sizeof
(
sint
),
"%d"
,
val
)
<
0
)
{
return
-
1
;
...
...
@@ -121,10 +119,10 @@ static void file_read_int(const char *fname, int *val)
static
void
get_err_message
(
char
*
buf
,
int
buf_size
,
const
char
*
workdir
,
const
char
*
file
)
{
char
fname
[
PATH_MAX
]
=
{
0
};
char
fname
[
PATH_MAX
]
=
{
0
};
FILE
*
fp
=
NULL
;
char
*
pline
=
NULL
;
char
*
lines
[
3
]
=
{
0
};
char
*
lines
[
3
]
=
{
0
};
size_t
length
=
0
;
if
(
snprintf
(
fname
,
sizeof
(
fname
),
"%s/%s"
,
workdir
,
file
)
<
0
)
{
...
...
@@ -177,9 +175,9 @@ static void get_err_message(char *buf, int buf_size, const char *workdir, const
static
void
show_shim_runtime_errlog
(
const
char
*
workdir
)
{
char
buf
[
BUFSIZ
]
=
{
0
};
char
buf1
[
SHIM_LOG_SIZE
]
=
{
0
};
char
buf2
[
SHIM_LOG_SIZE
]
=
{
0
};
char
buf
[
BUFSIZ
]
=
{
0
};
char
buf1
[
SHIM_LOG_SIZE
]
=
{
0
};
char
buf2
[
SHIM_LOG_SIZE
]
=
{
0
};
get_err_message
(
buf1
,
sizeof
(
buf1
),
workdir
,
"shim-log.json"
);
get_err_message
(
buf2
,
sizeof
(
buf2
),
workdir
,
"log.json"
);
...
...
@@ -200,10 +198,10 @@ bool rt_isula_detect(const char *runtime)
static
int
create_process_json_file
(
const
char
*
workdir
,
const
shim_client_process_state
*
p
)
{
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
parser_error
perr
=
NULL
;
char
*
data
=
NULL
;
char
fname
[
PATH_MAX
]
=
{
0
};
char
fname
[
PATH_MAX
]
=
{
0
};
int
retcode
=
0
;
if
(
snprintf
(
fname
,
sizeof
(
fname
),
"%s/process.json"
,
workdir
)
<
0
)
{
...
...
@@ -328,7 +326,7 @@ out:
static
bool
shim_alive
(
const
char
*
workdir
)
{
int
pid
=
0
;
char
fpid
[
PATH_MAX
]
=
{
0
};
char
fpid
[
PATH_MAX
]
=
{
0
};
int
ret
=
0
;
if
(
snprintf
(
fpid
,
sizeof
(
fpid
),
"%s/shim-pid"
,
workdir
)
<
0
)
{
...
...
@@ -403,10 +401,8 @@ static void runtime_exec_param_init(runtime_exec_info *rei)
}
}
static
void
runtime_exec_info_init
(
runtime_exec_info
*
rei
,
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
subcmd
,
const
char
**
opts
,
size_t
opts_len
,
const
char
*
id
,
char
**
params
,
size_t
params_num
)
static
void
runtime_exec_info_init
(
runtime_exec_info
*
rei
,
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
subcmd
,
const
char
**
opts
,
size_t
opts_len
,
const
char
*
id
,
char
**
params
,
size_t
params_num
)
{
rei
->
workdir
=
workdir
;
rei
->
runtime
=
runtime
;
...
...
@@ -423,10 +419,9 @@ static void runtime_exec_info_init(runtime_exec_info *rei,
runtime_exec_param_dump
((
const
char
**
)
rei
->
params
);
}
static
void
runtime_exec_func
(
void
*
arg
)
{
runtime_exec_info
*
rei
=
(
runtime_exec_info
*
)
arg
;
runtime_exec_info
*
rei
=
(
runtime_exec_info
*
)
arg
;
if
(
rei
==
NULL
)
{
dprintf
(
STDERR_FILENO
,
"missing runtime exec info"
);
...
...
@@ -457,17 +452,17 @@ static int status_string_to_int(const char *status)
return
ENGINE_CONTAINER_STATUS_UNKNOWN
;
}
static
int
runtime_call_status
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
id
,
struct
engine_container_status_info
*
ecsi
)
static
int
runtime_call_status
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
id
,
struct
engine_container_status_info
*
ecsi
)
{
char
*
stdout
=
NULL
;
char
*
stderr
=
NULL
;
oci_runtime_state
*
state
=
NULL
;
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
parser_error
perr
=
NULL
;
runtime_exec_info
rei
=
{
0
};
int
ret
=
0
;
char
*
params
[
PARAM_NUM
]
=
{
0
};
char
*
params
[
PARAM_NUM
]
=
{
0
};
runtime_exec_info_init
(
&
rei
,
workdir
,
runtime
,
"state"
,
NULL
,
0
,
id
,
params
,
PARAM_NUM
);
...
...
@@ -506,18 +501,18 @@ out:
return
ret
;
}
static
int
runtime_call_stats
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
id
,
struct
engine_container_resources_stats_info
*
info
)
static
int
runtime_call_stats
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
id
,
struct
engine_container_resources_stats_info
*
info
)
{
char
*
stdout
=
NULL
;
char
*
stderr
=
NULL
;
shim_client_runtime_stats
*
stats
=
NULL
;
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
struct
parser_context
ctx
=
{
OPT_GEN_SIMPLIFY
,
0
};
parser_error
perr
=
NULL
;
runtime_exec_info
rei
=
{
0
};
int
ret
=
0
;
char
*
params
[
PARAM_NUM
]
=
{
0
};
const
char
*
opts
[
1
]
=
{
"--stats"
};
char
*
params
[
PARAM_NUM
]
=
{
0
};
const
char
*
opts
[
1
]
=
{
"--stats"
};
runtime_exec_info_init
(
&
rei
,
workdir
,
runtime
,
"events"
,
opts
,
1
,
id
,
params
,
PARAM_NUM
);
...
...
@@ -560,14 +555,14 @@ out:
return
ret
;
}
static
int
runtime_call_simple
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
subcmd
,
const
char
**
opts
,
size_t
opts_len
,
const
char
*
id
)
static
int
runtime_call_simple
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
subcmd
,
const
char
**
opts
,
size_t
opts_len
,
const
char
*
id
)
{
runtime_exec_info
rei
=
{
0
};
runtime_exec_info
rei
=
{
0
};
char
*
stdout
=
NULL
;
char
*
stderr
=
NULL
;
int
ret
=
0
;
char
*
params
[
PARAM_NUM
]
=
{
0
};
char
*
params
[
PARAM_NUM
]
=
{
0
};
runtime_exec_info_init
(
&
rei
,
workdir
,
runtime
,
subcmd
,
opts
,
opts_len
,
id
,
params
,
PARAM_NUM
);
if
(
!
util_exec_cmd
(
runtime_exec_func
,
&
rei
,
NULL
,
&
stdout
,
&
stderr
))
{
...
...
@@ -588,7 +583,7 @@ static int runtime_call_kill_force(const char *workdir, const char *runtime, con
static
int
runtime_call_delete_force
(
const
char
*
workdir
,
const
char
*
runtime
,
const
char
*
id
)
{
const
char
*
opts
[
1
]
=
{
"--force"
};
const
char
*
opts
[
1
]
=
{
"--force"
};
return
runtime_call_simple
(
workdir
,
runtime
,
"delete"
,
opts
,
1
,
id
);
}
...
...
@@ -611,8 +606,7 @@ static int status_to_exit_code(int status)
return
exit_code
;
}
static
int
shim_create
(
bool
fg
,
const
char
*
id
,
const
char
*
workdir
,
const
char
*
bundle
,
const
char
*
runtime_cmd
,
static
int
shim_create
(
bool
fg
,
const
char
*
id
,
const
char
*
workdir
,
const
char
*
bundle
,
const
char
*
runtime_cmd
,
int
*
exit_code
)
{
pid_t
pid
=
0
;
...
...
@@ -620,8 +614,8 @@ static int shim_create(bool fg, const char *id, const char *workdir,
int
num
=
0
;
int
ret
=
0
;
char
exec_buff
[
BUFSIZ
+
1
]
=
{
0
};
char
fpid
[
PATH_MAX
]
=
{
0
};
const
char
*
params
[
PARAM_NUM
]
=
{
0
};
char
fpid
[
PATH_MAX
]
=
{
0
};
const
char
*
params
[
PARAM_NUM
]
=
{
0
};
int
i
=
0
;
int
status
=
0
;
...
...
@@ -718,19 +712,18 @@ realexec:
out:
if
(
ret
!=
0
)
{
show_shim_runtime_errlog
(
workdir
);
kill
(
pid
,
SIGKILL
);
/* can kill other process? */
kill
(
pid
,
SIGKILL
);
/* can kill other process? */
}
return
ret
;
}
static
int
get_container_process_pid
(
const
char
*
workdir
)
{
char
fname
[
PATH_MAX
]
=
{
0
};
char
fname
[
PATH_MAX
]
=
{
0
};
int
pid
=
0
;
struct
timespec
beg
=
{
0
};
struct
timespec
end
=
{
0
};
struct
timespec
beg
=
{
0
};
struct
timespec
end
=
{
0
};
if
(
snprintf
(
fname
,
sizeof
(
fname
),
"%s/pid"
,
workdir
)
<
0
)
{
ERROR
(
"failed make pid full path"
);
...
...
@@ -760,7 +753,7 @@ static int get_container_process_pid(const char *workdir)
ERROR
(
"failed read pid from dead shim %s"
,
workdir
);
return
-
1
;
}
return
pid
;
/* success */
return
pid
;
/* success */
}
return
-
1
;
}
...
...
@@ -768,7 +761,7 @@ static int get_container_process_pid(const char *workdir)
static
void
shim_kill_force
(
const
char
*
workdir
)
{
int
pid
=
0
;
char
fpid
[
PATH_MAX
]
=
{
0
};
char
fpid
[
PATH_MAX
]
=
{
0
};
if
(
snprintf
(
fpid
,
sizeof
(
fpid
),
"%s/shim-pid"
,
workdir
)
<
0
)
{
INFO
(
"shim-pid not exist"
);
...
...
@@ -787,16 +780,15 @@ out:
INFO
(
"kill shim force %s"
,
workdir
);
}
int
rt_isula_create
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_create_params_t
*
params
)
int
rt_isula_create
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_create_params_t
*
params
)
{
oci_runtime_spec
*
config
=
NULL
;
const
char
*
cmd
=
NULL
;
const
char
**
runtime_args
=
NULL
;
size_t
runtime_args_len
=
0
;
int
ret
=
0
;
char
workdir
[
PATH_MAX
]
=
{
0
};
shim_client_process_state
p
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
shim_client_process_state
p
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -840,11 +832,9 @@ out:
return
ret
;
}
int
rt_isula_start
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_start_params_t
*
params
,
container_pid_t
*
pid_info
)
int
rt_isula_start
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_start_params_t
*
params
,
container_pid_t
*
pid_info
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
pid_t
pid
=
0
;
int
ret
=
0
;
...
...
@@ -885,17 +875,15 @@ out:
return
ret
;
}
int
rt_isula_restart
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_restart_params_t
*
params
)
int
rt_isula_restart
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_restart_params_t
*
params
)
{
ERROR
(
">>> restart not implemented"
);
return
RUNTIME_NOT_IMPLEMENT_RESET
;
}
int
rt_isula_clean_resource
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_clean_params_t
*
params
)
int
rt_isula_clean_resource
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_clean_params_t
*
params
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -930,7 +918,7 @@ int rt_isula_clean_resource(const char *id, const char *runtime,
int
rt_isula_rm
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_rm_params_t
*
params
)
{
char
libdir
[
PATH_MAX
]
=
{
0
};
char
libdir
[
PATH_MAX
]
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -978,26 +966,24 @@ err_out:
static
bool
fg_exec
(
const
rt_exec_params_t
*
params
)
{
if
(
params
->
console_fifos
[
0
]
!=
NULL
||
params
->
console_fifos
[
1
]
!=
NULL
||
params
->
console_fifos
[
2
]
!=
NULL
)
{
if
(
params
->
console_fifos
[
0
]
!=
NULL
||
params
->
console_fifos
[
1
]
!=
NULL
||
params
->
console_fifos
[
2
]
!=
NULL
)
{
return
true
;
}
return
false
;
}
int
rt_isula_exec
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
)
int
rt_isula_exec
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
)
{
char
*
exec_id
=
NULL
;
defs_process
*
process
=
NULL
;
const
char
**
runtime_args
=
NULL
;
size_t
runtime_args_len
=
0
;
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
const
char
*
cmd
=
NULL
;
int
ret
=
0
;
char
bundle
[
PATH_MAX
]
=
{
0
};
char
bundle
[
PATH_MAX
]
=
{
0
};
int
pid
=
0
;
shim_client_process_state
p
=
{
0
};
shim_client_process_state
p
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
||
exit_code
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -1070,11 +1056,10 @@ out:
return
ret
;
}
int
rt_isula_status
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_status_params_t
*
params
,
int
rt_isula_status
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_status_params_t
*
params
,
struct
engine_container_status_info
*
status
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
int
ret
=
0
;
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
||
status
==
NULL
)
{
...
...
@@ -1100,8 +1085,7 @@ out:
return
ret
;
}
int
rt_isula_attach
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_attach_params_t
*
params
)
int
rt_isula_attach
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_attach_params_t
*
params
)
{
ERROR
(
"isula attach not support on isulad-shim"
);
isulad_set_error_message
(
"isula attach not support on isulad-shim"
);
...
...
@@ -1117,7 +1101,7 @@ int rt_isula_update(const char *id, const char *runtime, const rt_update_params_
int
rt_isula_pause
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_pause_params_t
*
params
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -1134,7 +1118,7 @@ int rt_isula_pause(const char *id, const char *runtime, const rt_pause_params_t
int
rt_isula_resume
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_resume_params_t
*
params
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
)
{
ERROR
(
"nullptr arguments not allowed"
);
...
...
@@ -1156,11 +1140,10 @@ int rt_isula_listpids(const char *name, const char *runtime, const rt_listpids_p
return
-
1
;
}
int
rt_isula_resources_stats
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_stats_params_t
*
params
,
int
rt_isula_resources_stats
(
const
char
*
id
,
const
char
*
runtime
,
const
rt_stats_params_t
*
params
,
struct
engine_container_resources_stats_info
*
rs_stats
)
{
char
workdir
[
PATH_MAX
]
=
{
0
};
char
workdir
[
PATH_MAX
]
=
{
0
};
int
ret
=
0
;
if
(
id
==
NULL
||
runtime
==
NULL
||
params
==
NULL
||
rs_stats
==
NULL
)
{
...
...
src/daemon/runtime/lcr/CMakeLists.txt
浏览文件 @
5dbf3ebe
# get current directory sources files
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
local_lcr_srcs
)
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
runtime_lcr_top_srcs
)
set
(
local_runtime_lcr_srcs
${
runtime_lcr_top_srcs
}
)
set
(
local_runtime_lcr_incs
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
LCR_SRCS
${
local_lcr_srcs
}
${
local_runtime_lcr_srcs
}
PARENT_SCOPE
)
set
(
LCR_INCS
${
local_runtime_lcr_incs
}
PARENT_SCOPE
)
src/daemon/
engines
/lcr/lcr_engine.c
→
src/daemon/
runtime
/lcr/lcr_engine.c
浏览文件 @
5dbf3ebe
文件已移动
src/daemon/
engines
/lcr/lcr_engine.h
→
src/daemon/
runtime
/lcr/lcr_engine.h
浏览文件 @
5dbf3ebe
...
...
@@ -28,4 +28,3 @@ struct engine_operation *lcr_engine_init();
#endif
#endif
src/daemon/runtime/lcr/lcr_rt_ops.c
浏览文件 @
5dbf3ebe
...
...
@@ -22,6 +22,7 @@
#include "engine.h"
#include "error.h"
#include "isulad_config.h"
#include "libisulad.h"
#include "runtime.h"
bool
rt_lcr_detect
(
const
char
*
runtime
)
...
...
@@ -61,8 +62,7 @@ int rt_lcr_create(const char *name, const char *runtime, const rt_create_params_
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Create container error: %s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -95,7 +95,7 @@ static int lcr_rt_read_pidfile(const char *pidfile, container_pid_t *pid_info)
return
-
1
;
}
char
sbuf
[
1024
]
=
{
0
};
/* bufs for stat */
char
sbuf
[
1024
]
=
{
0
};
/* bufs for stat */
if
((
util_file2str
(
pidfile
,
sbuf
,
sizeof
(
sbuf
)))
==
-
1
)
{
return
-
1
;
...
...
@@ -135,10 +135,8 @@ int rt_lcr_start(const char *name, const char *runtime, const rt_start_params_t
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Start container error: %s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ERROR
(
"Start container error: %s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ERROR
(
"Start container error: %s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -178,8 +176,7 @@ int rt_lcr_clean_resource(const char *name, const char *runtime, const rt_clean_
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_try_set_error_message
(
"Clean resource container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -392,8 +389,8 @@ int rt_lcr_exec(const char *id, const char *runtime, const rt_exec_params_t *par
if
(
engine_ops
->
engine_get_errmsg_op
!=
NULL
)
{
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Exec container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
isulad_set_error_message
(
"Exec container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
util_contain_errmsg
(
g_isulad_errmsg
,
exit_code
);
ret
=
-
1
;
goto
out
;
...
...
@@ -425,8 +422,8 @@ int rt_lcr_pause(const char *name, const char *runtime, const rt_pause_params_t
if
(
engine_ops
->
engine_get_errmsg_op
!=
NULL
)
{
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Pause container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
isulad_set_error_message
(
"Pause container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -456,8 +453,7 @@ int rt_lcr_resume(const char *name, const char *runtime, const rt_resume_params_
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Resume container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -487,8 +483,8 @@ int rt_lcr_attach(const char *name, const char *runtime, const rt_attach_params_
if
(
engine_ops
->
engine_get_errmsg_op
!=
NULL
)
{
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Attach container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
isulad_set_error_message
(
"Attach container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -538,8 +534,8 @@ int rt_lcr_update(const char *id, const char *runtime, const rt_update_params_t
if
(
engine_ops
->
engine_get_errmsg_op
!=
NULL
)
{
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Cannot update container %s: %s"
,
id
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
isulad_set_error_message
(
"Cannot update container %s: %s"
,
id
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -605,8 +601,7 @@ int rt_lcr_resize(const char *id, const char *runtime, const rt_resize_params_t
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Resize container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
...
...
@@ -637,8 +632,7 @@ int rt_lcr_exec_resize(const char *id, const char *runtime, const rt_exec_resize
tmpmsg
=
engine_ops
->
engine_get_errmsg_op
();
}
isulad_set_error_message
(
"Resize container error;%s"
,
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
(
tmpmsg
&&
strcmp
(
tmpmsg
,
DEF_SUCCESS_STR
))
?
tmpmsg
:
DEF_ERR_RUNTIME_STR
);
ret
=
-
1
;
goto
out
;
}
...
...
src/daemon/runtime/runtime.h
浏览文件 @
5dbf3ebe
...
...
@@ -17,8 +17,9 @@
#include <stdint.h>
#include <stdbool.h>
#include "container_unix.h"
#include "libisulad.h"
#include "isula_libutils/host_config.h"
#include "isula_libutils/oci_runtime_spec.h"
#include "engine.h"
#ifdef __cplusplus
...
...
@@ -41,7 +42,6 @@ typedef struct _rt_create_params_t {
bool
open_stdin
;
}
rt_create_params_t
;
typedef
struct
_rt_start_params_t
{
const
char
*
rootpath
;
const
char
*
state
;
...
...
@@ -162,8 +162,7 @@ struct rt_ops {
int
(
*
rt_resources_stats
)(
const
char
*
name
,
const
char
*
runtime
,
const
rt_stats_params_t
*
params
,
struct
engine_container_resources_stats_info
*
rs_stats
);
int
(
*
rt_exec
)(
const
char
*
name
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
);
int
(
*
rt_exec
)(
const
char
*
name
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
);
int
(
*
rt_pause
)(
const
char
*
name
,
const
char
*
runtime
,
const
rt_pause_params_t
*
params
);
int
(
*
rt_resume
)(
const
char
*
name
,
const
char
*
runtime
,
const
rt_resume_params_t
*
params
);
...
...
@@ -187,8 +186,7 @@ int runtime_status(const char *name, const char *runtime, const rt_status_params
struct
engine_container_status_info
*
status
);
int
runtime_resources_stats
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_stats_params_t
*
params
,
struct
engine_container_resources_stats_info
*
rs_stats
);
int
runtime_exec
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
);
int
runtime_exec
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_exec_params_t
*
params
,
int
*
exit_code
);
int
runtime_pause
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_pause_params_t
*
params
);
int
runtime_resume
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_resume_params_t
*
params
);
int
runtime_attach
(
const
char
*
name
,
const
char
*
runtime
,
const
rt_attach_params_t
*
params
);
...
...
@@ -204,4 +202,3 @@ int runtime_exec_resize(const char *name, const char *runtime, const rt_exec_res
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录