提交 1e621b03 编写于 作者: L lifeng68

refact: move engines to runtime directory

Signed-off-by: Nlifeng68 <lifeng68@huawei.com>
上级 5e61c22c
......@@ -89,7 +89,7 @@ install(FILES src/cutils/utils_timestamp.h
DESTINATION include/isulad)
install(FILES src/cutils/error.h
DESTINATION include/isulad)
install(FILES src/daemon/engines/engine.h
install(FILES src/daemon/runtime/engines/engine.h
DESTINATION include/isulad)
# install config files
......
......@@ -76,7 +76,7 @@ install -m 0644 ../src/client/libisula.h %{buildroot}/%{_includedir}/isulad/li
install -m 0644 ../src/client/connect/isula_connect.h %{buildroot}/%{_includedir}/isulad/isula_connect.h
install -m 0644 ../src/cutils/utils_timestamp.h %{buildroot}/%{_includedir}/isulad/utils_timestamp.h
install -m 0644 ../src/cutils/error.h %{buildroot}/%{_includedir}/isulad/error.h
install -m 0644 ../src/daemon/engines/engine.h %{buildroot}/%{_includedir}/isulad/engine.h
install -m 0644 ../src/daemon/runtime/engines/engine.h %{buildroot}/%{_includedir}/isulad/engine.h
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/isulad
install -m 0640 ../src/contrib/config/daemon.json %{buildroot}/%{_sysconfdir}/isulad/daemon.json
......
......@@ -58,7 +58,6 @@
#include "plugin.h"
#include "selinux_label.h"
#include "http.h"
#include "engine.h"
#ifdef GRPC_CONNECTOR
#include "clibcni/api.h"
......@@ -1208,34 +1207,6 @@ out:
return ret;
}
static int isulad_server_init_engines()
{
int ret = 0;
char *engine = NULL;
engine = conf_get_isulad_engine();
if (engine == NULL) {
ret = -1;
goto out;
}
if (engines_global_init()) {
ERROR("Init engines global failed");
ret = -1;
goto out;
}
/* Init default engine, now is lcr */
if (engines_discovery(engine)) {
ERROR("Failed to discovery default engine:%s", engine);
ret = -1;
}
out:
free(engine);
return ret;
}
static void set_mallopt()
{
if (mallopt(M_ARENA_TEST, 8) == 0) {
......@@ -1402,8 +1373,8 @@ static int pre_init_daemon(int argc, char **argv, char **msg)
goto out;
}
if (isulad_server_init_engines()) {
*msg = "Failed to init engines";
if (runtime_init() != 0) {
*msg = "Failed to init runtime";
goto out;
}
......
......@@ -10,7 +10,6 @@ add_subdirectory(container)
add_subdirectory(connect)
add_subdirectory(log)
add_subdirectory(events)
add_subdirectory(engines)
set(local_daemon_srcs
${daemon_top_srcs}
......@@ -23,7 +22,6 @@ set(local_daemon_srcs
${SERVER_CONNECT_SRCS}
${LOG_GATHER_SRCS}
${EVENTS_SRCS}
${ENGINES_SRCS}
)
set(local_daemon_incs
......@@ -37,7 +35,6 @@ set(local_daemon_incs
${SERVER_CONNECT_INCS}
${LOG_GATHER_INCS}
${EVENTS_INCS}
${ENGINES_INCS}
)
if (GRPC_CONNECTOR)
......
......@@ -33,7 +33,6 @@
#include "libisulad.h"
#include "containers_store.h"
#include "container_unix.h"
#include "image.h"
static struct context_lists g_context_lists;
......
# get current directory sources files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} runtime_top_srcs)
add_subdirectory(lcr)
add_subdirectory(engines)
add_subdirectory(isula)
set(local_runtime_srcs
${runtime_top_srcs}
${LCR_SRCS}
${ENGINES_SRCS}
${ISULA_SRCS}
)
set(local_runtime_incs
${CMAKE_CURRENT_SOURCE_DIR}
${LCR_INCS}
${ENGINES_INCS}
${CMAKE_CURRENT_SOURCE_DIR}/isula
)
......
# get current directory sources files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} engines_top_srcs)
add_subdirectory(lcr)
set(ENGINES_SRCS
${engines_top_srcs}
${LCR_SRCS}
PARENT_SCOPE
)
set(ENGINES_INCS
${CMAKE_CURRENT_SOURCE_DIR}
${LCR_INCS}
PARENT_SCOPE
)
......@@ -22,6 +22,7 @@
#include <ctype.h>
#include "runtime.h"
#include "isulad_config.h"
#include "isula_libutils/log.h"
#include "utils.h"
#include "lcr_rt_ops.h"
......@@ -161,7 +162,6 @@ out:
return ret;
}
int runtime_clean_resource(const char *name, const char *runtime, const rt_clean_params_t *params)
{
int ret = 0;
......@@ -260,8 +260,7 @@ out:
return ret;
}
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 ret = 0;
const struct rt_ops *ops = NULL;
......@@ -463,3 +462,31 @@ int runtime_exec_resize(const char *name, const char *runtime, const rt_exec_res
out:
return ret;
}
int runtime_init()
{
int ret = 0;
char *engine = NULL;
engine = conf_get_isulad_engine();
if (engine == NULL) {
ret = -1;
goto out;
}
if (engines_global_init()) {
ERROR("Init engines global failed");
ret = -1;
goto out;
}
/* Init default engine, now is lcr */
if (engines_discovery(engine)) {
ERROR("Failed to discovery default engine:%s", engine);
ret = -1;
}
out:
free(engine);
return ret;
}
......@@ -197,6 +197,8 @@ int runtime_listpids(const char *name, const char *runtime, const rt_listpids_pa
void free_rt_listpids_out_t(rt_listpids_out_t *out);
int runtime_resize(const char *name, const char *runtime, const rt_resize_params_t *params);
int runtime_exec_resize(const char *name, const char *runtime, const rt_exec_resize_params_t *params);
int runtime_init();
#ifdef __cplusplus
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册