diff --git a/Dockerfile b/Dockerfile index feb476cdd9b4b9f9ca079aed844724a604c1fff6..d575a485a1b38f2da7fc700cbc12e43f5a6d1e27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ diff --git a/iSulad.spec b/iSulad.spec index df788d31298314e9ff4653b72d5734151e766f75..699bad3ffe3682b35d89e697eb63f76a06abf398 100644 --- a/iSulad.spec +++ b/iSulad.spec @@ -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 diff --git a/src/image/oci/global_config.c b/src/image/oci/global_config.c index f18f04cea679fe894bbc74caf95af327394f68dc..0b09e1f037f0b2128e394916cb5190ceb8e1859e 100644 --- a/src/image/oci/global_config.c +++ b/src/image/oci/global_config.c @@ -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)) { diff --git a/src/image/oci/isula_image.c b/src/image/oci/isula_image.c index f4a3e621337416cdef87e320f906f80f4b23e5b4..77ac4ab520d69a61b96e3ab15af83a5b6c6a2c4f 100644 --- a/src/image/oci/isula_image.c +++ b/src/image/oci/isula_image.c @@ -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 isulad-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"); diff --git a/src/image/oci/run_image_server.c b/src/image/oci/run_image_server.c index bab6f5050e1db4aeb677e13b611ef674e406bafd..e9ba60a29a681d274010f8312cdca1672380ac6d 100644 --- a/src/image/oci/run_image_server.c +++ b/src/image/oci/run_image_server.c @@ -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 isulad-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); diff --git a/src/image/oci/run_image_server.h b/src/image/oci/run_image_server.h index 9e08a1ec347523ff4d6ff80adaf32e4eda4171c9..2f3cd78c5efe32d8f0551806a5904ba458226059 100644 --- a/src/image/oci/run_image_server.h +++ b/src/image/oci/run_image_server.h @@ -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 }