Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
46ff577a
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,发现更多精彩内容 >>
提交
46ff577a
编写于
2月 12, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
2月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
!31 Change isulad_kit to isulad_image
Merge pull request !31 from wangfengtu/change_isulad_kit_to_isulad-img
上级
00d31f7a
749aa1b0
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
53 addition
and
53 deletion
+53
-53
Dockerfile
Dockerfile
+3
-3
iSulad.spec
iSulad.spec
+1
-1
src/image/oci/global_config.c
src/image/oci/global_config.c
+2
-2
src/image/oci/isula_image.c
src/image/oci/isula_image.c
+2
-2
src/image/oci/run_image_server.c
src/image/oci/run_image_server.c
+44
-44
src/image/oci/run_image_server.h
src/image/oci/run_image_server.h
+1
-1
未找到文件。
Dockerfile
浏览文件 @
46ff577a
...
...
@@ -247,12 +247,12 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
make
install
&&
\
ldconfig
# install iSulad-
kit
# install iSulad-
img
RUN
export
PKG_CONFIG_PATH
=
/usr/local/lib/pkgconfig:
$PKG_CONFIG_PATH
&&
\
set
-x
&&
\
cd
~
&&
\
git clone https://gitee.com/openeuler/iSulad-
kit
.git
&&
\
cd
iSulad-
kit
&&
\
git clone https://gitee.com/openeuler/iSulad-
img
.git
&&
\
cd
iSulad-
img
&&
\
./apply-patch
&&
\
make
-j
$(
nproc
)
&&
\
make
install
&&
\
...
...
iSulad.spec
浏览文件 @
46ff577a
...
...
@@ -36,7 +36,7 @@ BuildRequires: http-parser-devel libevhtp-devel libevent-devel
BuildRequires: libseccomp-devel libcap-devel libwebsockets libwebsockets-devel
BuildRequires: systemd-devel git
Requires: iSulad-
kit
lcr lxc clibcni
Requires: iSulad-
img
lcr lxc clibcni
Requires: grpc protobuf yajl
Requires: libcurl
Requires: sqlite http-parser libseccomp
...
...
src/image/oci/global_config.c
浏览文件 @
46ff577a
...
...
@@ -42,14 +42,14 @@ static int pack_global_graph_driver(const char * const *options, bool ignore_sto
if
(
strcmp
(
graph_driver
,
"overlay2"
)
==
0
)
{
// Treating overlay2 as overlay cause image was downloaded always
// in '/var/lib/isulad/storage/overlay' directory.
// See iSulad-
kit
/vendor/github.com/containers/storage/drivers/overlay/overlay.go,
// See iSulad-
img
/vendor/github.com/containers/storage/drivers/overlay/overlay.go,
// Driver is inited by name "overlay".
graph_driver
[
strlen
(
graph_driver
)
-
1
]
=
'\0'
;
}
add_array_kv
(
params
,
PARAM_NUM
,
&
i
,
options
[
GB_OPTION_DRIVER_NAME
],
graph_driver
);
graph_opts
=
conf_get_storage_opts
();
// since iSulad-
kit
will set quota when pull image, which is differ from docker,
// since iSulad-
img
will set quota when pull image, which is differ from docker,
// and we may get some error if setted, ignore it if neccessary.
for
(
p
=
graph_opts
;
(
p
!=
NULL
)
&&
(
*
p
!=
NULL
);
p
++
)
{
if
(
ignore_storage_opt_size
&&
driver
!=
NULL
&&
driver
->
ops
->
is_quota_options
(
driver
,
*
p
))
{
...
...
src/image/oci/isula_image.c
浏览文件 @
46ff577a
...
...
@@ -52,7 +52,7 @@ void isula_exit(void)
{
int
nret
;
isula_
kit
_exit
();
isula_
img
_exit
();
nret
=
pthread_cancel
(
g_monitor_thread
);
if
(
nret
!=
0
)
{
SYSERROR
(
"Cancel isula monitor thread failed"
);
...
...
@@ -70,7 +70,7 @@ static int start_isula_image_server(void)
im_opt_timeout
=
im_opt_timeout
>=
MIN_OPT_TIMEOUT
?
im_opt_timeout
:
MIN_OPT_TIMEOUT
;
// check whether isula
_kit
is running by systemd
// check whether isula
d-img
is running by systemd
if
(
util_file_exists
(
ISULA_IMAGE_SERVER_DEFAULT_SOCK
))
{
if
(
!
conf_update_im_server_sock_addr
(
ISULA_IMAGE_SERVER_DEFAULT_SOCK
))
{
ERROR
(
"Update image socket address failed"
);
...
...
src/image/oci/run_image_server.c
浏览文件 @
46ff577a
...
...
@@ -48,7 +48,7 @@ const char *g_imtool_gb_options[] = {
NULL
,
};
#define ISULA_IMAGE_SERVER_CMD "isulad
_kit
"
#define ISULA_IMAGE_SERVER_CMD "isulad
-img
"
#define ISULA_IMAGE_DAEMON "daemon"
#define ISULA_IMAGE_DAEMON_HOST "--host"
#define ISULA_IMAGE_DAEMON_OPTION_TLS_VERIFY "--tls-verify=false"
...
...
@@ -59,9 +59,9 @@ const char *g_imtool_gb_options[] = {
#define ONE_TENTH_SECOND 100000
static
pthread_mutex_t
g_mutex
;
static
pid_t
g_isulad_
kit
_pid
=
-
1
;
static
unsigned
long
long
g_isulad_
kit
_start_time
=
0
;
static
bool
g_isula_
kit
_exit
=
false
;
static
pid_t
g_isulad_
img
_pid
=
-
1
;
static
unsigned
long
long
g_isulad_
img
_start_time
=
0
;
static
bool
g_isula_
img
_exit
=
false
;
static
int
pack_isula_image_global_options
(
char
*
params
[],
size_t
*
count
,
bool
ignore_storage_opt_size
)
{
...
...
@@ -206,10 +206,10 @@ static void kill_old_image_server(pid_t server_pid, unsigned long long start_tim
}
}
static
void
*
heartbeat_for_isulad_
kit
(
void
*
arg
)
static
void
*
heartbeat_for_isulad_
img
(
void
*
arg
)
{
pid_t
tmp_isulad_
kit
_pid
=
-
1
;
unsigned
long
long
tmp_isulad_
kit
_start_time
=
0
;
pid_t
tmp_isulad_
img
_pid
=
-
1
;
unsigned
long
long
tmp_isulad_
img
_start_time
=
0
;
if
(
pthread_detach
(
pthread_self
())
!=
0
)
{
ERROR
(
"Detach heartbeat thread failed"
);
...
...
@@ -224,22 +224,22 @@ static void *heartbeat_for_isulad_kit(void *arg)
continue
;
}
tmp_isulad_
kit_pid
=
g_isulad_kit
_pid
;
tmp_isulad_
kit_start_time
=
g_isulad_kit
_start_time
;
tmp_isulad_
img_pid
=
g_isulad_img
_pid
;
tmp_isulad_
img_start_time
=
g_isulad_img
_start_time
;
if
(
pthread_mutex_unlock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Lock isulad
kit
pid failed"
);
ERROR
(
"Lock isulad
img
pid failed"
);
break
;
}
if
(
tmp_isulad_
kit
_pid
==
-
1
)
{
if
(
tmp_isulad_
img
_pid
==
-
1
)
{
usleep_nointerupt
(
ONE_TENTH_SECOND
);
continue
;
}
do_check_mainloop
();
kill_old_image_server
(
tmp_isulad_
kit_pid
,
tmp_isulad_kit
_start_time
,
HALF_A_SECOND
);
kill_old_image_server
(
tmp_isulad_
img_pid
,
tmp_isulad_img
_start_time
,
HALF_A_SECOND
);
}
return
NULL
;
...
...
@@ -299,7 +299,7 @@ static int isula_image_server_load_first_check(const struct server_monitor_conf
}
/* 1. If health check success, send a mutex to main thread and make it run again;
* 2. Sync data between iSulad and iSulad-
kit
.
* 2. Sync data between iSulad and iSulad-
img
.
*/
if
(
retry
)
{
ret
=
isula_sync_images
();
...
...
@@ -323,37 +323,37 @@ out:
return
ret
;
}
void
isula_
kit
_exit
()
void
isula_
img
_exit
()
{
if
(
pthread_mutex_lock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Lock isulad
kit
pid failed"
);
ERROR
(
"Lock isulad
img
pid failed"
);
return
;
}
g_isula_
kit
_exit
=
true
;
kill_old_image_server
(
g_isulad_
kit_pid
,
g_isulad_kit
_start_time
,
ONE_TENTH_SECOND
);
g_isula_
img
_exit
=
true
;
kill_old_image_server
(
g_isulad_
img_pid
,
g_isulad_img
_start_time
,
ONE_TENTH_SECOND
);
if
(
pthread_mutex_unlock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Unlock isulad
kit
pid failed"
);
ERROR
(
"Unlock isulad
img
pid failed"
);
}
}
static
void
update_isulad_
kit
_pid_info
(
pid_t
pid
,
unsigned
long
long
start_time
)
static
void
update_isulad_
img
_pid_info
(
pid_t
pid
,
unsigned
long
long
start_time
)
{
if
(
pthread_mutex_lock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Lock isulad
kit
pid failed"
);
ERROR
(
"Lock isulad
img
pid failed"
);
return
;
}
g_isulad_
kit
_start_time
=
start_time
;
g_isulad_
kit
_pid
=
pid
;
g_isulad_
img
_start_time
=
start_time
;
g_isulad_
img
_pid
=
pid
;
if
(
pthread_mutex_unlock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Unlock isulad
kit
pid failed"
);
ERROR
(
"Unlock isulad
img
pid failed"
);
}
}
static
int
load_isula_image_server
(
const
struct
server_monitor_conf
*
conf
,
bool
retry
,
pid_t
*
kit
_pid
)
static
int
load_isula_image_server
(
const
struct
server_monitor_conf
*
conf
,
bool
retry
,
pid_t
*
img
_pid
)
{
pid_t
pid
=
0
;
int
ret
=
0
;
...
...
@@ -368,7 +368,7 @@ static int load_isula_image_server(const struct server_monitor_conf *conf, bool
}
if
(
pid
==
(
pid_t
)
0
)
{
// child to load isula
-kit
binary
// child to load isula
d-img
binary
nret
=
prctl
(
PR_SET_PDEATHSIG
,
SIGKILL
,
(
unsigned
long
)
0
,
(
unsigned
long
)
0
,
(
unsigned
long
)
0
);
if
(
nret
<
0
)
{
COMMAND_ERROR
(
"Failed to set parent death signal"
);
...
...
@@ -381,18 +381,18 @@ static int load_isula_image_server(const struct server_monitor_conf *conf, bool
}
execute_run_isula_image_server
(
NULL
);
}
*
kit
_pid
=
pid
;
*
img
_pid
=
pid
;
/* parent */
start_time
=
get_image_server_start_time
(
pid
);
/* check first load isulad
kit
is success. */
/* check first load isulad
img
is success. */
if
(
isula_image_server_load_first_check
(
conf
,
retry
)
!=
0
)
{
ret
=
-
1
;
}
/* update isulad
_kit
information */
update_isulad_
kit
_pid_info
(
pid
,
start_time
);
/* update isulad
-img
information */
update_isulad_
img
_pid_info
(
pid
,
start_time
);
out:
return
ret
;
...
...
@@ -417,7 +417,7 @@ void *isula_image_server_monitor(void *arg)
struct
server_monitor_conf
*
conf
=
(
struct
server_monitor_conf
*
)
arg
;
bool
retry_flag
=
false
;
pthread_t
wp_thread
;
pid_t
isulad_
kit
_pid
;
pid_t
isulad_
img
_pid
;
if
(
conf
==
NULL
)
{
ERROR
(
"Invalid arguments"
);
...
...
@@ -430,7 +430,7 @@ void *isula_image_server_monitor(void *arg)
goto
pexit
;
}
nret
=
pthread_create
(
&
wp_thread
,
NULL
,
heartbeat_for_isulad_
kit
,
NULL
);
nret
=
pthread_create
(
&
wp_thread
,
NULL
,
heartbeat_for_isulad_
img
,
NULL
);
if
(
nret
!=
0
)
{
ERROR
(
"Create heartbeat thread failed: %s"
,
strerror
(
nret
));
goto
pexit
;
...
...
@@ -446,42 +446,42 @@ void *isula_image_server_monitor(void *arg)
retry:
remove_old_socket_file
();
isulad_
kit
_pid
=
(
pid_t
)
-
1
;
isulad_
img
_pid
=
(
pid_t
)
-
1
;
// First, fork new process to run image server binary.
nret
=
load_isula_image_server
(
conf
,
retry_flag
,
&
isulad_
kit
_pid
);
nret
=
load_isula_image_server
(
conf
,
retry_flag
,
&
isulad_
img
_pid
);
if
(
nret
!=
0
)
{
if
(
!
retry_flag
)
{
ERROR
(
"First start isulad
kit
failed"
);
ERROR
(
"First start isulad
img
failed"
);
goto
pexit
;
}
WARN
(
"Load isula image server failed"
);
}
retry_flag
=
true
;
if
(
isulad_
kit
_pid
==
(
pid_t
)
-
1
)
{
if
(
isulad_
img
_pid
==
(
pid_t
)
-
1
)
{
usleep_nointerupt
(
HALF_A_SECOND
);
goto
retry
;
}
/* waitpid for isulad
_kit
process */
nret
=
wait_for_pid
(
isulad_
kit
_pid
);
/* waitpid for isulad
-img
process */
nret
=
wait_for_pid
(
isulad_
img
_pid
);
if
(
nret
!=
0
)
{
SYSERROR
(
"Wait isulad
kit
failed"
);
SYSERROR
(
"Wait isulad
img
failed"
);
}
/* clean old isulad
_kit
information */
/* clean old isulad
-img
information */
if
(
pthread_mutex_lock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Lock isulad
kit
pid failed"
);
ERROR
(
"Lock isulad
img
pid failed"
);
}
g_isulad_
kit
_start_time
=
0
;
g_isulad_
kit
_pid
=
-
1
;
if
(
g_isula_
kit
_exit
)
{
g_isulad_
img
_start_time
=
0
;
g_isulad_
img
_pid
=
-
1
;
if
(
g_isula_
img
_exit
)
{
(
void
)
pthread_mutex_unlock
(
&
g_mutex
);
goto
pexit
;
}
if
(
pthread_mutex_unlock
(
&
g_mutex
)
!=
0
)
{
ERROR
(
"Unlock isulad
kit
pid failed"
);
ERROR
(
"Unlock isulad
img
pid failed"
);
}
usleep_nointerupt
(
HALF_A_SECOND
);
...
...
src/image/oci/run_image_server.h
浏览文件 @
46ff577a
...
...
@@ -29,7 +29,7 @@ struct server_monitor_conf {
void
*
isula_image_server_monitor
(
void
*
arg
);
void
isula_
kit
_exit
();
void
isula_
img
_exit
();
#ifdef __cplusplus
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录