sync openeuler
Signed-off-by: Grooooot <isula@huawei.com>
This commit is contained in:
parent
8b32f11d19
commit
e61a5e351e
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required (VERSION 3.12.1)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
project (lcrd)
|
project (isulad)
|
||||||
|
|
||||||
include(cmake/helper.cmake)
|
include(cmake/helper.cmake)
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ execute_process(
|
|||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
message("-- commit id: " ${GIT_COMMIT_HASH})
|
message("-- commit id: " ${GIT_COMMIT_HASH})
|
||||||
add_definitions(-DLCRD_GIT_COMMIT="${GIT_COMMIT_HASH}")
|
add_definitions(-DISULAD_GIT_COMMIT="${GIT_COMMIT_HASH}")
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND sh -c "date --rfc-3339 ns | sed -e 's/ /T/'"
|
COMMAND sh -c "date --rfc-3339 ns | sed -e 's/ /T/'"
|
||||||
@ -25,13 +25,13 @@ execute_process(
|
|||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
message("-- build time: " ${BUILD_DATE})
|
message("-- build time: " ${BUILD_DATE})
|
||||||
add_definitions(-DLCRD_BUILD_TIME="${BUILD_DATE}")
|
add_definitions(-DISULAD_BUILD_TIME="${BUILD_DATE}")
|
||||||
|
|
||||||
if (NOT LCRD_ROOT_PATH)
|
if (NOT ISULAD_ROOT_PATH)
|
||||||
add_definitions(-DLCRD_ROOT_PATH="/var/lib/lcrd")
|
add_definitions(-DISULAD_ROOT_PATH="/var/lib/isulad")
|
||||||
endif()
|
endif()
|
||||||
if (NOT LCRD_STATE_PATH)
|
if (NOT ISULAD_STATE_PATH)
|
||||||
add_definitions(-DLCRD_STATE_PATH="/var/run/lcrd")
|
add_definitions(-DISULAD_STATE_PATH="/var/run/isulad")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LIB_INSTALL_DIR)
|
if (LIB_INSTALL_DIR)
|
||||||
@ -52,8 +52,8 @@ configure_file(
|
|||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/lcrd.pc.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/isulad.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/conf/lcrd.pc"
|
"${CMAKE_BINARY_DIR}/conf/isulad.pc"
|
||||||
)
|
)
|
||||||
|
|
||||||
# parse .proto files
|
# parse .proto files
|
||||||
@ -85,20 +85,20 @@ IF(ENABLE_LLT)
|
|||||||
ENDIF(ENABLE_LLT)
|
ENDIF(ENABLE_LLT)
|
||||||
|
|
||||||
# install all files
|
# install all files
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/conf/lcrd.pc
|
install(FILES ${CMAKE_BINARY_DIR}/conf/isulad.pc
|
||||||
DESTINATION ${LIB_INSTALL_DIR_DEFAULT}/pkgconfig PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
DESTINATION ${LIB_INSTALL_DIR_DEFAULT}/pkgconfig PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||||
install(FILES src/liblcrc.h
|
install(FILES src/libisula.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
install(FILES src/connect/client/lcrc_connect.h
|
install(FILES src/connect/client/isula_connect.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
install(FILES src/container_def.h
|
install(FILES src/container_def.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
install(FILES src/types_def.h
|
install(FILES src/types_def.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
install(FILES src/error.h
|
install(FILES src/error.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
install(FILES src/engines/engine.h
|
install(FILES src/engines/engine.h
|
||||||
DESTINATION include/lcrd)
|
DESTINATION include/isulad)
|
||||||
|
|
||||||
# install config files
|
# install config files
|
||||||
set(conf_prefix "/etc")
|
set(conf_prefix "/etc")
|
||||||
@ -108,12 +108,12 @@ endif()
|
|||||||
install(FILES src/contrib/config/daemon.json
|
install(FILES src/contrib/config/daemon.json
|
||||||
DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||||
install(FILES src/contrib/config/config.json src/contrib/config/systemcontainer_config.json
|
install(FILES src/contrib/config/config.json src/contrib/config/systemcontainer_config.json
|
||||||
DESTINATION ${conf_prefix}/default/lcrd PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
DESTINATION ${conf_prefix}/default/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||||
install(FILES src/contrib/config/seccomp_default.json
|
install(FILES src/contrib/config/seccomp_default.json
|
||||||
DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
DESTINATION ${conf_prefix}/isulad PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||||
install(FILES src/contrib/config/hooks/default.json
|
install(FILES src/contrib/config/hooks/default.json
|
||||||
DESTINATION ${conf_prefix}/default/lcrd/hooks PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
DESTINATION ${conf_prefix}/default/isulad/hooks PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||||
install(FILES src/contrib/sysmonitor/isulad-check.sh
|
install(FILES src/contrib/sysmonitor/isulad-check.sh
|
||||||
DESTINATION ${conf_prefix}/default/lcrd PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
DESTINATION ${conf_prefix}/default/isulad PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
||||||
install(FILES src/contrib/sysmonitor/isulad-monit
|
install(FILES src/contrib/sysmonitor/isulad-monit
|
||||||
DESTINATION ${conf_prefix}/sysmonitor/process PERMISSIONS OWNER_READ OWNER_WRITE)
|
DESTINATION ${conf_prefix}/sysmonitor/process PERMISSIONS OWNER_READ OWNER_WRITE)
|
||||||
|
|||||||
262
Dockerfile
Normal file
262
Dockerfile
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
#######################################################################
|
||||||
|
##- @Copyright (C) Huawei Technologies., Ltd. 2019. All rights reserved.
|
||||||
|
# - lcr licensed under the Mulan PSL v1.
|
||||||
|
# - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||||
|
# - You may obtain a copy of Mulan PSL v1 at:
|
||||||
|
# - http://license.coscl.org.cn/MulanPSL
|
||||||
|
# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||||
|
# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||||
|
# - PURPOSE.
|
||||||
|
# - See the Mulan PSL v1 for more details.
|
||||||
|
##- @Description: prepare compile container envrionment
|
||||||
|
##- @Author: lifeng
|
||||||
|
##- @Create: 2020-01-10
|
||||||
|
#######################################################################
|
||||||
|
# This file describes the isulad compile container image.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# docker build --build-arg http_proxy=YOUR_HTTP_PROXY_IF_NEEDED \
|
||||||
|
# --build-arg https_proxy=YOUR_HTTPS_PROXY_IF_NEEDED \
|
||||||
|
# -t YOUR_IMAGE_NAME -f ./Dockerfile .
|
||||||
|
|
||||||
|
|
||||||
|
FROM centos:7.6.1810
|
||||||
|
MAINTAINER LiFeng <lifeng68huawei.com>
|
||||||
|
|
||||||
|
# Install dependency package
|
||||||
|
RUN yum clean all && yum swap -y fakesystemd systemd && \
|
||||||
|
yum install -y epel-release \
|
||||||
|
yum update -y && \
|
||||||
|
yum install -y automake \
|
||||||
|
autoconf \
|
||||||
|
libtool \
|
||||||
|
make \
|
||||||
|
cmake \
|
||||||
|
which \
|
||||||
|
gdb \
|
||||||
|
strace \
|
||||||
|
rpm-build \
|
||||||
|
graphviz \
|
||||||
|
libcap \
|
||||||
|
libcap-devel \
|
||||||
|
libxslt \
|
||||||
|
docbook2X \
|
||||||
|
libselinux \
|
||||||
|
libselinux-devel \
|
||||||
|
libseccomp \
|
||||||
|
libseccomp-devel \
|
||||||
|
yajl-devel \
|
||||||
|
git \
|
||||||
|
bridge-utils \
|
||||||
|
dnsmasq \
|
||||||
|
libcgroup \
|
||||||
|
rsync \
|
||||||
|
iptables \
|
||||||
|
iproute \
|
||||||
|
net-tools \
|
||||||
|
unzip \
|
||||||
|
tar \
|
||||||
|
wget \
|
||||||
|
gtest \
|
||||||
|
gtest-devel \
|
||||||
|
gmock \
|
||||||
|
gmock-devel \
|
||||||
|
cppcheck \
|
||||||
|
python \
|
||||||
|
python-pip \
|
||||||
|
libcurl-devel \
|
||||||
|
zlib-devel \
|
||||||
|
glibc-headers \
|
||||||
|
openssl-devel \
|
||||||
|
gcc \
|
||||||
|
gcc-c++ \
|
||||||
|
hostname \
|
||||||
|
sqlite-devel \
|
||||||
|
gpgme \
|
||||||
|
gpgme-devel \
|
||||||
|
expect \
|
||||||
|
systemd-devel \
|
||||||
|
systemd-libs \
|
||||||
|
go \
|
||||||
|
CUnit \
|
||||||
|
CUnit-devel \
|
||||||
|
valgrind \
|
||||||
|
e2fsprogs
|
||||||
|
|
||||||
|
RUN pip install xlrd
|
||||||
|
|
||||||
|
RUN yum clean all && \
|
||||||
|
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; \
|
||||||
|
do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
|
rm -f /etc/systemd/system/*.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> /etc/bashrc && \
|
||||||
|
echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH" >> /etc/bashrc && \
|
||||||
|
echo "/usr/lib" >> /etc/ld.so.conf && \
|
||||||
|
echo "/usr/local/lib" >> /etc/ld.so.conf
|
||||||
|
|
||||||
|
|
||||||
|
# disalbe sslverify
|
||||||
|
RUN git config --global http.sslverify false
|
||||||
|
|
||||||
|
# Centos has no protobuf, protobuf-devel, grpc, grpc-devel, grpc-plugin
|
||||||
|
# and we should install them manually.
|
||||||
|
# install protobuf
|
||||||
|
RUN set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/protobuf.git && \
|
||||||
|
cd protobuf && \
|
||||||
|
tar -xzvf protobuf-all-3.9.0.tar.gz && \
|
||||||
|
cd protobuf-3.9.0 && \
|
||||||
|
./autogen.sh && \
|
||||||
|
./configure && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install c-ares
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/c-ares.git && \
|
||||||
|
cd c-ares && \
|
||||||
|
tar -xzvf c-ares-1.15.0.tar.gz && \
|
||||||
|
cd c-ares-1.15.0 && \
|
||||||
|
autoreconf -if && \
|
||||||
|
./configure --enable-shared --disable-dependency-tracking && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install grpc
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/grpc.git && \
|
||||||
|
cd grpc && \
|
||||||
|
tar -xzvf grpc-1.22.0.tar.gz && \
|
||||||
|
cd grpc-1.22.0 && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install libevent
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/libevent.git && \
|
||||||
|
cd libevent && \
|
||||||
|
tar -xzvf libevent-2.1.11-stable.tar.gz && \
|
||||||
|
cd libevent-2.1.11-stable && \
|
||||||
|
./autogen.sh && \
|
||||||
|
./configure && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install libevhtp
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/libevhtp.git && \
|
||||||
|
cd libevhtp && \
|
||||||
|
tar -xzvf libevhtp-1.2.16.tar.gz && \
|
||||||
|
cd libevhtp-1.2.16 && \
|
||||||
|
patch -p1 -F1 -s < ../0001-support-dynamic-threads.patch && \
|
||||||
|
patch -p1 -F1 -s < ../0002-close-openssl.patch && \
|
||||||
|
rm -rf build && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake -D EVHTP_BUILD_SHARED=on -D EVHTP_DISABLE_SSL=on ../ && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install http-parser
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/http-parser.git && \
|
||||||
|
cd http-parser && \
|
||||||
|
tar -xzvf http-parser-2.9.2.tar.gz && \
|
||||||
|
cd http-parser-2.9.2 && \
|
||||||
|
make -j CFLAGS="-Wno-error" && \
|
||||||
|
make CFLAGS="-Wno-error" install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install libwebsockets
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/libwebsockets.git && \
|
||||||
|
cd libwebsockets && \
|
||||||
|
tar -xzvf libwebsockets-2.4.2.tar.gz && \
|
||||||
|
cd libwebsockets-2.4.2 && \
|
||||||
|
patch -p1 -F1 -s < ../libwebsockets-fix-coredump.patch && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake -DLWS_WITH_SSL=0 -DLWS_MAX_SMP=32 -DCMAKE_BUILD_TYPE=Debug ../ && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install lxc
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/src-openeuler/lxc.git && \
|
||||||
|
cd lxc && \
|
||||||
|
./apply-patches && \
|
||||||
|
cd lxc-3.0.3 && \
|
||||||
|
./autogen.sh && \
|
||||||
|
./configure && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install lcr
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/openeuler/lcr.git && \
|
||||||
|
cd lcr && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake ../ && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install clibcni
|
||||||
|
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
|
||||||
|
set -x && \
|
||||||
|
cd ~ && \
|
||||||
|
git clone https://gitee.com/openeuler/clibcni.git && \
|
||||||
|
cd clibcni && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake ../ && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# install iSulad-kit
|
||||||
|
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 && \
|
||||||
|
./apply-patch && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
VOLUME [ "/sys/fs/cgroup" ]
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
16
README.md
16
README.md
@ -17,43 +17,43 @@ yum install -y iSulad
|
|||||||
### Run
|
### Run
|
||||||
We provide `systemd` service to start `iSulad`
|
We provide `systemd` service to start `iSulad`
|
||||||
```sh
|
```sh
|
||||||
systemd start lcrd # run the server with systemd command
|
systemd start isulad # run the server with systemd command
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use direct command to start `iSulad` server:
|
You can use direct command to start `iSulad` server:
|
||||||
```sh
|
```sh
|
||||||
$ sudo lcrd # run the server with default socket name and default log level and images manage function
|
$ sudo isulad # run the server with default socket name and default log level and images manage function
|
||||||
```
|
```
|
||||||
### Operations on containers:
|
### Operations on containers:
|
||||||
`iSulad` provides command line `lcrd` to talk with server.
|
`iSulad` provides command line `isulad` to talk with server.
|
||||||
Here are some sample commands to manager containers.
|
Here are some sample commands to manager containers.
|
||||||
|
|
||||||
List all containers in your own environment:
|
List all containers in your own environment:
|
||||||
```sh
|
```sh
|
||||||
# list containers
|
# list containers
|
||||||
$ sudo lcrc ps -a
|
$ sudo isula ps -a
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a container with busybox named `test`
|
Create a container with busybox named `test`
|
||||||
```sh
|
```sh
|
||||||
# create a container 'test' with image busybox
|
# create a container 'test' with image busybox
|
||||||
$ sudo lcrc create -t -n test busybox
|
$ sudo isula create -t -n test busybox
|
||||||
```
|
```
|
||||||
|
|
||||||
Start this container `test`
|
Start this container `test`
|
||||||
```sh
|
```sh
|
||||||
# start the container 'test'
|
# start the container 'test'
|
||||||
$ sudo lcrc start test
|
$ sudo isula start test
|
||||||
```
|
```
|
||||||
Kill the container `test`
|
Kill the container `test`
|
||||||
```sh
|
```sh
|
||||||
# kill the container 'test'
|
# kill the container 'test'
|
||||||
$ sudo lcrc kill test
|
$ sudo isula kill test
|
||||||
```
|
```
|
||||||
Remove the container `test`
|
Remove the container `test`
|
||||||
```sh
|
```sh
|
||||||
# remove the container 'test'
|
# remove the container 'test'
|
||||||
$ sudo lcrc rm test
|
$ sudo isula rm test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build from source
|
### Build from source
|
||||||
|
|||||||
@ -26,22 +26,22 @@ if (ENABLE_OPENSSL_VERIFY STREQUAL "ON")
|
|||||||
set(OPENSSL_VERIFY 1)
|
set(OPENSSL_VERIFY 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(PACKAGE "set lcrd package" ON)
|
option(PACKAGE "set isulad package" ON)
|
||||||
if (PACKAGE STREQUAL "ON")
|
if (PACKAGE STREQUAL "ON")
|
||||||
set(LCRD_PACKAGE "iSulad")
|
set(ISULAD_PACKAGE "iSulad")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(VERSION "set lcrd version" ON)
|
option(VERSION "set isulad version" ON)
|
||||||
if (VERSION STREQUAL "ON")
|
if (VERSION STREQUAL "ON")
|
||||||
set(LCRD_VERSION "1.1.5")
|
set(ISULAD_VERSION "1.1.9")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(DEBUG "set lcrd gcc option" ON)
|
option(DEBUG "set isulad gcc option" ON)
|
||||||
if (DEBUG STREQUAL "ON")
|
if (DEBUG STREQUAL "ON")
|
||||||
add_definitions("-g -O2")
|
add_definitions("-g -O2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(GCOV "set lcrd gcov option" OFF)
|
option(GCOV "set isulad gcov option" OFF)
|
||||||
if (GCOV STREQUAL "ON")
|
if (GCOV STREQUAL "ON")
|
||||||
set(ISULAD_GCOV "ON")
|
set(ISULAD_GCOV "ON")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
# set common FLAGS
|
# set common FLAGS
|
||||||
set(CMAKE_C_FLAGS "-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror -rdynamic")
|
set(CMAKE_C_FLAGS "-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror -rdynamic")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
|
||||||
|
|
||||||
if (GRPC_CONNECTOR OR ENABLE_OCI_IMAGE)
|
if (GRPC_CONNECTOR OR ENABLE_OCI_IMAGE)
|
||||||
set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror")
|
set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIE -pie -shared -pthread")
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIE -pie -shared -pthread")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIE -pie")
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIE -pie")
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
#cmakedefine VERSION "@LCRD_VERSION@"
|
#cmakedefine VERSION "@ISULAD_VERSION@"
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
## Install Dependencies
|
# Build iSulad from source
|
||||||
|
|
||||||
|
If you intend to contribute on iSulad. Thanks for your effort. Every contribution is very appreciated for us.
|
||||||
|
|
||||||
|
## Build iSulad based on openEuler distribution
|
||||||
|
|
||||||
|
If you use the openEuler distribution, you can easily install various dependent packages via yum.
|
||||||
|
|
||||||
|
### Install Dependencies
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ sudo yum install -y cmake gcc-c++ systemd-devel yajl-devel libcurl libcurl-devel clibcni clibcni-devel protobuf-devel grpc-devel grpc-plugins http-parser-devel libwebsockets-devel libevhtp-devel libevent-devel lcr lxc-devel
|
$ sudo yum install -y cmake gcc-c++ systemd-devel yajl-devel libcurl libcurl-devel clibcni clibcni-devel protobuf-devel grpc-devel grpc-plugins http-parser-devel libwebsockets-devel libevhtp-devel libevent-devel lcr lxc-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Build steps:
|
||||||
|
|
||||||
## Build steps:
|
|
||||||
|
|
||||||
Run the cmds under the iSulad source directory
|
Run the cmds under the iSulad source directory
|
||||||
```sh
|
```sh
|
||||||
@ -17,3 +23,52 @@ $ sudo make
|
|||||||
$ sudo make install
|
$ sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Via Docker container
|
||||||
|
|
||||||
|
#### Build image
|
||||||
|
|
||||||
|
You can build `iSulad` via a Linux-based Docker container. You can build an image from the`Dockerfile` in the source directory. From the iSulad source root directory you can run the following command to make your image.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sudo docker build --build-arg http_proxy=YOUR_HTTP_PROXY_IF_NEED
|
||||||
|
--build-arg https_proxy=YOUR_HTTPS_PROXY_IF_NEED \
|
||||||
|
-t YOUR_IMAGE_NAME -f ./Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Prepare root directory for the iSulad
|
||||||
|
|
||||||
|
Let's prepare a root directory on host, and we will mount this directory into the container. This directory be used by `iSulad` in container.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sudo mkdir -p /var/lib/isulad
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Build iSulad in container
|
||||||
|
|
||||||
|
Let's suppose that you built an image called `iSulad:dev`.
|
||||||
|
|
||||||
|
Then from the iSulad source root directory you can run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sudo docker run -tid --name YOUR_CONTAINER_NAME -v /var/lib/isulad:/var/lib/isulad -v `pwd`:/src/isulad --privileged iSulad:dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's suppose that you run an container named `iSulad_build`. Then you can use the following commands to build iSulad in your container `iSulad_build`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
// enter the container
|
||||||
|
$ sudo docker exec -it iSulad_build bash
|
||||||
|
// Now you enter the container, so build iSulad in the container by following commands
|
||||||
|
# cd /src/isulad
|
||||||
|
# mkdir build
|
||||||
|
# cd build
|
||||||
|
# cmake ..
|
||||||
|
# make
|
||||||
|
# make install
|
||||||
|
```
|
||||||
|
|
||||||
|
Now You can use direct command to start `iSulad` server in the container:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sudo isulad # run the server with default socket name and default log level and images manage function
|
||||||
|
```
|
||||||
|
|||||||
115
iSulad.spec
115
iSulad.spec
@ -1,5 +1,5 @@
|
|||||||
%global _version 1.1.5
|
%global _version 1.1.9
|
||||||
%global _release 20200106.022952.git939935db
|
%global _release 20200120.104710.gitdf7191f2
|
||||||
%global is_systemd 1
|
%global is_systemd 1
|
||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
|
|
||||||
@ -8,14 +8,14 @@ Version: %{_version}
|
|||||||
Release: %{_release}
|
Release: %{_release}
|
||||||
Summary: Lightweight Container Runtime Daemon
|
Summary: Lightweight Container Runtime Daemon
|
||||||
License: Mulan PSL v1
|
License: Mulan PSL v1
|
||||||
URL: lcrd
|
URL: isulad
|
||||||
Source: iSulad-1.0.tar.gz
|
Source: iSulad-1.0.tar.gz
|
||||||
BuildRoot: {_tmppath}/iSulad-%{version}
|
BuildRoot: {_tmppath}/iSulad-%{version}
|
||||||
ExclusiveArch: x86_64 aarch64
|
ExclusiveArch: x86_64 aarch64
|
||||||
|
|
||||||
%ifarch x86_64 aarch64
|
%ifarch x86_64 aarch64
|
||||||
Provides: libhttpclient.so()(64bit)
|
Provides: libhttpclient.so()(64bit)
|
||||||
Provides: liblcrc.so()(64bit)
|
Provides: libisula.so()(64bit)
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
@ -60,120 +60,139 @@ cd build
|
|||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
cd build
|
cd build
|
||||||
install -d $RPM_BUILD_ROOT/%{_libdir}
|
install -d $RPM_BUILD_ROOT/%{_libdir}
|
||||||
install -m 0644 ./src/liblcrc.so %{buildroot}/%{_libdir}/liblcrc.so
|
install -m 0644 ./src/libisula.so %{buildroot}/%{_libdir}/libisula.so
|
||||||
install -m 0644 ./src/http/libhttpclient.so %{buildroot}/%{_libdir}/libhttpclient.so
|
install -m 0644 ./src/http/libhttpclient.so %{buildroot}/%{_libdir}/libhttpclient.so
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
|
install -d $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
|
||||||
install -m 0640 ./conf/lcrd.pc %{buildroot}/%{_libdir}/pkgconfig/lcrd.pc
|
install -m 0640 ./conf/isulad.pc %{buildroot}/%{_libdir}/pkgconfig/isulad.pc
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_bindir}
|
install -d $RPM_BUILD_ROOT/%{_bindir}
|
||||||
install -m 0755 ./src/lcrc %{buildroot}/%{_bindir}/lcrc
|
install -m 0755 ./src/isula %{buildroot}/%{_bindir}/isula
|
||||||
install -m 0755 ./src/lcrd %{buildroot}/%{_bindir}/lcrd
|
install -m 0755 ./src/isulad %{buildroot}/%{_bindir}/isulad
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_includedir}/lcrd
|
install -d $RPM_BUILD_ROOT/%{_includedir}/isulad
|
||||||
install -m 0644 ../src/liblcrc.h %{buildroot}/%{_includedir}/lcrd/liblcrc.h
|
install -m 0644 ../src/libisula.h %{buildroot}/%{_includedir}/isulad/libisula.h
|
||||||
install -m 0644 ../src/connect/client/lcrc_connect.h %{buildroot}/%{_includedir}/lcrd/lcrc_connect.h
|
install -m 0644 ../src/connect/client/isula_connect.h %{buildroot}/%{_includedir}/isulad/isula_connect.h
|
||||||
install -m 0644 ../src/container_def.h %{buildroot}/%{_includedir}/lcrd/container_def.h
|
install -m 0644 ../src/container_def.h %{buildroot}/%{_includedir}/isulad/container_def.h
|
||||||
install -m 0644 ../src/types_def.h %{buildroot}/%{_includedir}/lcrd/types_def.h
|
install -m 0644 ../src/types_def.h %{buildroot}/%{_includedir}/isulad/types_def.h
|
||||||
install -m 0644 ../src/error.h %{buildroot}/%{_includedir}/lcrd/error.h
|
install -m 0644 ../src/error.h %{buildroot}/%{_includedir}/isulad/error.h
|
||||||
install -m 0644 ../src/engines/engine.h %{buildroot}/%{_includedir}/lcrd/engine.h
|
install -m 0644 ../src/engines/engine.h %{buildroot}/%{_includedir}/isulad/engine.h
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/isulad
|
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/isulad
|
||||||
install -m 0640 ../src/contrib/config/daemon.json %{buildroot}/%{_sysconfdir}/isulad/daemon.json
|
install -m 0640 ../src/contrib/config/daemon.json %{buildroot}/%{_sysconfdir}/isulad/daemon.json
|
||||||
install -m 0640 ../src/contrib/config/seccomp_default.json %{buildroot}/%{_sysconfdir}/isulad/seccomp_default.json
|
install -m 0640 ../src/contrib/config/seccomp_default.json %{buildroot}/%{_sysconfdir}/isulad/seccomp_default.json
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/lcrd
|
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/isulad
|
||||||
install -m 0640 ../src/contrib/config/config.json %{buildroot}/%{_sysconfdir}/default/lcrd/config.json
|
install -m 0640 ../src/contrib/config/config.json %{buildroot}/%{_sysconfdir}/default/isulad/config.json
|
||||||
install -m 0640 ../src/contrib/config/systemcontainer_config.json %{buildroot}/%{_sysconfdir}/default/lcrd/systemcontainer_config.json
|
install -m 0640 ../src/contrib/config/systemcontainer_config.json %{buildroot}/%{_sysconfdir}/default/isulad/systemcontainer_config.json
|
||||||
install -m 0550 ../src/contrib/sysmonitor/isulad-check.sh %{buildroot}/%{_sysconfdir}/default/lcrd/isulad-check.sh
|
install -m 0550 ../src/contrib/sysmonitor/isulad-check.sh %{buildroot}/%{_sysconfdir}/default/isulad/isulad-check.sh
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysmonitor/process
|
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysmonitor/process
|
||||||
cp ../src/contrib/sysmonitor/isulad-monit $RPM_BUILD_ROOT/etc/sysmonitor/process
|
cp ../src/contrib/sysmonitor/isulad-monit $RPM_BUILD_ROOT/etc/sysmonitor/process
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/lcrd/hooks
|
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/default/isulad/hooks
|
||||||
install -m 0640 ../src/contrib/config/hooks/default.json %{buildroot}/%{_sysconfdir}/default/lcrd/hooks/default.json
|
install -m 0640 ../src/contrib/config/hooks/default.json %{buildroot}/%{_sysconfdir}/default/isulad/hooks/default.json
|
||||||
|
|
||||||
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
|
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
|
||||||
install -p -m 0640 ../src/contrib/config/iSulad.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/iSulad
|
install -p -m 0640 ../src/contrib/config/iSulad.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/iSulad
|
||||||
|
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
install -d $RPM_BUILD_ROOT/%{_unitdir}
|
install -d $RPM_BUILD_ROOT/%{_unitdir}
|
||||||
install -p -m 0640 ../src/contrib/init/lcrd.service $RPM_BUILD_ROOT/%{_unitdir}/lcrd.service
|
install -p -m 0640 ../src/contrib/init/isulad.service $RPM_BUILD_ROOT/%{_unitdir}/isulad.service
|
||||||
%else
|
%else
|
||||||
install -d $RPM_BUILD_ROOT/%{_initddir}
|
install -d $RPM_BUILD_ROOT/%{_initddir}
|
||||||
install -p -m 0640 ../src/contrib/init/lcrd.init $RPM_BUILD_ROOT/%{_initddir}/lcrd.init
|
install -p -m 0640 ../src/contrib/init/isulad.init $RPM_BUILD_ROOT/%{_initddir}/isulad.init
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
%pre
|
||||||
|
# support update from lcrd to isulad, will remove in next version
|
||||||
|
%if 0%{?is_systemd}
|
||||||
|
systemctl stop lcrd
|
||||||
|
systemctl disable lcrd
|
||||||
|
if [ -e %{_sysconfdir}/isulad/daemon.json ];then
|
||||||
|
sed -i 's#/etc/default/lcrd/hooks#/etc/default/isulad/hooks#g' %{_sysconfdir}/isulad/daemon.json
|
||||||
|
fi
|
||||||
|
%else
|
||||||
|
/sbin/chkconfig --del lcrd
|
||||||
|
%endif
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if ! getent group lcrd > /dev/null; then
|
if ! getent group isulad > /dev/null; then
|
||||||
groupadd --system lcrd
|
groupadd --system isulad
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "1" ]; then
|
if [ "$1" = "1" ]; then
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
systemctl enable lcrd
|
systemctl enable isulad
|
||||||
systemctl start lcrd
|
systemctl start isulad
|
||||||
%else
|
%else
|
||||||
/sbin/chkconfig --add lcrd
|
/sbin/chkconfig --add isulad
|
||||||
%endif
|
%endif
|
||||||
elif [ "$1" = "2" ]; then
|
elif [ "$1" = "2" ]; then
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
systemctl status lcrd | grep 'Active:' | grep 'running'
|
# support update from lcrd to isulad, will remove in next version
|
||||||
|
if [ -e %{_unitdir}/lcrd.service.rpmsave ]; then
|
||||||
|
mv %{_unitdir}/lcrd.service.rpmsave %{_unitdir}/isulad.service
|
||||||
|
sed -i 's/lcrd/isulad/g' %{_unitdir}/isulad.service
|
||||||
|
fi
|
||||||
|
systemctl status isulad | grep 'Active:' | grep 'running'
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
systemctl restart lcrd
|
systemctl restart isulad
|
||||||
|
else
|
||||||
|
systemctl start isulad
|
||||||
fi
|
fi
|
||||||
%else
|
%else
|
||||||
/sbin/service lcrd status | grep 'Active:' | grep 'running'
|
/sbin/service isulad status | grep 'Active:' | grep 'running'
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/sbin/service lcrd restart
|
/sbin/service isulad restart
|
||||||
fi
|
fi
|
||||||
%endif
|
%endif
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! getent group lcrd > /dev/null; then
|
if ! getent group isulad > /dev/null; then
|
||||||
groupadd --system lcrd
|
groupadd --system isulad
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
%systemd_preun lcrd
|
%systemd_preun isulad
|
||||||
%else
|
%else
|
||||||
if [ $1 -eq 0 ] ; then
|
if [ $1 -eq 0 ] ; then
|
||||||
/sbin/service lcrd stop >/dev/null 2>&1
|
/sbin/service isulad stop >/dev/null 2>&1
|
||||||
/sbin/chkconfig --del lcrd
|
/sbin/chkconfig --del isulad
|
||||||
fi
|
fi
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
%systemd_postun_with_restart lcrd
|
%systemd_postun_with_restart isulad
|
||||||
%else
|
%else
|
||||||
if [ "$1" -ge "1" ] ; then
|
if [ "$1" -ge "1" ] ; then
|
||||||
/sbin/service lcrd condrestart >/dev/null 2>&1 || :
|
/sbin/service isulad condrestart >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%attr(0600,root,root) %{_sysconfdir}/sysmonitor/process/isulad-monit
|
%attr(0600,root,root) %{_sysconfdir}/sysmonitor/process/isulad-monit
|
||||||
%attr(0550,root,root) %{_sysconfdir}/default/lcrd/isulad-check.sh
|
%attr(0550,root,root) %{_sysconfdir}/default/isulad/isulad-check.sh
|
||||||
%defattr(0640,root,root,0750)
|
%defattr(0640,root,root,0750)
|
||||||
%{_sysconfdir}/isulad
|
%{_sysconfdir}/isulad
|
||||||
%{_sysconfdir}/isulad/*
|
%{_sysconfdir}/isulad/*
|
||||||
%{_sysconfdir}/default/*
|
%{_sysconfdir}/default/*
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
%{_unitdir}/lcrd.service
|
%{_unitdir}/isulad.service
|
||||||
%attr(0640,root,root) %{_unitdir}/lcrd.service
|
%attr(0640,root,root) %{_unitdir}/isulad.service
|
||||||
%else
|
%else
|
||||||
%{_initddir}/lcrd.init
|
%{_initddir}/isulad.init
|
||||||
%attr(0640,root,root) %{_initddir}/lcrd.init
|
%attr(0640,root,root) %{_initddir}/isulad.init
|
||||||
%endif
|
%endif
|
||||||
%{_includedir}/lcrd/*
|
%{_includedir}/isulad/*
|
||||||
%attr(0755,root,root) %{_libdir}/pkgconfig
|
%attr(0755,root,root) %{_libdir}/pkgconfig
|
||||||
%attr(0640,root,root) %{_libdir}/pkgconfig/lcrd.pc
|
%attr(0640,root,root) %{_libdir}/pkgconfig/isulad.pc
|
||||||
%defattr(0550,root,root,0750)
|
%defattr(0550,root,root,0750)
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_libdir}/*
|
%{_libdir}/*
|
||||||
@ -183,7 +202,7 @@ fi
|
|||||||
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/iSulad
|
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/iSulad
|
||||||
%config(noreplace,missingok) %{_sysconfdir}/isulad/daemon.json
|
%config(noreplace,missingok) %{_sysconfdir}/isulad/daemon.json
|
||||||
%if 0%{?is_systemd}
|
%if 0%{?is_systemd}
|
||||||
%config(noreplace,missingok) %{_unitdir}/lcrd.service
|
%config(noreplace,missingok) %{_unitdir}/isulad.service
|
||||||
%else
|
%else
|
||||||
%config(noreplace,missingok) %{_initddir}/lcrd.init
|
%config(noreplace,missingok) %{_initddir}/isulad.init
|
||||||
%endif
|
%endif
|
||||||
|
|||||||
@ -3,10 +3,10 @@ libdir=@CMAKE_INSTALL_PREFIX@/lib
|
|||||||
localstatedir=@CMAKE_INSTALL_PREFIX@/var
|
localstatedir=@CMAKE_INSTALL_PREFIX@/var
|
||||||
includedir=@CMAKE_INSTALL_PREFIX@/include
|
includedir=@CMAKE_INSTALL_PREFIX@/include
|
||||||
|
|
||||||
Name: liblcrc
|
Name: libisula
|
||||||
Description: light-weighted container runtime daemon library
|
Description: light-weighted container runtime daemon library
|
||||||
Version: @LCRD_VERSION@
|
Version: @ISULAD_VERSION@
|
||||||
URL: iSulad
|
URL: iSulad
|
||||||
Libs: -L@CMAKE_INSTALL_PREFIX@/lib -llcrc
|
Libs: -L@CMAKE_INSTALL_PREFIX@/lib -lisula
|
||||||
Cflags: -I@CMAKE_INSTALL_PREFIX@/include
|
Cflags: -I@CMAKE_INSTALL_PREFIX@/include
|
||||||
|
|
||||||
@ -103,47 +103,47 @@ list(REMOVE_DUPLICATES SHARED_SRCS)
|
|||||||
|
|
||||||
add_subdirectory(http)
|
add_subdirectory(http)
|
||||||
|
|
||||||
# ------ build liblcrc ------
|
# ------ build libisula ------
|
||||||
if (OPENSSL_VERIFY)
|
if (OPENSSL_VERIFY)
|
||||||
list(APPEND CONNECTOR ${CMAKE_CURRENT_SOURCE_DIR}/http/certificate.c)
|
list(APPEND CONNECTOR ${CMAKE_CURRENT_SOURCE_DIR}/http/certificate.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(liblcrc ${LIBTYPE}
|
add_library(libisula ${LIBTYPE}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/liblcrc.c
|
${CMAKE_CURRENT_SOURCE_DIR}/libisula.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/pack_config.c
|
${CMAKE_CURRENT_SOURCE_DIR}/pack_config.c
|
||||||
${CONNECTOR}
|
${CONNECTOR}
|
||||||
${SHARED_SRCS}
|
${SHARED_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(liblcrc PUBLIC
|
target_include_directories(libisula PUBLIC
|
||||||
${SHARED_INCS}
|
${SHARED_INCS}
|
||||||
${CONNECTOR_INCS}
|
${CONNECTOR_INCS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/http
|
${CMAKE_CURRENT_SOURCE_DIR}/http
|
||||||
)
|
)
|
||||||
|
|
||||||
# set liblcrc FLAGS
|
# set libisula FLAGS
|
||||||
set_target_properties(liblcrc PROPERTIES PREFIX "")
|
set_target_properties(libisula PROPERTIES PREFIX "")
|
||||||
target_link_libraries(liblcrc ${LIBYAJL_LIBRARY} ${LIBSECUREC_LIBRARY})
|
target_link_libraries(libisula ${LIBYAJL_LIBRARY} ${LIBSECUREC_LIBRARY})
|
||||||
|
|
||||||
if (GRPC_CONNECTOR)
|
if (GRPC_CONNECTOR)
|
||||||
target_link_libraries(liblcrc -Wl,--as-needed -lstdc++ -lcrypto)
|
target_link_libraries(libisula -Wl,--as-needed -lstdc++ -lcrypto)
|
||||||
target_link_libraries(liblcrc -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
target_link_libraries(libisula -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
||||||
target_link_libraries(liblcrc -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
target_link_libraries(libisula -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
||||||
else()
|
else()
|
||||||
target_link_libraries(liblcrc ${EVHTP_LIBRARY} ${EVENT_LIBRARY} ${ZLIB_LIBRARY} -ldl libhttpclient)
|
target_link_libraries(libisula ${EVHTP_LIBRARY} ${EVENT_LIBRARY} ${ZLIB_LIBRARY} -ldl libhttpclient)
|
||||||
endif()
|
endif()
|
||||||
# ------ build liblcrc finish -----
|
# ------ build libisula finish -----
|
||||||
|
|
||||||
add_subdirectory(cmd)
|
add_subdirectory(cmd)
|
||||||
# ------ build lcrc -------
|
# ------ build isula -------
|
||||||
add_executable(lcrc
|
add_executable(isula
|
||||||
${LCRC_SRCS}
|
${ISULA_SRCS}
|
||||||
)
|
)
|
||||||
target_include_directories(lcrc PUBLIC ${LCRC_INCS} ${SHARED_INCS})
|
target_include_directories(isula PUBLIC ${ISULA_INCS} ${SHARED_INCS})
|
||||||
target_link_libraries(lcrc liblcrc -lpthread)
|
target_link_libraries(isula libisula -lpthread)
|
||||||
# ------ build lcrc finish -------
|
# ------ build isula finish -------
|
||||||
|
|
||||||
# ------ build lcrd -------
|
# ------ build isulad -------
|
||||||
add_subdirectory(services)
|
add_subdirectory(services)
|
||||||
add_subdirectory(image)
|
add_subdirectory(image)
|
||||||
add_subdirectory(runtime)
|
add_subdirectory(runtime)
|
||||||
@ -170,9 +170,9 @@ add_subdirectory(plugin)
|
|||||||
add_subdirectory(map)
|
add_subdirectory(map)
|
||||||
add_subdirectory(config)
|
add_subdirectory(config)
|
||||||
|
|
||||||
add_executable(lcrd
|
add_executable(isulad
|
||||||
${CONNECT_SOCKET} ${SHARED_SRCS}
|
${CONNECT_SOCKET} ${SHARED_SRCS}
|
||||||
${LCRD_SRCS} ${SERVICES_SRCS}
|
${ISULAD_SRCS} ${SERVICES_SRCS}
|
||||||
${HTTP_SRCS}
|
${HTTP_SRCS}
|
||||||
${ENGINES_SRCS}
|
${ENGINES_SRCS}
|
||||||
${IMAGE_SRCS}
|
${IMAGE_SRCS}
|
||||||
@ -181,19 +181,19 @@ add_executable(lcrd
|
|||||||
${MAP_SRCS} ${CONFIG_SRCS}
|
${MAP_SRCS} ${CONFIG_SRCS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/filters.c
|
${CMAKE_CURRENT_SOURCE_DIR}/filters.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/namespace.c
|
${CMAKE_CURRENT_SOURCE_DIR}/namespace.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/liblcrd.c
|
${CMAKE_CURRENT_SOURCE_DIR}/libisulad.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sysctl_tools.c
|
${CMAKE_CURRENT_SOURCE_DIR}/sysctl_tools.c
|
||||||
${WEBSOCKET_SERVICE_SRCS}
|
${WEBSOCKET_SERVICE_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(lcrd PUBLIC
|
target_include_directories(isulad PUBLIC
|
||||||
${SHARED_INCS}
|
${SHARED_INCS}
|
||||||
${CONNECT_SOCKET_INCS}
|
${CONNECT_SOCKET_INCS}
|
||||||
${SERVICES_INCS}
|
${SERVICES_INCS}
|
||||||
${IMAGE_INCS}
|
${IMAGE_INCS}
|
||||||
${RUNTIME_INCS}
|
${RUNTIME_INCS}
|
||||||
${ENGINES_INCS}
|
${ENGINES_INCS}
|
||||||
${LCRD_INCS}
|
${ISULAD_INCS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/plugin
|
${CMAKE_CURRENT_SOURCE_DIR}/plugin
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/map
|
${CMAKE_CURRENT_SOURCE_DIR}/map
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/config
|
${CMAKE_CURRENT_SOURCE_DIR}/config
|
||||||
@ -201,41 +201,41 @@ target_include_directories(lcrd PUBLIC
|
|||||||
${WEBSOCKET_SERVICE_INCS}
|
${WEBSOCKET_SERVICE_INCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(lcrd ${LIBYAJL_LIBRARY} ${LIBSECUREC_LIBRARY} ${SYSTEMD_LIBRARY})
|
target_link_libraries(isulad ${LIBYAJL_LIBRARY} ${LIBSECUREC_LIBRARY} ${SYSTEMD_LIBRARY})
|
||||||
target_link_libraries(lcrd -ldl ${ZLIB_LIBRARY} -lpthread libhttpclient)
|
target_link_libraries(isulad -ldl ${ZLIB_LIBRARY} -lpthread libhttpclient)
|
||||||
if (ENABLE_EMBEDDED_IMAGE)
|
if (ENABLE_EMBEDDED_IMAGE)
|
||||||
target_link_libraries(lcrd ${SQLITE3_LIBRARY})
|
target_link_libraries(isulad ${SQLITE3_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GRPC_CONNECTOR)
|
if (GRPC_CONNECTOR)
|
||||||
message("GRPC iSulad")
|
message("GRPC iSulad")
|
||||||
target_link_libraries(lcrd -Wl,--as-needed -lstdc++ -lcrypto)
|
target_link_libraries(isulad -Wl,--as-needed -lstdc++ -lcrypto)
|
||||||
target_link_libraries(lcrd -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
target_link_libraries(isulad -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
||||||
target_link_libraries(lcrd -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
target_link_libraries(isulad -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
||||||
target_link_libraries(lcrd ${CLIBCNI_LIBRARY} ${WEBSOCKET_LIBRARY})
|
target_link_libraries(isulad ${CLIBCNI_LIBRARY} ${WEBSOCKET_LIBRARY})
|
||||||
else()
|
else()
|
||||||
message("Restful iSulad")
|
message("Restful iSulad")
|
||||||
target_link_libraries(lcrd ${EVHTP_LIBRARY} ${EVENT_LIBRARY})
|
target_link_libraries(isulad ${EVHTP_LIBRARY} ${EVENT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_OCI_IMAGE)
|
if (ENABLE_OCI_IMAGE)
|
||||||
target_link_libraries(lcrd -Wl,--as-needed -lstdc++)
|
target_link_libraries(isulad -Wl,--as-needed -lstdc++)
|
||||||
target_link_libraries(lcrd -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
target_link_libraries(isulad -Wl,--as-needed ${PROTOBUF_LIBRARY})
|
||||||
target_link_libraries(lcrd -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
target_link_libraries(isulad -Wl,--no-as-needed ${GRPC_PP_REFLECTION_LIBRARY} ${GRPC_PP_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ISULAD_GCOV)
|
if (ISULAD_GCOV)
|
||||||
target_link_libraries(lcrc -lgcov)
|
target_link_libraries(isula -lgcov)
|
||||||
target_link_libraries(liblcrc -lgcov)
|
target_link_libraries(libisula -lgcov)
|
||||||
target_link_libraries(lcrd -lgcov)
|
target_link_libraries(isulad -lgcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ------ build lcrd finish -------
|
# ------ build isulad finish -------
|
||||||
|
|
||||||
# ------ install binary --------
|
# ------ install binary --------
|
||||||
install(TARGETS liblcrc
|
install(TARGETS libisula
|
||||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR_DEFAULT} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR_DEFAULT} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
||||||
install(TARGETS lcrc
|
install(TARGETS isula
|
||||||
RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
||||||
install(TARGETS lcrd
|
install(TARGETS isulad
|
||||||
RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// #######################################################################
|
// #######################################################################
|
||||||
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019. All rights reserved.
|
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019-2020. All rights reserved.
|
||||||
// # - iSulad licensed under the Mulan PSL v1.
|
// # - iSulad licensed under the Mulan PSL v1.
|
||||||
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||||
// # - You may obtain a copy of Mulan PSL v1 at:
|
// # - You may obtain a copy of Mulan PSL v1 at:
|
||||||
@ -10,8 +10,28 @@
|
|||||||
// # - See the Mulan PSL v1 for more details.
|
// # - See the Mulan PSL v1 for more details.
|
||||||
// ##- @Description: generate grpc
|
// ##- @Description: generate grpc
|
||||||
// ##- @Author: wujing
|
// ##- @Author: wujing
|
||||||
// ##- @Create: 2019-04-25
|
// ##- @Create: 2020-01-26
|
||||||
// #######################################################################
|
// #######################################################################
|
||||||
|
|
||||||
|
/*
|
||||||
|
Since some of this code is derived from Kubernetes, their copyright
|
||||||
|
is retained here....
|
||||||
|
|
||||||
|
Copyright 2018 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
// To regenerate api.pb.go run hack/update-generated-runtime.sh
|
// To regenerate api.pb.go run hack/update-generated-runtime.sh
|
||||||
syntax = 'proto3';
|
syntax = 'proto3';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// #######################################################################
|
// #######################################################################
|
||||||
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019. All rights reserved.
|
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019-2020. All rights reserved.
|
||||||
// # - iSulad licensed under the Mulan PSL v1.
|
// # - iSulad licensed under the Mulan PSL v1.
|
||||||
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||||
// # - You may obtain a copy of Mulan PSL v1 at:
|
// # - You may obtain a copy of Mulan PSL v1 at:
|
||||||
@ -9,9 +9,30 @@
|
|||||||
// # - PURPOSE.
|
// # - PURPOSE.
|
||||||
// # - See the Mulan PSL v1 for more details.
|
// # - See the Mulan PSL v1 for more details.
|
||||||
// ##- @Description: generate grpc
|
// ##- @Description: generate grpc
|
||||||
// ##- @Author: wujing
|
// ##- @Author: tanyifeng
|
||||||
// ##- @Create: 2019-04-25
|
// ##- @Create: 2020-01-16
|
||||||
// #######################################################################
|
// #######################################################################
|
||||||
|
//
|
||||||
|
// Since some of this code is derived from grpc, their copyright
|
||||||
|
// is retained here....
|
||||||
|
//
|
||||||
|
// Copyright 2015 The gRPC Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
// The canonical version of this proto can be found at
|
||||||
|
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
|
||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option optimize_for = CODE_SIZE;
|
option optimize_for = CODE_SIZE;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// #######################################################################
|
// #######################################################################
|
||||||
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019. All rights reserved.
|
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019-2020. All rights reserved.
|
||||||
// # - iSulad licensed under the Mulan PSL v1.
|
// # - iSulad licensed under the Mulan PSL v1.
|
||||||
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||||
// # - You may obtain a copy of Mulan PSL v1 at:
|
// # - You may obtain a copy of Mulan PSL v1 at:
|
||||||
@ -10,8 +10,29 @@
|
|||||||
// # - See the Mulan PSL v1 for more details.
|
// # - See the Mulan PSL v1 for more details.
|
||||||
// ##- @Description: generate grpc
|
// ##- @Description: generate grpc
|
||||||
// ##- @Author: wujing
|
// ##- @Author: wujing
|
||||||
// ##- @Create: 2019-04-25
|
// ##- @Create: 2020-01-16
|
||||||
// #######################################################################
|
// #######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Since some of this code is derived from containerd, their copyright
|
||||||
|
is retained here....
|
||||||
|
|
||||||
|
Copyright 2013-2016 Docker, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option optimize_for = CODE_SIZE;
|
option optimize_for = CODE_SIZE;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// #######################################################################
|
// #######################################################################
|
||||||
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019. All rights reserved.
|
// ##- @Copyright (C) Huawei Technologies., Ltd. 2019-2020. All rights reserved.
|
||||||
// # - iSulad licensed under the Mulan PSL v1.
|
// # - iSulad licensed under the Mulan PSL v1.
|
||||||
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
// # - You can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||||
// # - You may obtain a copy of Mulan PSL v1 at:
|
// # - You may obtain a copy of Mulan PSL v1 at:
|
||||||
@ -10,8 +10,28 @@
|
|||||||
// # - See the Mulan PSL v1 for more details.
|
// # - See the Mulan PSL v1 for more details.
|
||||||
// ##- @Description: generate grpc
|
// ##- @Description: generate grpc
|
||||||
// ##- @Author: wujing
|
// ##- @Author: wujing
|
||||||
// ##- @Create: 2019-04-25
|
// ##- @Create: 2019-01-16
|
||||||
// #######################################################################
|
// #######################################################################
|
||||||
|
|
||||||
|
/*
|
||||||
|
Since some of this code is derived from containerd, their copyright
|
||||||
|
is retained here....
|
||||||
|
|
||||||
|
Copyright 2013-2016 Docker, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option optimize_for = CODE_SIZE;
|
option optimize_for = CODE_SIZE;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
# get current directory sources files
|
# get current directory sources files
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} comm_srcs)
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} comm_srcs)
|
||||||
|
|
||||||
add_subdirectory(lcrc)
|
add_subdirectory(isula)
|
||||||
set(LCRC_SRCS ${comm_srcs} ${CMD_LCRC_SRCS} PARENT_SCOPE)
|
set(ISULA_SRCS ${comm_srcs} ${CMD_ISULA_SRCS} PARENT_SCOPE)
|
||||||
set(LCRC_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${CMD_LCRC_INCS} PARENT_SCOPE)
|
set(ISULA_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${CMD_ISULA_INCS} PARENT_SCOPE)
|
||||||
|
|
||||||
add_subdirectory(lcrd)
|
add_subdirectory(isulad)
|
||||||
set(LCRD_SRCS ${comm_srcs} ${CMD_LCRD_SRCS} PARENT_SCOPE)
|
set(ISULAD_SRCS ${comm_srcs} ${CMD_ISULAD_SRCS} PARENT_SCOPE)
|
||||||
set(LCRD_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${CMD_LCRD_INCS} PARENT_SCOPE)
|
set(ISULAD_INCS ${CMAKE_CURRENT_SOURCE_DIR} ${CMD_ISULAD_INCS} PARENT_SCOPE)
|
||||||
|
|||||||
@ -21,14 +21,14 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "liblcrd.h"
|
#include "libisulad.h"
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
void command_help_lcrd_head()
|
void command_help_isulad_head()
|
||||||
{
|
{
|
||||||
fprintf(stdout, "lcrd\n\nlightweight container runtime daemon\n");
|
fprintf(stdout, "isulad\n\nlightweight container runtime daemon\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int compare_options(const void *s1, const void *s2)
|
int compare_options(const void *s1, const void *s2)
|
||||||
@ -93,8 +93,8 @@ void command_help(command_t *self)
|
|||||||
progname++;
|
progname++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->type != NULL && strcmp(self->type, "lcrd") == 0) {
|
if (self->type != NULL && strcmp(self->type, "isulad") == 0) {
|
||||||
command_help_lcrd_head();
|
command_help_isulad_head();
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\nUsage: %s %s\n\n", progname, self->usage);
|
fprintf(stdout, "\nUsage: %s %s\n\n", progname, self->usage);
|
||||||
fprintf(stdout, "%s\n\n", self->description);
|
fprintf(stdout, "%s\n\n", self->description);
|
||||||
|
|||||||
@ -4,19 +4,19 @@ add_subdirectory(information)
|
|||||||
add_subdirectory(extend)
|
add_subdirectory(extend)
|
||||||
add_subdirectory(stream)
|
add_subdirectory(stream)
|
||||||
add_subdirectory(images)
|
add_subdirectory(images)
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_srcs)
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_srcs)
|
||||||
|
|
||||||
set(CMD_LCRC_SRCS
|
set(CMD_ISULA_SRCS
|
||||||
${lcrc_srcs}
|
${isula_srcs}
|
||||||
${LCRC_BASE_SRCS}
|
${ISULA_BASE_SRCS}
|
||||||
${LCRC_EXTEND_SRCS}
|
${ISULA_EXTEND_SRCS}
|
||||||
${LCRC_IMAGES_SRCS}
|
${ISULA_IMAGES_SRCS}
|
||||||
${LCRC_INFORMATION_SRCS}
|
${ISULA_INFORMATION_SRCS}
|
||||||
${LCRC_STREAM_SRCS}
|
${ISULA_STREAM_SRCS}
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMD_LCRC_INCS
|
set(CMD_ISULA_INCS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/base
|
${CMAKE_CURRENT_SOURCE_DIR}/base
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/extend
|
${CMAKE_CURRENT_SOURCE_DIR}/extend
|
||||||
@ -252,7 +252,7 @@ void print_common_help()
|
|||||||
void client_print_error(uint32_t cc, uint32_t server_errono, const char *errmsg)
|
void client_print_error(uint32_t cc, uint32_t server_errono, const char *errmsg)
|
||||||
{
|
{
|
||||||
switch (server_errono) {
|
switch (server_errono) {
|
||||||
case LCRD_SUCCESS:
|
case ISULAD_SUCCESS:
|
||||||
if (errmsg != NULL) {
|
if (errmsg != NULL) {
|
||||||
COMMAND_ERROR("%s", errmsg);
|
COMMAND_ERROR("%s", errmsg);
|
||||||
}
|
}
|
||||||
@ -13,8 +13,8 @@
|
|||||||
* Description: provide container client arguments definition
|
* Description: provide container client arguments definition
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef __LCRC_ARGUMENTS_H
|
#ifndef __ISULA_ARGUMENTS_H
|
||||||
#define __LCRC_ARGUMENTS_H
|
#define __ISULA_ARGUMENTS_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#include "commander.h"
|
#include "commander.h"
|
||||||
#include "container_def.h"
|
#include "container_def.h"
|
||||||
#include "json_common.h"
|
#include "json_common.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
/* max arguments can be specify in client */
|
/* max arguments can be specify in client */
|
||||||
#define MAX_CLIENT_ARGS 1000
|
#define MAX_CLIENT_ARGS 1000
|
||||||
@ -231,7 +231,7 @@ struct client_arguments {
|
|||||||
/* notes: we should free the mem in custom_conf by hand */
|
/* notes: we should free the mem in custom_conf by hand */
|
||||||
struct custom_configs custom_conf;
|
struct custom_configs custom_conf;
|
||||||
|
|
||||||
// lcrc run;
|
// isula run;
|
||||||
bool detach;
|
bool detach;
|
||||||
|
|
||||||
bool interactive;
|
bool interactive;
|
||||||
@ -342,7 +342,7 @@ extern int client_arguments_init(struct client_arguments *args);
|
|||||||
|
|
||||||
extern void client_arguments_free(struct client_arguments *args);
|
extern void client_arguments_free(struct client_arguments *args);
|
||||||
|
|
||||||
extern void lcrd_screen_print(uint32_t cc, uint32_t server_errono,
|
extern void isulad_screen_print(uint32_t cc, uint32_t server_errono,
|
||||||
struct client_arguments *args);
|
struct client_arguments *args);
|
||||||
|
|
||||||
|
|
||||||
@ -350,5 +350,5 @@ extern void client_print_error(uint32_t cc, uint32_t server_errono, const char *
|
|||||||
|
|
||||||
extern client_connect_config_t get_connect_config(const struct client_arguments *args);
|
extern client_connect_config_t get_connect_config(const struct client_arguments *args);
|
||||||
|
|
||||||
#endif /* __LCRC_ARGUMENTS_H */
|
#endif /* __ISULA_ARGUMENTS_H */
|
||||||
|
|
||||||
7
src/cmd/isula/base/CMakeLists.txt
Normal file
7
src/cmd/isula/base/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_base_srcs)
|
||||||
|
|
||||||
|
set(ISULA_BASE_SRCS
|
||||||
|
${isula_base_srcs}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
@ -28,10 +28,10 @@
|
|||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "create.h"
|
#include "create.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "pull.h"
|
#include "pull.h"
|
||||||
#include "liblcrd.h"
|
#include "libisulad.h"
|
||||||
|
|
||||||
const char g_cmd_create_desc[] = "Create a new container";
|
const char g_cmd_create_desc[] = "Create a new container";
|
||||||
const char g_cmd_create_usage[] = "create [OPTIONS] --external-rootfs=PATH|IMAGE [COMMAND] [ARG...]";
|
const char g_cmd_create_usage[] = "create [OPTIONS] --external-rootfs=PATH|IMAGE [COMMAND] [ARG...]";
|
||||||
@ -48,7 +48,7 @@ struct client_arguments g_cmd_create_args = {
|
|||||||
.custom_conf.health_retries = 0,
|
.custom_conf.health_retries = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void request_pack_host_config_limit(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_config_limit(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* pids limit */
|
/* pids limit */
|
||||||
if (args->custom_conf.pids_limit != 0) {
|
if (args->custom_conf.pids_limit != 0) {
|
||||||
@ -60,7 +60,7 @@ static void request_pack_host_config_limit(const struct client_arguments *args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_host_config_storage_opts(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static int request_pack_host_config_storage_opts(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
@ -95,7 +95,7 @@ static int request_pack_host_config_storage_opts(const struct client_arguments *
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_host_config_sysctls(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static int request_pack_host_config_sysctls(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
@ -127,7 +127,7 @@ static int request_pack_host_config_sysctls(const struct client_arguments *args,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_host_config_cgroup(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static int request_pack_host_config_cgroup(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -177,7 +177,7 @@ static int request_pack_host_config_cgroup(const struct client_arguments *args,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int util_env_set_lcrd_enable_plugins(char ***penv, const size_t *penv_len, const char *names)
|
static int util_env_set_isulad_enable_plugins(char ***penv, const size_t *penv_len, const char *names)
|
||||||
{
|
{
|
||||||
size_t env_len;
|
size_t env_len;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
@ -193,14 +193,14 @@ static int util_env_set_lcrd_enable_plugins(char ***penv, const size_t *penv_len
|
|||||||
env = *penv;
|
env = *penv;
|
||||||
env_len = *penv_len;
|
env_len = *penv_len;
|
||||||
|
|
||||||
arr[0] = LCRD_ENABLE_PLUGINS;
|
arr[0] = ISULAD_ENABLE_PLUGINS;
|
||||||
arr[1] = "=";
|
arr[1] = "=";
|
||||||
arr[2] = names;
|
arr[2] = names;
|
||||||
len = 3;
|
len = 3;
|
||||||
|
|
||||||
val = util_env_get_val(env, env_len, LCRD_ENABLE_PLUGINS, strlen(LCRD_ENABLE_PLUGINS));
|
val = util_env_get_val(env, env_len, ISULAD_ENABLE_PLUGINS, strlen(ISULAD_ENABLE_PLUGINS));
|
||||||
if (val != NULL && strlen(val) != 0) {
|
if (val != NULL && strlen(val) != 0) {
|
||||||
arr[3] = LCRD_ENABLE_PLUGINS_SEPERATOR;
|
arr[3] = ISULAD_ENABLE_PLUGINS_SEPERATOR;
|
||||||
arr[4] = val;
|
arr[4] = val;
|
||||||
len = 5;
|
len = 5;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ static int util_env_set_lcrd_enable_plugins(char ***penv, const size_t *penv_len
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (util_env_set_val(penv, penv_len, LCRD_ENABLE_PLUGINS, strlen(LCRD_ENABLE_PLUGINS), kv)) {
|
if (util_env_set_val(penv, penv_len, ISULAD_ENABLE_PLUGINS, strlen(ISULAD_ENABLE_PLUGINS), kv)) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ failed:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_custom_env(struct client_arguments *args, lcrc_container_config_t *conf)
|
static int request_pack_custom_env(struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *pe = NULL;
|
char *pe = NULL;
|
||||||
@ -244,10 +244,10 @@ static int request_pack_custom_env(struct client_arguments *args, lcrc_container
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args->custom_conf.accel != NULL) {
|
if (args->custom_conf.accel != NULL) {
|
||||||
pe = util_env_get_val(conf->env, conf->env_len, LCRD_ENABLE_PLUGINS, strlen(LCRD_ENABLE_PLUGINS));
|
pe = util_env_get_val(conf->env, conf->env_len, ISULAD_ENABLE_PLUGINS, strlen(ISULAD_ENABLE_PLUGINS));
|
||||||
if (pe == NULL) {
|
if (pe == NULL) {
|
||||||
if (util_array_append(&conf->env, LCRD_ENABLE_PLUGINS "=")) {
|
if (util_array_append(&conf->env, ISULAD_ENABLE_PLUGINS "=")) {
|
||||||
COMMAND_ERROR("init env LCRD_ENABLE_PLUGINS failed");
|
COMMAND_ERROR("init env ISULAD_ENABLE_PLUGINS failed");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ static int request_pack_custom_env(struct client_arguments *args, lcrc_container
|
|||||||
|
|
||||||
conf->accel = args->custom_conf.accel;
|
conf->accel = args->custom_conf.accel;
|
||||||
conf->accel_len = util_array_len((const char **)(args->custom_conf.accel));
|
conf->accel_len = util_array_len((const char **)(args->custom_conf.accel));
|
||||||
if (util_env_set_lcrd_enable_plugins(&conf->env, &conf->env_len, LCRD_ISULA_ADAPTER)) {
|
if (util_env_set_isulad_enable_plugins(&conf->env, &conf->env_len, ISULAD_ISULA_ADAPTER)) {
|
||||||
COMMAND_ERROR("init accel env failed");
|
COMMAND_ERROR("init accel env failed");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
@ -315,7 +315,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_env_from_file(const char *path, size_t file_size, lcrc_container_config_t *conf)
|
static int read_env_from_file(const char *path, size_t file_size, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
@ -365,7 +365,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_env_variables_to_conf(const char *env_file, lcrc_container_config_t *conf)
|
static int append_env_variables_to_conf(const char *env_file, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t file_size;
|
size_t file_size;
|
||||||
@ -392,7 +392,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_custom_env_file(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static int request_pack_custom_env_file(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -414,7 +414,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_user(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_user(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.user != NULL) {
|
if (args->custom_conf.user != NULL) {
|
||||||
conf->user = args->custom_conf.user;
|
conf->user = args->custom_conf.user;
|
||||||
@ -423,7 +423,7 @@ static void request_pack_custom_user(const struct client_arguments *args, lcrc_c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_hostname(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_hostname(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.hostname != NULL) {
|
if (args->custom_conf.hostname != NULL) {
|
||||||
conf->hostname = args->custom_conf.hostname;
|
conf->hostname = args->custom_conf.hostname;
|
||||||
@ -432,7 +432,7 @@ static void request_pack_custom_hostname(const struct client_arguments *args, lc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_all_devices(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_all_devices(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
/* alldevices */
|
/* alldevices */
|
||||||
if (args->custom_conf.all_devices) {
|
if (args->custom_conf.all_devices) {
|
||||||
@ -441,7 +441,7 @@ static void request_pack_custom_all_devices(const struct client_arguments *args,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_system_container(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_system_container(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.system_container) {
|
if (args->custom_conf.system_container) {
|
||||||
conf->system_container = true;
|
conf->system_container = true;
|
||||||
@ -457,7 +457,7 @@ static void request_pack_custom_system_container(const struct client_arguments *
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_mounts(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_mounts(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.mounts != NULL) {
|
if (args->custom_conf.mounts != NULL) {
|
||||||
conf->mounts_len = util_array_len((const char **)(args->custom_conf.mounts));
|
conf->mounts_len = util_array_len((const char **)(args->custom_conf.mounts));
|
||||||
@ -466,7 +466,7 @@ static void request_pack_custom_mounts(const struct client_arguments *args, lcrc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_entrypoint(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_entrypoint(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.entrypoint != NULL) {
|
if (args->custom_conf.entrypoint != NULL) {
|
||||||
conf->entrypoint = args->custom_conf.entrypoint;
|
conf->entrypoint = args->custom_conf.entrypoint;
|
||||||
@ -475,7 +475,7 @@ static void request_pack_custom_entrypoint(const struct client_arguments *args,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_args(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_args(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->argc != 0 && args->argv != NULL) {
|
if (args->argc != 0 && args->argv != NULL) {
|
||||||
conf->cmd_len = (size_t)(args->argc);
|
conf->cmd_len = (size_t)(args->argc);
|
||||||
@ -485,7 +485,7 @@ static void request_pack_custom_args(const struct client_arguments *args, lcrc_c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_log_options(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_log_options(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->log_file != NULL) {
|
if (args->log_file != NULL) {
|
||||||
conf->log_file = args->log_file;
|
conf->log_file = args->log_file;
|
||||||
@ -498,13 +498,13 @@ static void request_pack_custom_log_options(const struct client_arguments *args,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_custom_log_accel(struct client_arguments *args, lcrc_container_config_t *conf)
|
static int request_pack_custom_log_accel(struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *accargs = NULL;
|
char *accargs = NULL;
|
||||||
|
|
||||||
if (conf->accel != NULL) {
|
if (conf->accel != NULL) {
|
||||||
accargs = util_string_join(LCRD_ISULA_ACCEL_ARGS_SEPERATOR, (const char **)conf->accel, conf->accel_len);
|
accargs = util_string_join(ISULAD_ISULA_ACCEL_ARGS_SEPERATOR, (const char **)conf->accel, conf->accel_len);
|
||||||
|
|
||||||
if (conf->annotations == NULL) {
|
if (conf->annotations == NULL) {
|
||||||
conf->annotations = util_common_calloc_s(sizeof(json_map_string_string));
|
conf->annotations = util_common_calloc_s(sizeof(json_map_string_string));
|
||||||
@ -515,7 +515,7 @@ static int request_pack_custom_log_accel(struct client_arguments *args, lcrc_con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = append_json_map_string_string(conf->annotations, LCRD_ISULA_ACCEL_ARGS, accargs);
|
ret = append_json_map_string_string(conf->annotations, ISULAD_ISULA_ACCEL_ARGS, accargs);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
COMMAND_ERROR("init accel annotations failed accel=%s", accargs);
|
COMMAND_ERROR("init accel annotations failed accel=%s", accargs);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -529,7 +529,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_work_dir(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_work_dir(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
/* work dir in container */
|
/* work dir in container */
|
||||||
if (args->custom_conf.workdir != NULL) {
|
if (args->custom_conf.workdir != NULL) {
|
||||||
@ -539,7 +539,7 @@ static void request_pack_custom_work_dir(const struct client_arguments *args, lc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_tty(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_tty(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
conf->tty = args->custom_conf.tty;
|
conf->tty = args->custom_conf.tty;
|
||||||
conf->open_stdin = args->custom_conf.open_stdin;
|
conf->open_stdin = args->custom_conf.open_stdin;
|
||||||
@ -550,7 +550,7 @@ static void request_pack_custom_tty(const struct client_arguments *args, lcrc_co
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_custom_health_check(const struct client_arguments *args, lcrc_container_config_t *conf)
|
static void request_pack_custom_health_check(const struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.health_cmd != NULL) {
|
if (args->custom_conf.health_cmd != NULL) {
|
||||||
conf->health_cmd = args->custom_conf.health_cmd;
|
conf->health_cmd = args->custom_conf.health_cmd;
|
||||||
@ -566,7 +566,7 @@ static void request_pack_custom_health_check(const struct client_arguments *args
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_custom_conf(struct client_arguments *args, lcrc_container_config_t *conf)
|
static int request_pack_custom_conf(struct client_arguments *args, isula_container_config_t *conf)
|
||||||
{
|
{
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -622,7 +622,7 @@ static int request_pack_custom_conf(struct client_arguments *args, lcrc_containe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_host_ns_change_files(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static int request_pack_host_ns_change_files(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@ -688,7 +688,7 @@ static int request_pack_host_ns_change_files(const struct client_arguments *args
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_caps(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_caps(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* cap add */
|
/* cap add */
|
||||||
if (args->custom_conf.cap_adds != NULL) {
|
if (args->custom_conf.cap_adds != NULL) {
|
||||||
@ -702,7 +702,7 @@ static void request_pack_host_caps(const struct client_arguments *args, lcrc_hos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_group_add(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_group_add(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* group add */
|
/* group add */
|
||||||
if (args->custom_conf.group_add != NULL) {
|
if (args->custom_conf.group_add != NULL) {
|
||||||
@ -711,7 +711,7 @@ static void request_pack_host_group_add(const struct client_arguments *args, lcr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_extra_hosts(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_extra_hosts(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* extra hosts */
|
/* extra hosts */
|
||||||
if (args->custom_conf.extra_hosts != NULL) {
|
if (args->custom_conf.extra_hosts != NULL) {
|
||||||
@ -720,7 +720,7 @@ static void request_pack_host_extra_hosts(const struct client_arguments *args, l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_dns(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_dns(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* dns */
|
/* dns */
|
||||||
if (args->custom_conf.dns != NULL) {
|
if (args->custom_conf.dns != NULL) {
|
||||||
@ -741,7 +741,7 @@ static void request_pack_host_dns(const struct client_arguments *args, lcrc_host
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_ulimit(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_ulimit(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* ulimit options */
|
/* ulimit options */
|
||||||
if (args->custom_conf.ulimits != NULL) {
|
if (args->custom_conf.ulimits != NULL) {
|
||||||
@ -750,7 +750,7 @@ static void request_pack_host_ulimit(const struct client_arguments *args, lcrc_h
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_weight_devices(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_weight_devices(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* blkio weight devices */
|
/* blkio weight devices */
|
||||||
if (args->custom_conf.weight_devices != NULL) {
|
if (args->custom_conf.weight_devices != NULL) {
|
||||||
@ -759,7 +759,7 @@ static void request_pack_host_weight_devices(const struct client_arguments *args
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_device_read_bps(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_device_read_bps(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.blkio_throttle_read_bps_device != NULL) {
|
if (args->custom_conf.blkio_throttle_read_bps_device != NULL) {
|
||||||
hostconfig->blkio_throttle_read_bps_device_len =
|
hostconfig->blkio_throttle_read_bps_device_len =
|
||||||
@ -768,7 +768,7 @@ static void request_pack_host_device_read_bps(const struct client_arguments *arg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_device_write_bps(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_device_write_bps(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
if (args->custom_conf.blkio_throttle_write_bps_device != NULL) {
|
if (args->custom_conf.blkio_throttle_write_bps_device != NULL) {
|
||||||
hostconfig->blkio_throttle_write_bps_device_len =
|
hostconfig->blkio_throttle_write_bps_device_len =
|
||||||
@ -777,14 +777,14 @@ static void request_pack_host_device_write_bps(const struct client_arguments *ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_blockio(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_blockio(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
request_pack_host_weight_devices(args, hostconfig);
|
request_pack_host_weight_devices(args, hostconfig);
|
||||||
request_pack_host_device_read_bps(args, hostconfig);
|
request_pack_host_device_read_bps(args, hostconfig);
|
||||||
request_pack_host_device_write_bps(args, hostconfig);
|
request_pack_host_device_write_bps(args, hostconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_devices(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_devices(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* devices */
|
/* devices */
|
||||||
if (args->custom_conf.devices != NULL) {
|
if (args->custom_conf.devices != NULL) {
|
||||||
@ -793,7 +793,7 @@ static void request_pack_host_devices(const struct client_arguments *args, lcrc_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_hugepage_limits(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_hugepage_limits(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* hugepage limits */
|
/* hugepage limits */
|
||||||
if (args->custom_conf.hugepage_limits != NULL) {
|
if (args->custom_conf.hugepage_limits != NULL) {
|
||||||
@ -802,7 +802,7 @@ static void request_pack_host_hugepage_limits(const struct client_arguments *arg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_binds(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_binds(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* volumes to binds */
|
/* volumes to binds */
|
||||||
if (args->custom_conf.volumes != NULL) {
|
if (args->custom_conf.volumes != NULL) {
|
||||||
@ -811,7 +811,7 @@ static void request_pack_host_binds(const struct client_arguments *args, lcrc_ho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_hook_spec(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_hook_spec(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* hook-spec file */
|
/* hook-spec file */
|
||||||
if (args->custom_conf.hook_spec != NULL) {
|
if (args->custom_conf.hook_spec != NULL) {
|
||||||
@ -819,14 +819,14 @@ static void request_pack_host_hook_spec(const struct client_arguments *args, lcr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_restart_policy(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_restart_policy(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
if (args->restart != NULL) {
|
if (args->restart != NULL) {
|
||||||
hostconfig->restart_policy = args->restart;
|
hostconfig->restart_policy = args->restart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_namespaces(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_namespaces(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
if (args->host_channel != NULL) {
|
if (args->host_channel != NULL) {
|
||||||
hostconfig->host_channel = args->host_channel;
|
hostconfig->host_channel = args->host_channel;
|
||||||
@ -849,7 +849,7 @@ static void request_pack_host_namespaces(const struct client_arguments *args, lc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pack_host_security(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static void request_pack_host_security(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
/* security opt */
|
/* security opt */
|
||||||
if (args->custom_conf.security != NULL) {
|
if (args->custom_conf.security != NULL) {
|
||||||
@ -858,7 +858,7 @@ static void request_pack_host_security(const struct client_arguments *args, lcrc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_pack_host_config(const struct client_arguments *args, lcrc_host_config_t *hostconfig)
|
static int request_pack_host_config(const struct client_arguments *args, isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -946,18 +946,18 @@ static int request_pack_host_config(const struct client_arguments *args, lcrc_ho
|
|||||||
|
|
||||||
#define IMAGE_NOT_FOUND_ERROR "No such image"
|
#define IMAGE_NOT_FOUND_ERROR "No such image"
|
||||||
|
|
||||||
static int do_client_create(const struct client_arguments *args, const lcrc_connect_ops *ops,
|
static int do_client_create(const struct client_arguments *args, const isula_connect_ops *ops,
|
||||||
const struct lcrc_create_request *request, struct lcrc_create_response *response)
|
const struct isula_create_request *request, struct isula_create_response *response)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
client_connect_config_t config = get_connect_config(args);
|
client_connect_config_t config = get_connect_config(args);
|
||||||
|
|
||||||
ret = ops->container.create(request, response, &config);
|
ret = ops->container.create(request, response, &config);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (response->cc == LCRD_ERR_INPUT) {
|
if (response->cc == ISULAD_ERR_INPUT) {
|
||||||
ret = EINVALIDARGS;
|
ret = EINVALIDARGS;
|
||||||
} else if (response->server_errono ||
|
} else if (response->server_errono ||
|
||||||
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(LCRD_ERR_CONNECT)))) {
|
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(ISULAD_ERR_CONNECT)))) {
|
||||||
ret = ESERVERERROR;
|
ret = ESERVERERROR;
|
||||||
} else {
|
} else {
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -966,14 +966,14 @@ static int do_client_create(const struct client_arguments *args, const lcrc_conn
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_try_to_create(const struct client_arguments *args, const struct lcrc_create_request *request,
|
static int client_try_to_create(const struct client_arguments *args, const struct isula_create_request *request,
|
||||||
struct lcrc_create_response **out_response)
|
struct isula_create_response **out_response)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_create_response *response = NULL;
|
struct isula_create_response *response = NULL;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_create_response));
|
response = util_common_calloc_s(sizeof(struct isula_create_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -1000,8 +1000,8 @@ static int client_try_to_create(const struct client_arguments *args, const struc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* retry create */
|
/* retry create */
|
||||||
lcrc_create_response_free(response);
|
isula_create_response_free(response);
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_create_response));
|
response = util_common_calloc_s(sizeof(struct isula_create_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -1018,14 +1018,14 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_alloced_memory_in_host_config(lcrc_host_config_t *hostconfig)
|
static void free_alloced_memory_in_host_config(isula_host_config_t *hostconfig)
|
||||||
{
|
{
|
||||||
lcrc_ns_change_files_free(hostconfig);
|
isula_ns_change_files_free(hostconfig);
|
||||||
lcrc_host_config_storage_opts_free(hostconfig);
|
isula_host_config_storage_opts_free(hostconfig);
|
||||||
lcrc_host_config_sysctl_free(hostconfig);
|
isula_host_config_sysctl_free(hostconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_alloced_memory_in_config(lcrc_container_config_t *custom_conf)
|
static void free_alloced_memory_in_config(isula_container_config_t *custom_conf)
|
||||||
{
|
{
|
||||||
if (custom_conf == NULL) {
|
if (custom_conf == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -1041,10 +1041,10 @@ static void free_alloced_memory_in_config(lcrc_container_config_t *custom_conf)
|
|||||||
int client_create(struct client_arguments *args)
|
int client_create(struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct lcrc_create_request request = { 0 };
|
struct isula_create_request request = { 0 };
|
||||||
struct lcrc_create_response *response = NULL;
|
struct isula_create_response *response = NULL;
|
||||||
lcrc_container_config_t custom_conf = { 0 };
|
isula_container_config_t custom_conf = { 0 };
|
||||||
lcrc_host_config_t host_config = { 0 };
|
isula_host_config_t host_config = { 0 };
|
||||||
container_cgroup_resources_t cr = { 0 };
|
container_cgroup_resources_t cr = { 0 };
|
||||||
|
|
||||||
request.name = args->name;
|
request.name = args->name;
|
||||||
@ -1081,7 +1081,7 @@ int client_create(struct client_arguments *args)
|
|||||||
out:
|
out:
|
||||||
free_alloced_memory_in_host_config(request.hostconfig);
|
free_alloced_memory_in_host_config(request.hostconfig);
|
||||||
free_alloced_memory_in_config(request.config);
|
free_alloced_memory_in_config(request.config);
|
||||||
lcrc_create_response_free(response);
|
isula_create_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "entrypoint", 0, &(cmdargs).custom_conf.entrypoint, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "entrypoint", 0, &(cmdargs).custom_conf.entrypoint, \
|
||||||
"Entrypoint to run when starting the container", NULL }, \
|
"Entrypoint to run when starting the container", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING, false, "external-rootfs", 0, &(cmdargs).external_rootfs, \
|
{ CMD_OPT_TYPE_STRING, false, "external-rootfs", 0, &(cmdargs).external_rootfs, \
|
||||||
"Specify the custom rootfs that is not managed by LCRD for the container, directory or block device", NULL }, \
|
"Specify the custom rootfs that is not managed by isulad for the container, directory or block device", NULL }, \
|
||||||
{ CMD_OPT_TYPE_CALLBACK, false, "files-limit", 0, &(cmdargs).custom_conf.files_limit, \
|
{ CMD_OPT_TYPE_CALLBACK, false, "files-limit", 0, &(cmdargs).custom_conf.files_limit, \
|
||||||
"Tune container files limit (set -1 for unlimited)", command_convert_llong }, \
|
"Tune container files limit (set -1 for unlimited)", command_convert_llong }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "hook-spec", 0, &(cmdargs).custom_conf.hook_spec, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "hook-spec", 0, &(cmdargs).custom_conf.hook_spec, \
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "kill.h"
|
#include "kill.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_kill_desc[] = "Kill one or more running containers";
|
const char g_cmd_kill_desc[] = "Kill one or more running containers";
|
||||||
const char g_cmd_kill_usage[] = "kill [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_kill_usage[] = "kill [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -29,12 +29,12 @@ static int client_kill(const struct client_arguments *args)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int signal = -1;
|
int signal = -1;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_kill_request request = { 0 };
|
struct isula_kill_request request = { 0 };
|
||||||
struct lcrc_kill_response *response = NULL;
|
struct isula_kill_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_kill_response));
|
response = util_common_calloc_s(sizeof(struct isula_kill_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Kill: Out of memory");
|
ERROR("Kill: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -65,7 +65,7 @@ static int client_kill(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_kill_response_free(response);
|
isula_kill_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_rename_desc[] = "Rename a container";
|
const char g_cmd_rename_desc[] = "Rename a container";
|
||||||
const char g_cmd_rename_usage[] =
|
const char g_cmd_rename_usage[] =
|
||||||
@ -27,9 +27,9 @@ struct client_arguments g_cmd_rename_args = { 0 };
|
|||||||
static int client_rename(const struct client_arguments *args)
|
static int client_rename(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_rename_request request = { 0 };
|
struct isula_rename_request request = { 0 };
|
||||||
struct lcrc_rename_response *response = NULL;
|
struct isula_rename_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(*response));
|
response = util_common_calloc_s(sizeof(*response));
|
||||||
@ -53,7 +53,7 @@ static int client_rename(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_rename_response_free(response);
|
isula_rename_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_restart_desc[] = "Restart one or more containers";
|
const char g_cmd_restart_desc[] = "Restart one or more containers";
|
||||||
const char g_cmd_restart_usage[] = "restart [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_restart_usage[] = "restart [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -31,12 +31,12 @@ struct client_arguments g_cmd_restart_args = {
|
|||||||
static int client_restart(const struct client_arguments *args)
|
static int client_restart(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_restart_request request = { 0 };
|
struct isula_restart_request request = { 0 };
|
||||||
struct lcrc_restart_response *response = NULL;
|
struct isula_restart_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_restart_response));
|
response = util_common_calloc_s(sizeof(struct isula_restart_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -57,7 +57,7 @@ static int client_restart(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_restart_response_free(response);
|
isula_restart_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "rm.h"
|
#include "rm.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@ -34,12 +34,12 @@ struct client_arguments g_cmd_delete_args = {
|
|||||||
static int client_delete(const struct client_arguments *args)
|
static int client_delete(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_delete_request request = { 0 };
|
struct isula_delete_request request = { 0 };
|
||||||
struct lcrc_delete_response *response = NULL;
|
struct isula_delete_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_delete_response));
|
response = util_common_calloc_s(sizeof(struct isula_delete_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("RM: Out of memory");
|
ERROR("RM: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -66,7 +66,7 @@ static int client_delete(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_delete_response_free(response);
|
isula_delete_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
@ -81,9 +81,9 @@ static int remote_cmd_start(const struct client_arguments *args, uint32_t *exit_
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool reset_tty = false;
|
bool reset_tty = false;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_start_request request = { 0 };
|
struct isula_start_request request = { 0 };
|
||||||
struct lcrc_start_response *response = NULL;
|
struct isula_start_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
struct termios oldtios;
|
struct termios oldtios;
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static int remote_cmd_start(const struct client_arguments *args, uint32_t *exit_
|
|||||||
request.attach_stdin = args->custom_conf.attach_stdin;
|
request.attach_stdin = args->custom_conf.attach_stdin;
|
||||||
request.attach_stdout = args->custom_conf.attach_stdout;
|
request.attach_stdout = args->custom_conf.attach_stdout;
|
||||||
request.attach_stderr = args->custom_conf.attach_stderr;
|
request.attach_stderr = args->custom_conf.attach_stderr;
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_start_response));
|
response = util_common_calloc_s(sizeof(struct isula_start_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -116,14 +116,14 @@ static int remote_cmd_start(const struct client_arguments *args, uint32_t *exit_
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
if (response->server_errono ||
|
if (response->server_errono ||
|
||||||
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(LCRD_ERR_CONNECT)))) {
|
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(ISULAD_ERR_CONNECT)))) {
|
||||||
ret = ESERVERERROR;
|
ret = ESERVERERROR;
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_start_response_free(response);
|
isula_start_response_free(response);
|
||||||
if (reset_tty && tcsetattr(0, TCSAFLUSH, &oldtios) < 0) {
|
if (reset_tty && tcsetattr(0, TCSAFLUSH, &oldtios) < 0) {
|
||||||
ERROR("Failed to reset terminal properties");
|
ERROR("Failed to reset terminal properties");
|
||||||
return -1;
|
return -1;
|
||||||
@ -134,9 +134,9 @@ out:
|
|||||||
static int do_resize_run_console(const struct client_arguments *args, unsigned int height, unsigned int width)
|
static int do_resize_run_console(const struct client_arguments *args, unsigned int height, unsigned int width)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_resize_request request = { 0 };
|
struct isula_resize_request request = { 0 };
|
||||||
struct lcrc_resize_response *response = NULL;
|
struct isula_resize_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
ops = get_connect_client_ops();
|
ops = get_connect_client_ops();
|
||||||
@ -150,7 +150,7 @@ static int do_resize_run_console(const struct client_arguments *args, unsigned i
|
|||||||
request.height = height;
|
request.height = height;
|
||||||
request.width = width;
|
request.width = width;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_resize_response));
|
response = util_common_calloc_s(sizeof(struct isula_resize_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -165,7 +165,7 @@ static int do_resize_run_console(const struct client_arguments *args, unsigned i
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_resize_response_free(response);
|
isula_resize_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
#include "commander.h"
|
#include "commander.h"
|
||||||
#include "start.h"
|
#include "start.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
@ -95,9 +95,9 @@ out:
|
|||||||
static int do_client_start(const struct client_arguments *args, struct command_fifo_config **console_fifos)
|
static int do_client_start(const struct client_arguments *args, struct command_fifo_config **console_fifos)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_start_request request = { 0 };
|
struct isula_start_request request = { 0 };
|
||||||
struct lcrc_start_response *response = NULL;
|
struct isula_start_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
ops = get_connect_client_ops();
|
ops = get_connect_client_ops();
|
||||||
@ -117,7 +117,7 @@ static int do_client_start(const struct client_arguments *args, struct command_f
|
|||||||
request.attach_stdout = args->custom_conf.attach_stdout;
|
request.attach_stdout = args->custom_conf.attach_stdout;
|
||||||
request.attach_stderr = args->custom_conf.attach_stderr;
|
request.attach_stderr = args->custom_conf.attach_stderr;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_start_response));
|
response = util_common_calloc_s(sizeof(struct isula_start_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -129,7 +129,7 @@ static int do_client_start(const struct client_arguments *args, struct command_f
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
if (response->server_errono ||
|
if (response->server_errono ||
|
||||||
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(LCRD_ERR_CONNECT)))) {
|
(response->errmsg && !strcmp(response->errmsg, errno_to_error_message(ISULAD_ERR_CONNECT)))) {
|
||||||
ret = ESERVERERROR;
|
ret = ESERVERERROR;
|
||||||
util_contain_errmsg(response->errmsg, &ret);
|
util_contain_errmsg(response->errmsg, &ret);
|
||||||
} else {
|
} else {
|
||||||
@ -139,7 +139,7 @@ static int do_client_start(const struct client_arguments *args, struct command_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_start_response_free(response);
|
isula_start_response_free(response);
|
||||||
response = NULL;
|
response = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_stop_desc[] = "Stop one or more containers";
|
const char g_cmd_stop_desc[] = "Stop one or more containers";
|
||||||
const char g_cmd_stop_usage[] = "stop [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_stop_usage[] = "stop [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -32,12 +32,12 @@ struct client_arguments g_cmd_stop_args = {
|
|||||||
static int client_stop(const struct client_arguments *args)
|
static int client_stop(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_stop_request request = { 0 };
|
struct isula_stop_request request = { 0 };
|
||||||
struct lcrc_stop_response *response = NULL;
|
struct isula_stop_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_stop_response));
|
response = util_common_calloc_s(sizeof(struct isula_stop_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Stop: Out of memory");
|
ERROR("Stop: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -59,7 +59,7 @@ static int client_stop(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_stop_response_free(response);
|
isula_stop_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ free_out:
|
|||||||
|
|
||||||
static void print_version()
|
static void print_version()
|
||||||
{
|
{
|
||||||
printf("Version %s, commit %s\n", VERSION, LCRD_GIT_COMMIT);
|
printf("Version %s, commit %s\n", VERSION, ISULAD_GIT_COMMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compare commands */
|
/* compare commands */
|
||||||
@ -154,7 +154,7 @@ int command_default_help(const char * const program_name, struct command *comman
|
|||||||
|
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
printf("%s: sub-command \"%s\" not found\n", program_name, argv[0]);
|
printf("%s: sub-command \"%s\" not found\n", program_name, argv[0]);
|
||||||
printf("run `lcrc --help` for a list of sub-commands\n");
|
printf("run `isula --help` for a list of sub-commands\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ int run_command(struct command *commands, int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "--help") == 0) {
|
if (strcmp(argv[1], "--help") == 0) {
|
||||||
// lcrc help command format: lcrc --help args
|
// isula help command format: isula --help args
|
||||||
return command_default_help(argv[0], commands, argc - 2, (const char **)(argv + 2));
|
return command_default_help(argv[0], commands, argc - 2, (const char **)(argv + 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
#define CLIENT_RUNDIR "/var/run/lcrc"
|
#define CLIENT_RUNDIR "/var/run/isula"
|
||||||
|
|
||||||
// A command is described by:
|
// A command is described by:
|
||||||
// @name: The name which should be passed as a second parameter
|
// @name: The name which should be passed as a second parameter
|
||||||
7
src/cmd/isula/extend/CMakeLists.txt
Normal file
7
src/cmd/isula/extend/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_extend_srcs)
|
||||||
|
|
||||||
|
set(ISULA_EXTEND_SRCS
|
||||||
|
${isula_extend_srcs}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_events_desc[] = "Get real time events from the server";
|
const char g_cmd_events_desc[] = "Get real time events from the server";
|
||||||
const char g_cmd_events_usage[] = "events [command options]";
|
const char g_cmd_events_usage[] = "events [command options]";
|
||||||
@ -81,12 +81,12 @@ static void print_events_callback(const container_events_format_t *event)
|
|||||||
static int client_event(struct client_arguments *args)
|
static int client_event(struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_events_request request = { 0 };
|
struct isula_events_request request = { 0 };
|
||||||
struct lcrc_events_response *response = NULL;
|
struct isula_events_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_events_response));
|
response = util_common_calloc_s(sizeof(struct isula_events_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Event: Out of memory");
|
ERROR("Event: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -122,7 +122,7 @@ static int client_event(struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_events_response_free(response);
|
isula_events_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_export_desc[] = "export container";
|
const char g_cmd_export_desc[] = "export container";
|
||||||
const char g_cmd_export_usage[] = "export [command options] [ID|NAME]";
|
const char g_cmd_export_usage[] = "export [command options] [ID|NAME]";
|
||||||
@ -30,13 +30,13 @@ struct client_arguments g_cmd_export_args = {};
|
|||||||
static int client_export(const struct client_arguments *args)
|
static int client_export(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_export_request request;
|
struct isula_export_request request;
|
||||||
struct lcrc_export_response *response = NULL;
|
struct isula_export_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
(void)memset(&request, 0, sizeof(request));
|
(void)memset(&request, 0, sizeof(request));
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_export_response));
|
response = util_common_calloc_s(sizeof(struct isula_export_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Resume: Out of memory");
|
ERROR("Resume: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -58,7 +58,7 @@ static int client_export(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_export_response_free(response);
|
isula_export_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_pause_desc[] = "Pause all processes within one or more containers";
|
const char g_cmd_pause_desc[] = "Pause all processes within one or more containers";
|
||||||
const char g_cmd_pause_usage[] = "pause [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_pause_usage[] = "pause [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -29,12 +29,12 @@ struct client_arguments g_cmd_pause_args = {};
|
|||||||
static int client_pause(const struct client_arguments *args)
|
static int client_pause(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_pause_request request = { 0 };
|
struct isula_pause_request request = { 0 };
|
||||||
struct lcrc_pause_response *response = NULL;
|
struct isula_pause_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_pause_response));
|
response = util_common_calloc_s(sizeof(struct isula_pause_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Pause: Out of memory");
|
ERROR("Pause: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -55,7 +55,7 @@ static int client_pause(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_pause_response_free(response);
|
isula_pause_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_resume_desc[] = "Unpause all processes within one or more containers";
|
const char g_cmd_resume_desc[] = "Unpause all processes within one or more containers";
|
||||||
const char g_cmd_resume_usage[] = "unpause [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_resume_usage[] = "unpause [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -29,12 +29,12 @@ struct client_arguments g_cmd_resume_args = {};
|
|||||||
static int client_resume(const struct client_arguments *args)
|
static int client_resume(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_resume_request request = { 0 };
|
struct isula_resume_request request = { 0 };
|
||||||
struct lcrc_resume_response *response = NULL;
|
struct isula_resume_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_resume_response));
|
response = util_common_calloc_s(sizeof(struct isula_resume_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Resume: Out of memory");
|
ERROR("Resume: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -54,7 +54,7 @@ static int client_resume(const struct client_arguments *args)
|
|||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_resume_response_free(response);
|
isula_resume_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
#define ESC "\033"
|
#define ESC "\033"
|
||||||
#define TERMCLEAR ESC "[H" ESC "[J"
|
#define TERMCLEAR ESC "[H" ESC "[J"
|
||||||
@ -47,9 +47,9 @@ struct client_arguments g_cmd_stats_args = {
|
|||||||
.runtime = "lcr",
|
.runtime = "lcr",
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lcrc_stats_response *g_oldstats = NULL;
|
static struct isula_stats_response *g_oldstats = NULL;
|
||||||
|
|
||||||
static void lcrc_size_humanize(unsigned long long val, char *buf, size_t bufsz)
|
static void isula_size_humanize(unsigned long long val, char *buf, size_t bufsz)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (val > 1024 * 1024 * 1024) {
|
if (val > 1024 * 1024 * 1024) {
|
||||||
@ -80,7 +80,7 @@ static void stats_print_header(void)
|
|||||||
printf(TERMNORM);
|
printf(TERMNORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stats_print(const struct lcrc_container_info *stats)
|
static void stats_print(const struct isula_container_info *stats)
|
||||||
{
|
{
|
||||||
#define SHORTIDLEN 12
|
#define SHORTIDLEN 12
|
||||||
#define PERCENT 100
|
#define PERCENT 100
|
||||||
@ -94,10 +94,10 @@ static void stats_print(const struct lcrc_container_info *stats)
|
|||||||
double cpu_percent = 0.0;
|
double cpu_percent = 0.0;
|
||||||
char *short_id = NULL;
|
char *short_id = NULL;
|
||||||
|
|
||||||
lcrc_size_humanize(stats->blkio_read, iosb_read_str, sizeof(iosb_read_str));
|
isula_size_humanize(stats->blkio_read, iosb_read_str, sizeof(iosb_read_str));
|
||||||
lcrc_size_humanize(stats->blkio_write, iosb_write_str, sizeof(iosb_write_str));
|
isula_size_humanize(stats->blkio_write, iosb_write_str, sizeof(iosb_write_str));
|
||||||
lcrc_size_humanize(stats->mem_used, mem_used_str, sizeof(mem_used_str));
|
isula_size_humanize(stats->mem_used, mem_used_str, sizeof(mem_used_str));
|
||||||
lcrc_size_humanize(stats->mem_limit, mem_limit_str, sizeof(mem_limit_str));
|
isula_size_humanize(stats->mem_limit, mem_limit_str, sizeof(mem_limit_str));
|
||||||
|
|
||||||
len = snprintf(iosb_str, sizeof(iosb_str), "%s / %s", iosb_read_str, iosb_write_str);
|
len = snprintf(iosb_str, sizeof(iosb_str), "%s / %s", iosb_read_str, iosb_write_str);
|
||||||
if (len < 0 || (size_t)len >= sizeof(iosb_str)) {
|
if (len < 0 || (size_t)len >= sizeof(iosb_str)) {
|
||||||
@ -140,7 +140,7 @@ static void stats_print(const struct lcrc_container_info *stats)
|
|||||||
free(short_id);
|
free(short_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stats_output(const struct client_arguments *args, struct lcrc_stats_response **response)
|
static void stats_output(const struct client_arguments *args, struct isula_stats_response **response)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -152,15 +152,15 @@ static void stats_output(const struct client_arguments *args, struct lcrc_stats_
|
|||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
lcrc_stats_response_free(g_oldstats);
|
isula_stats_response_free(g_oldstats);
|
||||||
g_oldstats = *response;
|
g_oldstats = *response;
|
||||||
*response = NULL;
|
*response = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_stats_mainloop(const struct client_arguments *args, const struct lcrc_stats_request *request)
|
static int client_stats_mainloop(const struct client_arguments *args, const struct isula_stats_request *request)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
client_connect_config_t config;
|
client_connect_config_t config;
|
||||||
|
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
@ -174,8 +174,8 @@ static int client_stats_mainloop(const struct client_arguments *args, const stru
|
|||||||
config = get_connect_config(args);
|
config = get_connect_config(args);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct lcrc_stats_response *response = NULL;
|
struct isula_stats_response *response = NULL;
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_stats_response));
|
response = util_common_calloc_s(sizeof(struct isula_stats_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -186,13 +186,13 @@ static int client_stats_mainloop(const struct client_arguments *args, const stru
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
ERROR("Failed to stats containers info");
|
ERROR("Failed to stats containers info");
|
||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
lcrc_stats_response_free(response);
|
isula_stats_response_free(response);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
stats_output(args, &response);
|
stats_output(args, &response);
|
||||||
lcrc_stats_response_free(response);
|
isula_stats_response_free(response);
|
||||||
if (args->nostream) {
|
if (args->nostream) {
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ static int client_stats_mainloop(const struct client_arguments *args, const stru
|
|||||||
}
|
}
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
lcrc_stats_response_free(g_oldstats);
|
isula_stats_response_free(g_oldstats);
|
||||||
g_oldstats = NULL;
|
g_oldstats = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ err_out:
|
|||||||
*/
|
*/
|
||||||
static int client_stats(const struct client_arguments *args)
|
static int client_stats(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
struct lcrc_stats_request request = { 0 };
|
struct isula_stats_request request = { 0 };
|
||||||
|
|
||||||
request.all = args->showall;
|
request.all = args->showall;
|
||||||
request.containers = (char **)(args->argv);
|
request.containers = (char **)(args->argv);
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_update_desc[] = "Update configuration of one or more containers";
|
const char g_cmd_update_desc[] = "Update configuration of one or more containers";
|
||||||
const char g_cmd_update_usage[] = "update [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_update_usage[] = "update [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -27,7 +27,7 @@ struct client_arguments g_cmd_update_args = {
|
|||||||
.restart = NULL,
|
.restart = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pack_update_request(const struct client_arguments *args, struct lcrc_update_request *request)
|
static int pack_update_request(const struct client_arguments *args, struct isula_update_request *request)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ static int pack_update_request(const struct client_arguments *args, struct lcrc_
|
|||||||
static int client_update(const struct client_arguments *args)
|
static int client_update(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
container_cgroup_resources_t cr = { 0 };
|
container_cgroup_resources_t cr = { 0 };
|
||||||
lcrc_update_config_t updateconfig = { 0 };
|
isula_update_config_t updateconfig = { 0 };
|
||||||
struct lcrc_update_request request = { 0 };
|
struct isula_update_request request = { 0 };
|
||||||
struct lcrc_update_response *response = NULL;
|
struct isula_update_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_update_response));
|
response = util_common_calloc_s(sizeof(struct isula_update_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -97,7 +97,7 @@ static int client_update(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_update_response_free(response);
|
isula_update_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
7
src/cmd/isula/images/CMakeLists.txt
Normal file
7
src/cmd/isula/images/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_images_srcs)
|
||||||
|
|
||||||
|
set(ISULA_IMAGES_SRCS
|
||||||
|
${isula_images_srcs}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#define IMAGES_OPTIONS(cmdargs) \
|
#define IMAGES_OPTIONS(cmdargs) \
|
||||||
@ -70,9 +70,9 @@ static char *trans_time(int64_t created)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* list print table */
|
/* list print table */
|
||||||
static void list_print_table(struct lcrc_image_info *images_list, const size_t size, const struct lengths *length)
|
static void list_print_table(struct isula_image_info *images_list, const size_t size, const struct lengths *length)
|
||||||
{
|
{
|
||||||
const struct lcrc_image_info *in = NULL;
|
const struct isula_image_info *in = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char *created = NULL;
|
char *created = NULL;
|
||||||
char *digest = NULL;
|
char *digest = NULL;
|
||||||
@ -125,7 +125,7 @@ static void list_print_table(struct lcrc_image_info *images_list, const size_t s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int update_image_ref_width(const struct lcrc_image_info *in, struct lengths *l)
|
static int update_image_ref_width(const struct isula_image_info *in, struct lengths *l)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *copy_name = util_strdup_s(in->imageref);
|
char *copy_name = util_strdup_s(in->imageref);
|
||||||
@ -159,9 +159,9 @@ static int update_image_ref_width(const struct lcrc_image_info *in, struct lengt
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* list field width */
|
/* list field width */
|
||||||
static void list_field_width(const struct lcrc_image_info *images_list, const size_t size, struct lengths *l)
|
static void list_field_width(const struct isula_image_info *images_list, const size_t size, struct lengths *l)
|
||||||
{
|
{
|
||||||
const struct lcrc_image_info *in = NULL;
|
const struct isula_image_info *in = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char tmpbuffer[30];
|
char tmpbuffer[30];
|
||||||
|
|
||||||
@ -198,9 +198,9 @@ static void list_field_width(const struct lcrc_image_info *images_list, const si
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* list all images from LCRD
|
* list all images from isulad
|
||||||
*/
|
*/
|
||||||
static void images_info_print(const struct lcrc_list_images_response *response)
|
static void images_info_print(const struct isula_list_images_response *response)
|
||||||
{
|
{
|
||||||
struct lengths max_len = {
|
struct lengths max_len = {
|
||||||
.registry_length = 30, /* registry */
|
.registry_length = 30, /* registry */
|
||||||
@ -215,9 +215,9 @@ static void images_info_print(const struct lcrc_list_images_response *response)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* images info print quiet */
|
/* images info print quiet */
|
||||||
static void images_info_print_quiet(const struct lcrc_list_images_response *response)
|
static void images_info_print_quiet(const struct isula_list_images_response *response)
|
||||||
{
|
{
|
||||||
const struct lcrc_image_info *in = NULL;
|
const struct isula_image_info *in = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
for (i = 0, in = response->images_list; in != NULL && i < response->images_num; i++, in++) {
|
for (i = 0, in = response->images_list; in != NULL && i < response->images_num; i++, in++) {
|
||||||
@ -231,7 +231,7 @@ static void images_info_print_quiet(const struct lcrc_list_images_response *resp
|
|||||||
/*
|
/*
|
||||||
* used by qsort function for comparing image created time
|
* used by qsort function for comparing image created time
|
||||||
*/
|
*/
|
||||||
static inline int lcrc_image_cmp(struct lcrc_image_info *first, struct lcrc_image_info *second)
|
static inline int isula_image_cmp(struct isula_image_info *first, struct isula_image_info *second)
|
||||||
{
|
{
|
||||||
if (second->created > first->created) {
|
if (second->created > first->created) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -247,13 +247,13 @@ static inline int lcrc_image_cmp(struct lcrc_image_info *first, struct lcrc_imag
|
|||||||
*/
|
*/
|
||||||
static int list_images(const struct client_arguments *args)
|
static int list_images(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_list_images_request request = { 0 };
|
struct isula_list_images_request request = { 0 };
|
||||||
struct lcrc_list_images_response *response = NULL;
|
struct isula_list_images_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_list_images_response));
|
response = util_common_calloc_s(sizeof(struct isula_list_images_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Imagelist: Out of memory");
|
ERROR("Imagelist: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -266,7 +266,7 @@ static int list_images(const struct client_arguments *args)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (args->filters != NULL) {
|
if (args->filters != NULL) {
|
||||||
request.filters = lcrc_filters_parse_args((const char **)args->filters,
|
request.filters = isula_filters_parse_args((const char **)args->filters,
|
||||||
util_array_len((const char **)(args->filters)));
|
util_array_len((const char **)(args->filters)));
|
||||||
if (request.filters == NULL) {
|
if (request.filters == NULL) {
|
||||||
ERROR("Failed to parse filters args");
|
ERROR("Failed to parse filters args");
|
||||||
@ -282,8 +282,8 @@ static int list_images(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (response->images_list != NULL && response->images_num > 0) {
|
if (response->images_list != NULL && response->images_num > 0) {
|
||||||
qsort(response->images_list, (size_t)(response->images_num), sizeof(struct lcrc_image_info),
|
qsort(response->images_list, (size_t)(response->images_num), sizeof(struct isula_image_info),
|
||||||
(int (*)(const void *, const void *))lcrc_image_cmp);
|
(int (*)(const void *, const void *))isula_image_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->dispname) {
|
if (args->dispname) {
|
||||||
@ -293,8 +293,8 @@ static int list_images(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_filters_free(request.filters);
|
isula_filters_free(request.filters);
|
||||||
lcrc_list_images_response_free(response);
|
isula_list_images_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#ifdef ENABLE_EMBEDDED_IMAGE
|
#ifdef ENABLE_EMBEDDED_IMAGE
|
||||||
@ -39,9 +39,9 @@ struct client_arguments g_cmd_load_args = { 0 };
|
|||||||
*/
|
*/
|
||||||
static int client_load_image(const struct client_arguments *args)
|
static int client_load_image(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_load_request request = { 0 };
|
struct isula_load_request request = { 0 };
|
||||||
struct lcrc_load_response response = { 0 };
|
struct isula_load_response response = { 0 };
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
const char g_cmd_login_desc[] = "Log in to a Docker registry";
|
const char g_cmd_login_desc[] = "Log in to a Docker registry";
|
||||||
@ -35,13 +35,13 @@ struct client_arguments g_cmd_login_args = {};
|
|||||||
*/
|
*/
|
||||||
int client_login(const struct client_arguments *args)
|
int client_login(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_login_request request = { 0 };
|
struct isula_login_request request = { 0 };
|
||||||
struct lcrc_login_response *response = NULL;
|
struct isula_login_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_login_response));
|
response = util_common_calloc_s(sizeof(struct isula_login_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
@ -71,7 +71,7 @@ int client_login(const struct client_arguments *args)
|
|||||||
COMMAND_ERROR("Login Succeeded");
|
COMMAND_ERROR("Login Succeeded");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_login_response_free(response);
|
isula_login_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
const char g_cmd_logout_desc[] = "Log out from a Docker registry";
|
const char g_cmd_logout_desc[] = "Log out from a Docker registry";
|
||||||
@ -34,13 +34,13 @@ struct client_arguments g_cmd_logout_args = {};
|
|||||||
*/
|
*/
|
||||||
int client_logout(const struct client_arguments *args)
|
int client_logout(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_logout_request request = { 0 };
|
struct isula_logout_request request = { 0 };
|
||||||
struct lcrc_logout_response *response = NULL;
|
struct isula_logout_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_logout_response));
|
response = util_common_calloc_s(sizeof(struct isula_logout_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
@ -68,7 +68,7 @@ int client_logout(const struct client_arguments *args)
|
|||||||
COMMAND_ERROR("Logout Succeeded");
|
COMMAND_ERROR("Logout Succeeded");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_logout_response_free(response);
|
isula_logout_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
const char g_cmd_pull_desc[] = "Pull an image or a repository from a registry";
|
const char g_cmd_pull_desc[] = "Pull an image or a repository from a registry";
|
||||||
@ -34,13 +34,13 @@ struct client_arguments g_cmd_pull_args = {};
|
|||||||
*/
|
*/
|
||||||
int client_pull(const struct client_arguments *args)
|
int client_pull(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_pull_request request = { 0 };
|
struct isula_pull_request request = { 0 };
|
||||||
struct lcrc_pull_response *response = NULL;
|
struct isula_pull_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_pull_response));
|
response = util_common_calloc_s(sizeof(struct isula_pull_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
@ -67,7 +67,7 @@ int client_pull(const struct client_arguments *args)
|
|||||||
COMMAND_ERROR("Image \"%s\" pulled", response->image_ref);
|
COMMAND_ERROR("Image \"%s\" pulled", response->image_ref);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_pull_response_free(response);
|
isula_pull_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
const char g_cmd_rmi_desc[] = "Remove one or more images";
|
const char g_cmd_rmi_desc[] = "Remove one or more images";
|
||||||
@ -33,9 +33,9 @@ struct client_arguments g_cmd_rmi_args = { .force = false };
|
|||||||
*/
|
*/
|
||||||
static int client_rmi(const struct client_arguments *args)
|
static int client_rmi(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_rmi_request request = { 0 };
|
struct isula_rmi_request request = { 0 };
|
||||||
struct lcrc_rmi_response *response = NULL;
|
struct isula_rmi_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ static int client_rmi(const struct client_arguments *args)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_rmi_response));
|
response = util_common_calloc_s(sizeof(struct isula_rmi_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -69,7 +69,7 @@ static int client_rmi(const struct client_arguments *args)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_rmi_response_free(response);
|
isula_rmi_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
7
src/cmd/isula/information/CMakeLists.txt
Normal file
7
src/cmd/isula/information/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_information_srcs)
|
||||||
|
|
||||||
|
set(ISULA_INFORMATION_SRCS
|
||||||
|
${isula_information_srcs}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
@ -16,9 +16,9 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_health_check_desc[] = "LCRD health check";
|
const char g_cmd_health_check_desc[] = "iSulad health check";
|
||||||
const char g_cmd_health_check_usage[] = "health [command options]";
|
const char g_cmd_health_check_usage[] = "health [command options]";
|
||||||
|
|
||||||
struct client_arguments g_cmd_health_check_args = {
|
struct client_arguments g_cmd_health_check_args = {
|
||||||
@ -30,13 +30,13 @@ struct client_arguments g_cmd_health_check_args = {
|
|||||||
*/
|
*/
|
||||||
static int client_health_check(const struct client_arguments *args)
|
static int client_health_check(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_health_check_request request = { 0 };
|
struct isula_health_check_request request = { 0 };
|
||||||
struct lcrc_health_check_response *response = NULL;
|
struct isula_health_check_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_health_check_response));
|
response = util_common_calloc_s(sizeof(struct isula_health_check_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Health: Out of memory");
|
ERROR("Health: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -57,7 +57,7 @@ static int client_health_check(const struct client_arguments *args)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
lcrc_health_check_response_free(response);
|
isula_health_check_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ int cmd_health_check_main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (client_health_check(&g_cmd_health_check_args)) {
|
if (client_health_check(&g_cmd_health_check_args)) {
|
||||||
printf("LCRD with socket name '%s' is NOT SERVING\n", g_cmd_health_check_args.socket);
|
printf("iSulad with socket name '%s' is NOT SERVING\n", g_cmd_health_check_args.socket);
|
||||||
exit(ECOMMON);
|
exit(ECOMMON);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("LCRD with socket name '%s' is SERVING\n", g_cmd_health_check_args.socket);
|
printf("iSulad with socket name '%s' is SERVING\n", g_cmd_health_check_args.socket);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,14 +19,14 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_info_desc[] = "Display system-wide information";
|
const char g_cmd_info_desc[] = "Display system-wide information";
|
||||||
const char g_cmd_info_usage[] = "info";
|
const char g_cmd_info_usage[] = "info";
|
||||||
|
|
||||||
struct client_arguments g_cmd_info_args = {};
|
struct client_arguments g_cmd_info_args = {};
|
||||||
|
|
||||||
static void client_info_server(const struct lcrc_info_response *response)
|
static void client_info_server(const struct isula_info_response *response)
|
||||||
{
|
{
|
||||||
printf("Containers: %u\n", (unsigned int)(response->containers_num));
|
printf("Containers: %u\n", (unsigned int)(response->containers_num));
|
||||||
printf(" Running: %u\n", (unsigned int)(response->c_running));
|
printf(" Running: %u\n", (unsigned int)(response->c_running));
|
||||||
@ -79,13 +79,13 @@ static void client_info_server(const struct lcrc_info_response *response)
|
|||||||
|
|
||||||
static int client_info(const struct client_arguments *args)
|
static int client_info(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_info_request request = { 0 };
|
struct isula_info_request request = { 0 };
|
||||||
struct lcrc_info_response *response = NULL;
|
struct isula_info_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_info_response));
|
response = util_common_calloc_s(sizeof(struct isula_info_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Info: Out of memory");
|
ERROR("Info: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -108,7 +108,7 @@ static int client_info(const struct client_arguments *args)
|
|||||||
client_info_server(response);
|
client_info_server(response);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_info_response_free(response);
|
isula_info_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "inspect.h"
|
#include "inspect.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "json_common.h"
|
#include "json_common.h"
|
||||||
@ -191,8 +191,9 @@ static bool inspect_filter_done(yajl_val root, const char *filter, container_tre
|
|||||||
* CONTAINER_INSPECT_ERR: have the container, but failed to inspect due to other reasons
|
* CONTAINER_INSPECT_ERR: have the container, but failed to inspect due to other reasons
|
||||||
* CONTAINER_NOT_FOUND: no such container
|
* CONTAINER_NOT_FOUND: no such container
|
||||||
*/
|
*/
|
||||||
static int client_inspect_container(const struct lcrc_inspect_request *request, struct lcrc_inspect_response *response,
|
static int client_inspect_container(const struct isula_inspect_request *request,
|
||||||
client_connect_config_t *config, const lcrc_connect_ops *ops)
|
struct isula_inspect_response *response,
|
||||||
|
client_connect_config_t *config, const isula_connect_ops *ops)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -211,8 +212,8 @@ static int client_inspect_container(const struct lcrc_inspect_request *request,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_inspect_image(const struct lcrc_inspect_request *request, struct lcrc_inspect_response *response,
|
static int client_inspect_image(const struct isula_inspect_request *request, struct isula_inspect_response *response,
|
||||||
client_connect_config_t *config, const lcrc_connect_ops *ops)
|
client_connect_config_t *config, const isula_connect_ops *ops)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -229,14 +230,14 @@ static int client_inspect_image(const struct lcrc_inspect_request *request, stru
|
|||||||
*/
|
*/
|
||||||
static int client_inspect(const struct client_arguments *args, const char *filter, container_tree_t *tree_array)
|
static int client_inspect(const struct client_arguments *args, const char *filter, container_tree_t *tree_array)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_inspect_request request = { 0 };
|
struct isula_inspect_request request = { 0 };
|
||||||
struct lcrc_inspect_response *response = NULL;
|
struct isula_inspect_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
yajl_val tree = NULL;
|
yajl_val tree = NULL;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_inspect_response));
|
response = util_common_calloc_s(sizeof(struct isula_inspect_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -257,10 +258,10 @@ static int client_inspect(const struct client_arguments *args, const char *filte
|
|||||||
config = get_connect_config(args);
|
config = get_connect_config(args);
|
||||||
ret = client_inspect_container(&request, response, &config, ops);
|
ret = client_inspect_container(&request, response, &config, ops);
|
||||||
if (ret == CONTAINER_NOT_FOUND) {
|
if (ret == CONTAINER_NOT_FOUND) {
|
||||||
lcrc_inspect_response_free(response);
|
isula_inspect_response_free(response);
|
||||||
response = NULL;
|
response = NULL;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_inspect_response));
|
response = util_common_calloc_s(sizeof(struct isula_inspect_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -295,7 +296,7 @@ static int client_inspect(const struct client_arguments *args, const char *filte
|
|||||||
tree_array->tree_root = tree;
|
tree_array->tree_root = tree;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_inspect_response_free(response);
|
isula_inspect_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_logs_desc[] = "Fetch the logs of a container";
|
const char g_cmd_logs_desc[] = "Fetch the logs of a container";
|
||||||
const char g_cmd_logs_usage[] = "logs [OPTIONS] CONTAINER";
|
const char g_cmd_logs_usage[] = "logs [OPTIONS] CONTAINER";
|
||||||
@ -40,18 +40,18 @@ struct client_arguments g_cmd_logs_args = {
|
|||||||
static int do_logs(const struct client_arguments *args)
|
static int do_logs(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
#define DISABLE_ERR_MESSAGE "disable console log"
|
#define DISABLE_ERR_MESSAGE "disable console log"
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_logs_request *request = NULL;
|
struct isula_logs_request *request = NULL;
|
||||||
struct lcrc_logs_response *response = NULL;
|
struct isula_logs_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_logs_response));
|
response = util_common_calloc_s(sizeof(struct isula_logs_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Log: Out of memory");
|
ERROR("Log: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
request = util_common_calloc_s(sizeof(struct lcrc_logs_request));
|
request = util_common_calloc_s(sizeof(struct isula_logs_request));
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -84,8 +84,8 @@ static int do_logs(const struct client_arguments *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_logs_response_free(response);
|
isula_logs_response_free(response);
|
||||||
lcrc_logs_request_free(request);
|
isula_logs_request_free(request);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
#include "ps.h"
|
#include "ps.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_list_desc[] = "List containers";
|
const char g_cmd_list_desc[] = "List containers";
|
||||||
const char g_cmd_list_usage[] = "ps [command options]";
|
const char g_cmd_list_usage[] = "ps [command options]";
|
||||||
@ -127,7 +127,7 @@ static int append_field(struct filters *ff, struct filter_field *field)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *lcrc_lcrsta2str(Container_Status sta)
|
static const char *isula_lcrsta2str(Container_Status sta)
|
||||||
{
|
{
|
||||||
if (sta >= CONTAINER_STATUS_MAX_STATE) {
|
if (sta >= CONTAINER_STATUS_MAX_STATE) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -135,16 +135,16 @@ static const char *lcrc_lcrsta2str(Container_Status sta)
|
|||||||
return g_containerstatusstr[sta];
|
return g_containerstatusstr[sta];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_print_quiet(struct lcrc_container_summary_info **info, const size_t size,
|
static void list_print_quiet(struct isula_container_summary_info **info, const size_t size,
|
||||||
const struct lengths *length)
|
const struct lengths *length)
|
||||||
{
|
{
|
||||||
const char *status = NULL;
|
const char *status = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
const struct lcrc_container_summary_info *in = NULL;
|
const struct isula_container_summary_info *in = NULL;
|
||||||
in = info[i];
|
in = info[i];
|
||||||
status = lcrc_lcrsta2str(in->status);
|
status = isula_lcrsta2str(in->status);
|
||||||
if (status == NULL) {
|
if (status == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -154,12 +154,12 @@ static void list_print_quiet(struct lcrc_container_summary_info **info, const si
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mix_container_state(const struct lcrc_container_summary_info *in, char *state, size_t len)
|
static int mix_container_state(const struct isula_container_summary_info *in, char *state, size_t len)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const char *container_status = NULL;
|
const char *container_status = NULL;
|
||||||
|
|
||||||
container_status = lcrc_lcrsta2str(in->status);
|
container_status = isula_lcrsta2str(in->status);
|
||||||
if (container_status == NULL) {
|
if (container_status == NULL) {
|
||||||
(void)strcpy(state, "-");
|
(void)strcpy(state, "-");
|
||||||
} else {
|
} else {
|
||||||
@ -169,7 +169,7 @@ static int mix_container_state(const struct lcrc_container_summary_info *in, cha
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_running_status(const char *start_at, const struct lcrc_container_summary_info *in,
|
static int handle_running_status(const char *start_at, const struct isula_container_summary_info *in,
|
||||||
char *status, size_t len)
|
char *status, size_t len)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -195,7 +195,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mix_container_status(const struct lcrc_container_summary_info *in, char *status, size_t len)
|
static int mix_container_status(const struct isula_container_summary_info *in, char *status, size_t len)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int sret = 0;
|
int sret = 0;
|
||||||
@ -359,7 +359,7 @@ static void print_created_field(int64_t created, unsigned int length)
|
|||||||
printf("%-*s", (int)length, created_duration);
|
printf("%-*s", (int)length, created_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_basic_container_info_item(const struct lcrc_container_summary_info *in, const char *status,
|
static void print_basic_container_info_item(const struct isula_container_summary_info *in, const char *status,
|
||||||
const char *name, const struct lengths *length)
|
const char *name, const struct lengths *length)
|
||||||
{
|
{
|
||||||
if (strcmp(name, "ID") == 0) {
|
if (strcmp(name, "ID") == 0) {
|
||||||
@ -391,7 +391,7 @@ static void print_basic_container_info_item(const struct lcrc_container_summary_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void print_extern_container_info_item(const struct lcrc_container_summary_info *in, const char *state,
|
static void print_extern_container_info_item(const struct isula_container_summary_info *in, const char *state,
|
||||||
const char *name, const struct lengths *length)
|
const char *name, const struct lengths *length)
|
||||||
{
|
{
|
||||||
if (strcmp(name, "ExitCode") == 0) {
|
if (strcmp(name, "ExitCode") == 0) {
|
||||||
@ -414,14 +414,14 @@ static void print_extern_container_info_item(const struct lcrc_container_summary
|
|||||||
printf("%-*s", (int)length->state_length, state);
|
printf("%-*s", (int)length->state_length, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void print_container_info_item(const struct lcrc_container_summary_info *in, const char *state,
|
static void print_container_info_item(const struct isula_container_summary_info *in, const char *state,
|
||||||
const char *status, const char *name, const struct lengths *length)
|
const char *status, const char *name, const struct lengths *length)
|
||||||
{
|
{
|
||||||
print_basic_container_info_item(in, status, name, length);
|
print_basic_container_info_item(in, status, name, length);
|
||||||
print_extern_container_info_item(in, state, name, length);
|
print_extern_container_info_item(in, state, name, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ps_print_container_info(const struct lcrc_container_summary_info *in, const char *state,
|
static void ps_print_container_info(const struct isula_container_summary_info *in, const char *state,
|
||||||
const char *status, const struct lengths *length, const struct filters *ff)
|
const char *status, const struct lengths *length, const struct filters *ff)
|
||||||
{
|
{
|
||||||
size_t i = should_print_table_header(ff) ? 1 : 0;
|
size_t i = should_print_table_header(ff) ? 1 : 0;
|
||||||
@ -436,12 +436,12 @@ static void ps_print_container_info(const struct lcrc_container_summary_info *in
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_print_table(struct lcrc_container_summary_info **info, const size_t size,
|
static void list_print_table(struct isula_container_summary_info **info, const size_t size,
|
||||||
struct lengths *length, const struct filters *ff)
|
struct lengths *length, const struct filters *ff)
|
||||||
{
|
{
|
||||||
#define MAX_STATE_LEN 32
|
#define MAX_STATE_LEN 32
|
||||||
#define MAX_STATUS_LEN 100
|
#define MAX_STATUS_LEN 100
|
||||||
const struct lcrc_container_summary_info *in = NULL;
|
const struct isula_container_summary_info *in = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
char state[MAX_STATE_LEN] = { 0 };
|
char state[MAX_STATE_LEN] = { 0 };
|
||||||
@ -476,7 +476,7 @@ static void calculate_str_length(const char *str, unsigned int *length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calculate_status_str_length(const struct lcrc_container_summary_info *in, unsigned int *length)
|
static void calculate_status_str_length(const struct isula_container_summary_info *in, unsigned int *length)
|
||||||
{
|
{
|
||||||
#define MAX_STATUS_LEN 100
|
#define MAX_STATUS_LEN 100
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -490,11 +490,11 @@ static void calculate_status_str_length(const struct lcrc_container_summary_info
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calculate_state_str_length(const struct lcrc_container_summary_info *in, unsigned int *length)
|
static void calculate_state_str_length(const struct isula_container_summary_info *in, unsigned int *length)
|
||||||
{
|
{
|
||||||
const char *state = NULL;
|
const char *state = NULL;
|
||||||
|
|
||||||
state = lcrc_lcrsta2str(in->status);
|
state = isula_lcrsta2str(in->status);
|
||||||
if (state != NULL) {
|
if (state != NULL) {
|
||||||
size_t len;
|
size_t len;
|
||||||
len = strlen(state);
|
len = strlen(state);
|
||||||
@ -547,10 +547,10 @@ static void calculate_created_str_length(int64_t created, unsigned int *length)
|
|||||||
calculate_time_str_length(timebuffer, length);
|
calculate_time_str_length(timebuffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_field_width(struct lcrc_container_summary_info **info, const size_t size, struct lengths *l)
|
static void list_field_width(struct isula_container_summary_info **info, const size_t size, struct lengths *l)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
const struct lcrc_container_summary_info *in = NULL;
|
const struct isula_container_summary_info *in = NULL;
|
||||||
|
|
||||||
if (info == NULL || l == NULL) {
|
if (info == NULL || l == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -596,8 +596,8 @@ static void list_field_width(struct lcrc_container_summary_info **info, const si
|
|||||||
/*
|
/*
|
||||||
* used by qsort function for comparing container start time
|
* used by qsort function for comparing container start time
|
||||||
*/
|
*/
|
||||||
static inline int lcrc_container_cmp(struct lcrc_container_summary_info **first,
|
static inline int isula_container_cmp(struct isula_container_summary_info **first,
|
||||||
struct lcrc_container_summary_info **second)
|
struct isula_container_summary_info **second)
|
||||||
{
|
{
|
||||||
return strcmp((*second)->startat, (*first)->startat);
|
return strcmp((*second)->startat, (*first)->startat);
|
||||||
}
|
}
|
||||||
@ -607,9 +607,9 @@ static inline int lcrc_container_cmp(struct lcrc_container_summary_info **first,
|
|||||||
*/
|
*/
|
||||||
static int client_list(const struct client_arguments *args, const struct filters *ff)
|
static int client_list(const struct client_arguments *args, const struct filters *ff)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_list_request request = { 0 };
|
struct isula_list_request request = { 0 };
|
||||||
struct lcrc_list_response *response = NULL;
|
struct isula_list_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct lengths max_len = {
|
struct lengths max_len = {
|
||||||
@ -630,7 +630,7 @@ static int client_list(const struct client_arguments *args, const struct filters
|
|||||||
.runtime_length = 7, /* RUNTIME */
|
.runtime_length = 7, /* RUNTIME */
|
||||||
};
|
};
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_list_response));
|
response = util_common_calloc_s(sizeof(struct isula_list_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -644,7 +644,7 @@ static int client_list(const struct client_arguments *args, const struct filters
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args->filters != NULL) {
|
if (args->filters != NULL) {
|
||||||
request.filters = lcrc_filters_parse_args((const char **)args->filters,
|
request.filters = isula_filters_parse_args((const char **)args->filters,
|
||||||
util_array_len((const char **)(args->filters)));
|
util_array_len((const char **)(args->filters)));
|
||||||
if (request.filters == NULL) {
|
if (request.filters == NULL) {
|
||||||
ERROR("Failed to parse filters args");
|
ERROR("Failed to parse filters args");
|
||||||
@ -662,7 +662,7 @@ static int client_list(const struct client_arguments *args, const struct filters
|
|||||||
}
|
}
|
||||||
if (response->container_num != 0)
|
if (response->container_num != 0)
|
||||||
qsort(response->container_summary, (size_t)(response->container_num),
|
qsort(response->container_summary, (size_t)(response->container_num),
|
||||||
sizeof(struct lcrc_container_summary_info *), (int (*)(const void *, const void *))lcrc_container_cmp);
|
sizeof(struct isula_container_summary_info *), (int (*)(const void *, const void *))isula_container_cmp);
|
||||||
|
|
||||||
if (args->dispname) {
|
if (args->dispname) {
|
||||||
list_print_quiet(response->container_summary, response->container_num, &max_len);
|
list_print_quiet(response->container_summary, response->container_num, &max_len);
|
||||||
@ -672,8 +672,8 @@ static int client_list(const struct client_arguments *args, const struct filters
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_filters_free(request.filters);
|
isula_filters_free(request.filters);
|
||||||
lcrc_list_response_free(response);
|
isula_list_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@ -28,7 +28,7 @@ const char g_cmd_top_desc[] = "Display the running processes of a container";
|
|||||||
const char g_cmd_top_usage[] = "top [OPTIONS] CONTAINER [ps OPTIONS]";
|
const char g_cmd_top_usage[] = "top [OPTIONS] CONTAINER [ps OPTIONS]";
|
||||||
|
|
||||||
struct client_arguments g_cmd_top_args = {};
|
struct client_arguments g_cmd_top_args = {};
|
||||||
static void client_top_info_server(const struct lcrc_top_response *response)
|
static void client_top_info_server(const struct isula_top_response *response)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -50,14 +50,14 @@ static void client_top_info_server(const struct lcrc_top_response *response)
|
|||||||
*/
|
*/
|
||||||
static int client_top(const struct client_arguments *args)
|
static int client_top(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_top_request request = { 0 };
|
struct isula_top_request request = { 0 };
|
||||||
struct lcrc_top_response *response = NULL;
|
struct isula_top_response *response = NULL;
|
||||||
container_inspect *inspect_data = NULL;
|
container_inspect *inspect_data = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_top_response));
|
response = util_common_calloc_s(sizeof(struct isula_top_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("TOP: Out of memory");
|
ERROR("TOP: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -108,7 +108,7 @@ static int client_top(const struct client_arguments *args)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
free_container_inspect(inspect_data);
|
free_container_inspect(inspect_data);
|
||||||
lcrc_top_response_free(response);
|
isula_top_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,9 +19,9 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_version_desc[] = "Display information about lcrc";
|
const char g_cmd_version_desc[] = "Display information about isula";
|
||||||
const char g_cmd_version_usage[] = "version";
|
const char g_cmd_version_usage[] = "version";
|
||||||
|
|
||||||
struct client_arguments g_cmd_version_args = {};
|
struct client_arguments g_cmd_version_args = {};
|
||||||
@ -30,8 +30,8 @@ static void client_version_info_client()
|
|||||||
{
|
{
|
||||||
printf("Client:\n");
|
printf("Client:\n");
|
||||||
printf(" Version:\t%s\n", VERSION);
|
printf(" Version:\t%s\n", VERSION);
|
||||||
printf(" Git commit:\t%s\n", LCRD_GIT_COMMIT);
|
printf(" Git commit:\t%s\n", ISULAD_GIT_COMMIT);
|
||||||
printf(" Built:\t%s\n", LCRD_BUILD_TIME);
|
printf(" Built:\t%s\n", ISULAD_BUILD_TIME);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
static void client_version_info_oci_config()
|
static void client_version_info_oci_config()
|
||||||
@ -41,7 +41,7 @@ static void client_version_info_oci_config()
|
|||||||
printf(" Default file:\t%s\n", OCICONFIG_PATH);
|
printf(" Default file:\t%s\n", OCICONFIG_PATH);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
static void client_version_info_server(const struct lcrc_version_response *response)
|
static void client_version_info_server(const struct isula_version_response *response)
|
||||||
{
|
{
|
||||||
printf("Server:\n");
|
printf("Server:\n");
|
||||||
printf(" Version:\t%s\n", response->version ? response->version : "");
|
printf(" Version:\t%s\n", response->version ? response->version : "");
|
||||||
@ -52,13 +52,13 @@ static void client_version_info_server(const struct lcrc_version_response *respo
|
|||||||
|
|
||||||
static int client_version(const struct client_arguments *args)
|
static int client_version(const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_version_request request = { 0 };
|
struct isula_version_request request = { 0 };
|
||||||
struct lcrc_version_response *response = NULL;
|
struct isula_version_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_version_response));
|
response = util_common_calloc_s(sizeof(struct isula_version_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Version: Out of memory");
|
ERROR("Version: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -83,7 +83,7 @@ static int client_version(const struct client_arguments *args)
|
|||||||
client_version_info_server(response);
|
client_version_info_server(response);
|
||||||
client_version_info_oci_config();
|
client_version_info_oci_config();
|
||||||
out:
|
out:
|
||||||
lcrc_version_response_free(response);
|
isula_version_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
|
|
||||||
const char g_cmd_wait_desc[] = "Block until one or more containers stop, then print their exit codes";
|
const char g_cmd_wait_desc[] = "Block until one or more containers stop, then print their exit codes";
|
||||||
const char g_cmd_wait_usage[] = "wait [OPTIONS] CONTAINER [CONTAINER...]";
|
const char g_cmd_wait_usage[] = "wait [OPTIONS] CONTAINER [CONTAINER...]";
|
||||||
@ -28,13 +28,13 @@ struct client_arguments g_cmd_wait_args = {};
|
|||||||
*/
|
*/
|
||||||
int client_wait(const struct client_arguments *args, unsigned int *exit_code)
|
int client_wait(const struct client_arguments *args, unsigned int *exit_code)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_wait_request request = { 0 };
|
struct isula_wait_request request = { 0 };
|
||||||
struct lcrc_wait_response *response = NULL;
|
struct isula_wait_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_wait_response));
|
response = util_common_calloc_s(sizeof(struct isula_wait_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Wait: Out of memory");
|
ERROR("Wait: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -70,7 +70,7 @@ int client_wait(const struct client_arguments *args, unsigned int *exit_code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_wait_response_free(response);
|
isula_wait_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* See the Mulan PSL v1 for more details.
|
* See the Mulan PSL v1 for more details.
|
||||||
* Author: lifeng
|
* Author: lifeng
|
||||||
* Create: 2018-11-08
|
* Create: 2018-11-08
|
||||||
* Description: provide init process of lcrc
|
* Description: provide init process of isula
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
#include "pull.h"
|
#include "pull.h"
|
||||||
#include "login.h"
|
#include "login.h"
|
||||||
#include "logout.h"
|
#include "logout.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "rename.h"
|
#include "rename.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
7
src/cmd/isula/stream/CMakeLists.txt
Normal file
7
src/cmd/isula/stream/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} isula_stream_srcs)
|
||||||
|
|
||||||
|
set(ISULA_STREAM_SRCS
|
||||||
|
${isula_stream_srcs}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
@ -22,7 +22,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "attach.h"
|
#include "attach.h"
|
||||||
@ -58,13 +58,13 @@ static int check_tty(bool tty, struct termios *oldtios, bool *reset_tty)
|
|||||||
int inspect_container(const struct client_arguments *args, container_inspect **inspect_data)
|
int inspect_container(const struct client_arguments *args, container_inspect **inspect_data)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct lcrc_inspect_request inspect_request = { 0 };
|
struct isula_inspect_request inspect_request = { 0 };
|
||||||
struct lcrc_inspect_response *inspect_response = NULL;
|
struct isula_inspect_response *inspect_response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
parser_error perr = NULL;
|
parser_error perr = NULL;
|
||||||
|
|
||||||
inspect_response = util_common_calloc_s(sizeof(struct lcrc_inspect_response));
|
inspect_response = util_common_calloc_s(sizeof(struct isula_inspect_response));
|
||||||
if (inspect_response == NULL) {
|
if (inspect_response == NULL) {
|
||||||
COMMAND_ERROR("Out of memory");
|
COMMAND_ERROR("Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -100,7 +100,7 @@ int inspect_container(const struct client_arguments *args, container_inspect **i
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_inspect_response_free(inspect_response);
|
isula_inspect_response_free(inspect_response);
|
||||||
free(perr);
|
free(perr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -194,9 +194,9 @@ struct wait_thread_arg {
|
|||||||
static void *container_wait_thread_main(void *thread_arg)
|
static void *container_wait_thread_main(void *thread_arg)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_wait_request request = { 0 };
|
struct isula_wait_request request = { 0 };
|
||||||
struct lcrc_wait_response *response = NULL;
|
struct isula_wait_response *response = NULL;
|
||||||
struct wait_thread_arg *arg = (struct wait_thread_arg *)thread_arg;
|
struct wait_thread_arg *arg = (struct wait_thread_arg *)thread_arg;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ static void *container_wait_thread_main(void *thread_arg)
|
|||||||
}
|
}
|
||||||
prctl(PR_SET_NAME, "AttachWaitThread");
|
prctl(PR_SET_NAME, "AttachWaitThread");
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_wait_response));
|
response = util_common_calloc_s(sizeof(struct isula_wait_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Wait: Out of memory");
|
ERROR("Wait: Out of memory");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -240,7 +240,7 @@ cleanup:
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
(void)sem_post(arg->sem_exited);
|
(void)sem_post(arg->sem_exited);
|
||||||
}
|
}
|
||||||
lcrc_wait_response_free(response);
|
isula_wait_response_free(response);
|
||||||
free(arg);
|
free(arg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -279,9 +279,9 @@ static int container_wait_thread(struct client_arguments *args, uint32_t *exit_c
|
|||||||
|
|
||||||
static int client_attach(struct client_arguments *args, uint32_t *exit_code)
|
static int client_attach(struct client_arguments *args, uint32_t *exit_code)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_attach_request request = { 0 };
|
struct isula_attach_request request = { 0 };
|
||||||
struct lcrc_attach_response *response = NULL;
|
struct isula_attach_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct termios oldtios = { 0 };
|
struct termios oldtios = { 0 };
|
||||||
@ -309,7 +309,7 @@ static int client_attach(struct client_arguments *args, uint32_t *exit_code)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_attach_response));
|
response = util_common_calloc_s(sizeof(struct isula_attach_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Attach: Out of memory");
|
ERROR("Attach: Out of memory");
|
||||||
ret = ECOMMON;
|
ret = ECOMMON;
|
||||||
@ -357,7 +357,7 @@ static int client_attach(struct client_arguments *args, uint32_t *exit_code)
|
|||||||
out:
|
out:
|
||||||
(void)sem_destroy(&sem_exited);
|
(void)sem_destroy(&sem_exited);
|
||||||
free_container_inspect(inspect_data);
|
free_container_inspect(inspect_data);
|
||||||
lcrc_attach_response_free(response);
|
isula_attach_response_free(response);
|
||||||
if (reset_tty) {
|
if (reset_tty) {
|
||||||
if (tcsetattr(0, TCSAFLUSH, &oldtios) < 0) {
|
if (tcsetattr(0, TCSAFLUSH, &oldtios) < 0) {
|
||||||
ERROR("Failed to reset terminal properties");
|
ERROR("Failed to reset terminal properties");
|
||||||
@ -22,8 +22,8 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "lcrdtar.h"
|
#include "libtar.h"
|
||||||
|
|
||||||
#define FromContainer 0x01u
|
#define FromContainer 0x01u
|
||||||
#define ToContainer 0x10u
|
#define ToContainer 0x10u
|
||||||
@ -52,10 +52,10 @@ static void print_copy_from_container_error(const char *ops_err, const char *arc
|
|||||||
const struct client_arguments *args)
|
const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
if (ops_err != NULL) {
|
if (ops_err != NULL) {
|
||||||
if (strcmp(ops_err, errno_to_error_message(LCRD_ERR_CONNECT)) == 0) {
|
if (strcmp(ops_err, errno_to_error_message(ISULAD_ERR_CONNECT)) == 0) {
|
||||||
COMMAND_ERROR("%s", ops_err);
|
COMMAND_ERROR("%s", ops_err);
|
||||||
} else {
|
} else {
|
||||||
client_print_error(0, LCRD_ERR_EXEC, ops_err);
|
client_print_error(0, ISULAD_ERR_EXEC, ops_err);
|
||||||
}
|
}
|
||||||
} else if (archive_err != NULL) {
|
} else if (archive_err != NULL) {
|
||||||
COMMAND_ERROR("Failed exact archive: %s", archive_err);
|
COMMAND_ERROR("Failed exact archive: %s", archive_err);
|
||||||
@ -67,9 +67,9 @@ static void print_copy_from_container_error(const char *ops_err, const char *arc
|
|||||||
static int client_copy_from_container(const struct client_arguments *args, const char *id, const char *srcpath,
|
static int client_copy_from_container(const struct client_arguments *args, const char *id, const char *srcpath,
|
||||||
const char *destpath)
|
const char *destpath)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_copy_from_container_request request = { 0 };
|
struct isula_copy_from_container_request request = { 0 };
|
||||||
struct lcrc_copy_from_container_response *response = NULL;
|
struct isula_copy_from_container_response *response = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int nret = 0;
|
int nret = 0;
|
||||||
char *archive_err = NULL;
|
char *archive_err = NULL;
|
||||||
@ -84,7 +84,7 @@ static int client_copy_from_container(const struct client_arguments *args, const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_copy_from_container_response));
|
response = util_common_calloc_s(sizeof(struct isula_copy_from_container_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Event: Out of memory");
|
ERROR("Event: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -132,14 +132,14 @@ out:
|
|||||||
free(archive_err);
|
free(archive_err);
|
||||||
free(ops_err);
|
free(ops_err);
|
||||||
free_archive_copy_info(srcinfo);
|
free_archive_copy_info(srcinfo);
|
||||||
lcrc_copy_from_container_response_free(response);
|
isula_copy_from_container_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_copy_to_container_error(const struct lcrc_copy_to_container_response *response,
|
static void print_copy_to_container_error(const struct isula_copy_to_container_response *response,
|
||||||
const char *archive_err, int ret, const struct client_arguments *args)
|
const char *archive_err, int ret, const struct client_arguments *args)
|
||||||
{
|
{
|
||||||
if (response->cc != LCRD_SUCCESS || response->errmsg != NULL || response->server_errono != 0) {
|
if (response->cc != ISULAD_SUCCESS || response->errmsg != NULL || response->server_errono != 0) {
|
||||||
client_print_error(response->cc, response->server_errono, response->errmsg);
|
client_print_error(response->cc, response->server_errono, response->errmsg);
|
||||||
} else if (archive_err) {
|
} else if (archive_err) {
|
||||||
COMMAND_ERROR("Failed to archive: %s", archive_err);
|
COMMAND_ERROR("Failed to archive: %s", archive_err);
|
||||||
@ -151,9 +151,9 @@ static void print_copy_to_container_error(const struct lcrc_copy_to_container_re
|
|||||||
static int client_copy_to_container(const struct client_arguments *args, const char *id, const char *srcpath,
|
static int client_copy_to_container(const struct client_arguments *args, const char *id, const char *srcpath,
|
||||||
const char *destpath)
|
const char *destpath)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_copy_to_container_request request = { 0 };
|
struct isula_copy_to_container_request request = { 0 };
|
||||||
struct lcrc_copy_to_container_response *response = NULL;
|
struct isula_copy_to_container_response *response = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int nret = 0;
|
int nret = 0;
|
||||||
char *archive_err = NULL;
|
char *archive_err = NULL;
|
||||||
@ -168,7 +168,7 @@ static int client_copy_to_container(const struct client_arguments *args, const c
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_copy_to_container_response));
|
response = util_common_calloc_s(sizeof(struct isula_copy_to_container_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Event: Out of memory");
|
ERROR("Event: Out of memory");
|
||||||
return -1;
|
return -1;
|
||||||
@ -219,7 +219,7 @@ out:
|
|||||||
free(resolved);
|
free(resolved);
|
||||||
free(archive_err);
|
free(archive_err);
|
||||||
free_archive_copy_info(srcinfo);
|
free_archive_copy_info(srcinfo);
|
||||||
lcrc_copy_to_container_response_free(response);
|
isula_copy_to_container_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "lcrc_connect.h"
|
#include "isula_connect.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
@ -41,13 +41,13 @@ struct client_arguments g_cmd_exec_args = {};
|
|||||||
static int client_exec(const struct client_arguments *args, const struct command_fifo_config *fifos,
|
static int client_exec(const struct client_arguments *args, const struct command_fifo_config *fifos,
|
||||||
uint32_t *exit_code)
|
uint32_t *exit_code)
|
||||||
{
|
{
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_exec_request request = { 0 };
|
struct isula_exec_request request = { 0 };
|
||||||
struct lcrc_exec_response *response = NULL;
|
struct isula_exec_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_exec_response));
|
response = util_common_calloc_s(sizeof(struct isula_exec_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
@ -93,7 +93,7 @@ out:
|
|||||||
*exit_code = response->exit_code;
|
*exit_code = response->exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcrc_exec_response_free(response);
|
isula_exec_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,9 +222,9 @@ static int remote_cmd_exec_setup_tty(const struct client_arguments *args, bool *
|
|||||||
static int remote_cmd_exec(const struct client_arguments *args, uint32_t *exit_code)
|
static int remote_cmd_exec(const struct client_arguments *args, uint32_t *exit_code)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_exec_request request = { 0 };
|
struct isula_exec_request request = { 0 };
|
||||||
struct lcrc_exec_response *response = NULL;
|
struct isula_exec_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
struct termios oldtios;
|
struct termios oldtios;
|
||||||
bool reset_tty = false;
|
bool reset_tty = false;
|
||||||
@ -236,7 +236,7 @@ static int remote_cmd_exec(const struct client_arguments *args, uint32_t *exit_c
|
|||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_exec_response));
|
response = util_common_calloc_s(sizeof(struct isula_exec_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
return ECOMMON;
|
return ECOMMON;
|
||||||
@ -286,7 +286,7 @@ out:
|
|||||||
if (response->exit_code != 0) {
|
if (response->exit_code != 0) {
|
||||||
*exit_code = response->exit_code;
|
*exit_code = response->exit_code;
|
||||||
}
|
}
|
||||||
lcrc_exec_response_free(response);
|
isula_exec_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,9 +341,9 @@ out:
|
|||||||
static int do_resize_exec_console(const struct client_arguments *args, unsigned int height, unsigned int width)
|
static int do_resize_exec_console(const struct client_arguments *args, unsigned int height, unsigned int width)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
lcrc_connect_ops *ops = NULL;
|
isula_connect_ops *ops = NULL;
|
||||||
struct lcrc_resize_request request = { 0 };
|
struct isula_resize_request request = { 0 };
|
||||||
struct lcrc_resize_response *response = NULL;
|
struct isula_resize_response *response = NULL;
|
||||||
client_connect_config_t config = { 0 };
|
client_connect_config_t config = { 0 };
|
||||||
|
|
||||||
ops = get_connect_client_ops();
|
ops = get_connect_client_ops();
|
||||||
@ -358,7 +358,7 @@ static int do_resize_exec_console(const struct client_arguments *args, unsigned
|
|||||||
request.height = height;
|
request.height = height;
|
||||||
request.width = width;
|
request.width = width;
|
||||||
|
|
||||||
response = util_common_calloc_s(sizeof(struct lcrc_resize_response));
|
response = util_common_calloc_s(sizeof(struct isula_resize_response));
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -373,7 +373,7 @@ static int do_resize_exec_console(const struct client_arguments *args, unsigned
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lcrc_resize_response_free(response);
|
isula_resize_response_free(response);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
5
src/cmd/isulad/CMakeLists.txt
Normal file
5
src/cmd/isulad/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# get current directory sources files
|
||||||
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} top_srcs)
|
||||||
|
|
||||||
|
set(CMD_ISULAD_SRCS ${top_srcs} PARENT_SCOPE)
|
||||||
|
set(CMD_ISULAD_INCS ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
|
||||||
@ -22,9 +22,9 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "liblcrd.h"
|
#include "libisulad.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "lcrd_config.h"
|
#include "isulad_config.h"
|
||||||
|
|
||||||
static int set_daemon_default_tls_options(struct service_arguments *args)
|
static int set_daemon_default_tls_options(struct service_arguments *args)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ int service_arguments_init(struct service_arguments *args)
|
|||||||
args->argc = 0;
|
args->argc = 0;
|
||||||
args->argv = NULL;
|
args->argv = NULL;
|
||||||
|
|
||||||
args->progname = util_strdup_s("lcrd");
|
args->progname = util_strdup_s("isulad");
|
||||||
args->quiet = true;
|
args->quiet = true;
|
||||||
args->help = false;
|
args->help = false;
|
||||||
args->version = false;
|
args->version = false;
|
||||||
@ -108,9 +108,9 @@ int service_arguments_init(struct service_arguments *args)
|
|||||||
goto free_out;
|
goto free_out;
|
||||||
}
|
}
|
||||||
args->json_confs->engine = util_strdup_s("lcr");
|
args->json_confs->engine = util_strdup_s("lcr");
|
||||||
args->json_confs->group = util_strdup_s("lcrd");
|
args->json_confs->group = util_strdup_s("isulad");
|
||||||
args->json_confs->graph = util_strdup_s(LCRD_ROOT_PATH);
|
args->json_confs->graph = util_strdup_s(ISULAD_ROOT_PATH);
|
||||||
args->json_confs->state = util_strdup_s(LCRD_STATE_PATH);
|
args->json_confs->state = util_strdup_s(ISULAD_STATE_PATH);
|
||||||
args->json_confs->log_level = util_strdup_s("INFO");
|
args->json_confs->log_level = util_strdup_s("INFO");
|
||||||
args->json_confs->log_driver = util_strdup_s("file");
|
args->json_confs->log_driver = util_strdup_s("file");
|
||||||
args->json_confs->log_opts = (json_map_string_string *)util_common_calloc_s(sizeof(json_map_string_string));
|
args->json_confs->log_opts = (json_map_string_string *)util_common_calloc_s(sizeof(json_map_string_string));
|
||||||
@ -136,7 +136,7 @@ int service_arguments_init(struct service_arguments *args)
|
|||||||
args->max_file = 7;
|
args->max_file = 7;
|
||||||
args->max_size = 1024 * 1024;
|
args->max_size = 1024 * 1024;
|
||||||
|
|
||||||
args->json_confs->pidfile = util_strdup_s("/var/run/lcrd.pid");
|
args->json_confs->pidfile = util_strdup_s("/var/run/isulad.pid");
|
||||||
args->json_confs->storage_driver = util_strdup_s("overlay2");
|
args->json_confs->storage_driver = util_strdup_s("overlay2");
|
||||||
args->json_confs->native_umask = util_strdup_s(UMASK_SECURE);
|
args->json_confs->native_umask = util_strdup_s(UMASK_SECURE);
|
||||||
args->json_confs->image_service = true;
|
args->json_confs->image_service = true;
|
||||||
@ -12,8 +12,8 @@
|
|||||||
* Create: 2017-11-22
|
* Create: 2017-11-22
|
||||||
* Description: provide container server arguments definition
|
* Description: provide container server arguments definition
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#ifndef __LCRD_ARGUMENTS_H
|
#ifndef __ISULAD_ARGUMENTS_H
|
||||||
#define __LCRD_ARGUMENTS_H
|
#define __ISULAD_ARGUMENTS_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -68,5 +68,5 @@ int service_arguments_init(struct service_arguments *args);
|
|||||||
void service_arguments_free(struct service_arguments *args);
|
void service_arguments_free(struct service_arguments *args);
|
||||||
int server_log_opt_parser(struct service_arguments *args, const char *option);
|
int server_log_opt_parser(struct service_arguments *args, const char *option);
|
||||||
|
|
||||||
#endif /* __LCRD_ARGUMENTS_H */
|
#endif /* __ISULAD_ARGUMENTS_H */
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "liblcrd.h"
|
#include "libisulad.h"
|
||||||
|
|
||||||
#ifdef ENABLE_OCI_IMAGE
|
#ifdef ENABLE_OCI_IMAGE
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
@ -31,12 +31,12 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "isulad_daemon_configs.h"
|
#include "isulad_daemon_configs.h"
|
||||||
|
|
||||||
const char lcrd_desc[] = "GLOBAL OPTIONS:";
|
const char isulad_desc[] = "GLOBAL OPTIONS:";
|
||||||
const char lcrd_usage[] = "[global options]";
|
const char isulad_usage[] = "[global options]";
|
||||||
|
|
||||||
void print_version()
|
void print_version()
|
||||||
{
|
{
|
||||||
printf("Version %s, commit %s\n", VERSION, LCRD_GIT_COMMIT);
|
printf("Version %s, commit %s\n", VERSION, ISULAD_GIT_COMMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int server_callback_log_opt(command_option_t *option, const char *value)
|
int server_callback_log_opt(command_option_t *option, const char *value)
|
||||||
@ -60,7 +60,8 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void command_init_lcrd(command_t *self, command_option_t *options, int options_len, int argc, const char **argv,
|
static void command_init_isulad(command_t *self, command_option_t *options, int options_len, int argc,
|
||||||
|
const char **argv,
|
||||||
const char *description, const char *usage)
|
const char *description, const char *usage)
|
||||||
{
|
{
|
||||||
self->name = argv[0];
|
self->name = argv[0];
|
||||||
@ -70,16 +71,16 @@ static void command_init_lcrd(command_t *self, command_option_t *options, int op
|
|||||||
self->description = description;
|
self->description = description;
|
||||||
self->options = options;
|
self->options = options;
|
||||||
self->option_count = options_len;
|
self->option_count = options_len;
|
||||||
self->type = "lcrd";
|
self->type = "isulad";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tries to execute a command in the command list.
|
// Tries to execute a command in the command list.
|
||||||
int parse_args(struct service_arguments *args, int argc, const char **argv)
|
int parse_args(struct service_arguments *args, int argc, const char **argv)
|
||||||
{
|
{
|
||||||
command_t cmd = { 0 };
|
command_t cmd = { 0 };
|
||||||
struct command_option options[] = { LCRD_OPTIONS(args) };
|
struct command_option options[] = { ISULAD_OPTIONS(args) };
|
||||||
command_init_lcrd(&cmd, options, sizeof(options) / sizeof(options[0]), argc, (const char **)argv, lcrd_desc,
|
command_init_isulad(&cmd, options, sizeof(options) / sizeof(options[0]), argc, (const char **)argv, isulad_desc,
|
||||||
lcrd_usage);
|
isulad_usage);
|
||||||
if (command_parse_args(&cmd, &args->argc, &args->argv)) {
|
if (command_parse_args(&cmd, &args->argc, &args->argv)) {
|
||||||
exit(EINVALIDARGS);
|
exit(EINVALIDARGS);
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ static int check_args_hosts_conf(const char **array, size_t size)
|
|||||||
/* validate unix/tcp socket name */
|
/* validate unix/tcp socket name */
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if (!util_validate_socket(array[i])) {
|
if (!util_validate_socket(array[i])) {
|
||||||
lcrd_set_error_message("Invalid socket name: %s", array[i]);
|
isulad_set_error_message("Invalid socket name: %s", array[i]);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -340,7 +341,7 @@ static int check_hosts_specified_conflict(const struct service_arguments *args)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
COMMAND_ERROR("unable to configure the lcrd with file %s: "
|
COMMAND_ERROR("unable to configure the isulad with file %s: "
|
||||||
"the following directives are specified both as a flag and in the configuration file: hosts: "
|
"the following directives are specified both as a flag and in the configuration file: hosts: "
|
||||||
"(from flag: [%s], from file: [%s])",
|
"(from flag: [%s], from file: [%s])",
|
||||||
ISULAD_DAEMON_JSON_CONF_FILE, flag_hosts, file_hosts);
|
ISULAD_DAEMON_JSON_CONF_FILE, flag_hosts, file_hosts);
|
||||||
@ -523,7 +524,7 @@ static int check_conf_default_ulimit(const struct service_arguments *args)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_ERROR("unable to configure the lcrd with file %s: "
|
COMMAND_ERROR("unable to configure the isulad with file %s: "
|
||||||
"the following directives are specified both as a flag and in the configuration file: "
|
"the following directives are specified both as a flag and in the configuration file: "
|
||||||
"default-ulimits: (from flag: %s, from file: %s)",
|
"default-ulimits: (from flag: %s, from file: %s)",
|
||||||
ISULAD_DAEMON_JSON_CONF_FILE, flag_def_ulimit, file_def_ulimit);
|
ISULAD_DAEMON_JSON_CONF_FILE, flag_def_ulimit, file_def_ulimit);
|
||||||
@ -12,8 +12,8 @@
|
|||||||
* Create: 2017-11-22
|
* Create: 2017-11-22
|
||||||
* Description: provide container commands definition
|
* Description: provide container commands definition
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#ifndef __LCRD_COMMAND_H
|
#ifndef __ISULAD_COMMAND_H
|
||||||
#define __LCRD_COMMAND_H
|
#define __ISULAD_COMMAND_H
|
||||||
#include "arguments.h"
|
#include "arguments.h"
|
||||||
|
|
||||||
void print_common_help();
|
void print_common_help();
|
||||||
@ -21,14 +21,14 @@ void print_version();
|
|||||||
|
|
||||||
// Default help command if implementation doesn't prvide one
|
// Default help command if implementation doesn't prvide one
|
||||||
int commmand_default_help(const char * const program_name, int argc, char **argv);
|
int commmand_default_help(const char * const program_name, int argc, char **argv);
|
||||||
int command_lcrd_valid_socket(command_option_t *option, const char *arg);
|
int command_isulad_valid_socket(command_option_t *option, const char *arg);
|
||||||
int parse_args(struct service_arguments *args, int argc, const char **argv);
|
int parse_args(struct service_arguments *args, int argc, const char **argv);
|
||||||
int check_args(struct service_arguments *args);
|
int check_args(struct service_arguments *args);
|
||||||
int update_hosts(struct service_arguments *args);
|
int update_hosts(struct service_arguments *args);
|
||||||
int update_default_ulimit(struct service_arguments *args);
|
int update_default_ulimit(struct service_arguments *args);
|
||||||
|
|
||||||
|
|
||||||
#define LCRD_OPTIONS(cmdargs) \
|
#define ISULAD_OPTIONS(cmdargs) \
|
||||||
{ CMD_OPT_TYPE_CALLBACK, false, "host", 'H', &(cmdargs)->hosts, \
|
{ CMD_OPT_TYPE_CALLBACK, false, "host", 'H', &(cmdargs)->hosts, \
|
||||||
"The socket name used to create gRPC server", command_valid_socket_append_array }, \
|
"The socket name used to create gRPC server", command_valid_socket_append_array }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "pidfile", 'p', &(cmdargs)->json_confs->pidfile, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "pidfile", 'p', &(cmdargs)->json_confs->pidfile, \
|
||||||
@ -37,7 +37,7 @@ int update_default_ulimit(struct service_arguments *args);
|
|||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "hook-spec", 0, &(cmdargs)->json_confs->hook_spec, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "hook-spec", 0, &(cmdargs)->json_confs->hook_spec, \
|
||||||
"Default hook spec file applied to all containers", NULL }, \
|
"Default hook spec file applied to all containers", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "graph", 'g', &(cmdargs)->json_confs->graph, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "graph", 'g', &(cmdargs)->json_confs->graph, \
|
||||||
"Root directory of the LCRD runtime", NULL }, \
|
"Root directory of the iSulad runtime", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "state", 'S', &(cmdargs)->json_confs->state, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "state", 'S', &(cmdargs)->json_confs->state, \
|
||||||
"Root directory for execution state files", NULL }, \
|
"Root directory for execution state files", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "start-timeout", 0, &(cmdargs)->json_confs->start_timeout, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "start-timeout", 0, &(cmdargs)->json_confs->start_timeout, \
|
||||||
@ -52,7 +52,7 @@ int update_default_ulimit(struct service_arguments *args);
|
|||||||
server_callback_log_opt }, \
|
server_callback_log_opt }, \
|
||||||
{ CMD_OPT_TYPE_BOOL, false, "version", 'V', &(cmdargs)->version, "Print the version", NULL }, \
|
{ CMD_OPT_TYPE_BOOL, false, "version", 'V', &(cmdargs)->version, "Print the version", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "group", 'G', &(cmdargs)->json_confs->group, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "group", 'G', &(cmdargs)->json_confs->group, \
|
||||||
"Group for the unix socket(default is lcrd)", NULL }, \
|
"Group for the unix socket(default is isulad)", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "storage-driver", 0, &(cmdargs)->json_confs->storage_driver, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "storage-driver", 0, &(cmdargs)->json_confs->storage_driver, \
|
||||||
"Storage driver to use(default overlay2)", NULL }, \
|
"Storage driver to use(default overlay2)", NULL }, \
|
||||||
{ CMD_OPT_TYPE_CALLBACK, false, "storage-opt", 's', &(cmdargs)->json_confs->storage_opts, \
|
{ CMD_OPT_TYPE_CALLBACK, false, "storage-opt", 's', &(cmdargs)->json_confs->storage_opts, \
|
||||||
@ -72,7 +72,7 @@ int update_default_ulimit(struct service_arguments *args);
|
|||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "image-opt-timeout", 0, &(cmdargs)->json_confs->image_opt_timeout, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "image-opt-timeout", 0, &(cmdargs)->json_confs->image_opt_timeout, \
|
||||||
"Max timeout(default 5m) for image operation", NULL }, \
|
"Max timeout(default 5m) for image operation", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "image_server_sock_addr", 0, &(cmdargs)->json_confs->image_server_sock_addr, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "image_server_sock_addr", 0, &(cmdargs)->json_confs->image_server_sock_addr, \
|
||||||
"Set isula image remote server socket address, Default: unix:///var/run/lcrd/isula_image.sock", NULL }, \
|
"Set isula image remote server socket address, Default: unix:///var/run/isulad/isula_image.sock", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "network-plugin", 0, &(cmdargs)->json_confs->network_plugin, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "network-plugin", 0, &(cmdargs)->json_confs->network_plugin, \
|
||||||
"Set network plugin, default is null, suppport null and cni", NULL }, \
|
"Set network plugin, default is null, suppport null and cni", NULL }, \
|
||||||
{ CMD_OPT_TYPE_STRING_DUP, false, "cni-bin-dir", 0, &(cmdargs)->json_confs->cni_bin_dir, \
|
{ CMD_OPT_TYPE_STRING_DUP, false, "cni-bin-dir", 0, &(cmdargs)->json_confs->cni_bin_dir, \
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* See the Mulan PSL v1 for more details.
|
* See the Mulan PSL v1 for more details.
|
||||||
* Author: lifeng
|
* Author: lifeng
|
||||||
* Create: 2017-11-22
|
* Create: 2017-11-22
|
||||||
* Description: provide init process of lcrd
|
* Description: provide init process of isulad
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -37,13 +37,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "liblcrd.h"
|
#include "libisulad.h"
|
||||||
#include "collector.h"
|
#include "collector.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lcrd_config.h"
|
#include "isulad_config.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "sysinfo.h"
|
#include "sysinfo.h"
|
||||||
#include "verify.h"
|
#include "verify.h"
|
||||||
@ -75,7 +75,7 @@ sem_t g_daemon_shutdown_sem;
|
|||||||
static int create_client_run_path(const char *group)
|
static int create_client_run_path(const char *group)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const char *rundir = "/var/run/lcrc";
|
const char *rundir = "/var/run/isula";
|
||||||
if (group == NULL) {
|
if (group == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ static void umount_daemon_mntpoint()
|
|||||||
{
|
{
|
||||||
char *mntdir = NULL;
|
char *mntdir = NULL;
|
||||||
|
|
||||||
mntdir = conf_get_lcrd_mount_rootfs();
|
mntdir = conf_get_isulad_mount_rootfs();
|
||||||
if (mntdir == NULL) {
|
if (mntdir == NULL) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
} else {
|
} else {
|
||||||
@ -211,9 +211,9 @@ static void clean_residual_files()
|
|||||||
free(checked_flag);
|
free(checked_flag);
|
||||||
|
|
||||||
/* remove pid file */
|
/* remove pid file */
|
||||||
fname = conf_get_lcrd_pidfile();
|
fname = conf_get_isulad_pidfile();
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
ERROR("Failed to get LCRD pid file path");
|
ERROR("Failed to get isulad pid file path");
|
||||||
} else if (unlink(fname) && errno != ENOENT) {
|
} else if (unlink(fname) && errno != ENOENT) {
|
||||||
WARN("Unlink file: %s error: %s", fname, strerror(errno));
|
WARN("Unlink file: %s error: %s", fname, strerror(errno));
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ static int ignore_signals()
|
|||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ignore SIGHUP so lcrd process still exists after
|
* Ignore SIGHUP so isulad process still exists after
|
||||||
* terminal die.
|
* terminal die.
|
||||||
*/
|
*/
|
||||||
(void)memset(&sa, 0, sizeof(struct sigaction));
|
(void)memset(&sa, 0, sizeof(struct sigaction));
|
||||||
@ -354,14 +354,14 @@ static int daemonize()
|
|||||||
|
|
||||||
umask(0000);
|
umask(0000);
|
||||||
|
|
||||||
if (lcrd_server_conf_rdlock()) {
|
if (isulad_server_conf_rdlock()) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = conf_get_server_conf();
|
args = conf_get_server_conf();
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
ERROR("Failed to get lcrd server config");
|
ERROR("Failed to get isulad server config");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ static int daemonize()
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
unlock_out:
|
unlock_out:
|
||||||
if (lcrd_server_conf_unlock()) {
|
if (isulad_server_conf_unlock()) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@ -394,7 +394,7 @@ int check_and_save_pid(const char *fn)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
struct flock lk;
|
struct flock lk;
|
||||||
char pidbuf[LCRD_NUMSTRLEN64] = { 0 };
|
char pidbuf[ISULAD_NUMSTRLEN64] = { 0 };
|
||||||
|
|
||||||
if (fn == NULL) {
|
if (fn == NULL) {
|
||||||
ERROR("Input error");
|
ERROR("Input error");
|
||||||
@ -419,7 +419,7 @@ int check_and_save_pid(const char *fn)
|
|||||||
lk.l_len = 0;
|
lk.l_len = 0;
|
||||||
if (fcntl(fd, F_SETLK, &lk) != 0) {
|
if (fcntl(fd, F_SETLK, &lk) != 0) {
|
||||||
/* another daemonize instance is already running, don't start up */
|
/* another daemonize instance is already running, don't start up */
|
||||||
COMMAND_ERROR("Pid file found, ensure lcrd is not running or delete pid file %s"
|
COMMAND_ERROR("Pid file found, ensure isulad is not running or delete pid file %s"
|
||||||
" or please specify another pid file", fn);
|
" or please specify another pid file", fn);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
@ -451,7 +451,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_and_set_default_lcrd_log_file(struct service_arguments *args)
|
int check_and_set_default_isulad_log_file(struct service_arguments *args)
|
||||||
{
|
{
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -482,7 +482,7 @@ static int set_parent_mount_dir(struct service_arguments *args)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (strlen(args->json_confs->graph) > (SIZE_MAX - strlen("/mnt/rootfs")) - 1) {
|
if (strlen(args->json_confs->graph) > (SIZE_MAX - strlen("/mnt/rootfs")) - 1) {
|
||||||
ERROR("Root directory of the LCRD runtime is too long");
|
ERROR("Root directory of the isulad runtime is too long");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
len = strlen(args->json_confs->graph) + strlen("/mnt/rootfs") + 1;
|
len = strlen(args->json_confs->graph) + strlen("/mnt/rootfs") + 1;
|
||||||
@ -547,7 +547,7 @@ static int parse_hook_spec(const char *specfile, oci_runtime_spec_hooks **phooks
|
|||||||
hooks = oci_runtime_spec_hooks_parse_file(specfile, NULL, &err);
|
hooks = oci_runtime_spec_hooks_parse_file(specfile, NULL, &err);
|
||||||
if (hooks == NULL) {
|
if (hooks == NULL) {
|
||||||
ERROR("Failed to parse hook-spec file: %s", err);
|
ERROR("Failed to parse hook-spec file: %s", err);
|
||||||
lcrd_set_error_message("Invalid hook-spec file(%s) in server conf.", specfile);
|
isulad_set_error_message("Invalid hook-spec file(%s) in server conf.", specfile);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ static int update_set_default_log_file(struct service_arguments *args)
|
|||||||
args->quiet = false;
|
args->quiet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_and_set_default_lcrd_log_file(args)) {
|
if (check_and_set_default_isulad_log_file(args)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -911,16 +911,16 @@ static int init_log_gather_thread(const char *log_full_path, struct log_config *
|
|||||||
return log_gather_exitcode;
|
return log_gather_exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_get_log_path(char **log_full_path, char **fifo_full_path)
|
static int isulad_get_log_path(char **log_full_path, char **fifo_full_path)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
*log_full_path = conf_get_lcrd_log_file();
|
*log_full_path = conf_get_isulad_log_file();
|
||||||
if (*log_full_path == NULL) {
|
if (*log_full_path == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
*fifo_full_path = conf_get_lcrd_log_gather_fifo_path();
|
*fifo_full_path = conf_get_isulad_log_gather_fifo_path();
|
||||||
if (*fifo_full_path == NULL) {
|
if (*fifo_full_path == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
@ -929,7 +929,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_server_init_log(const struct service_arguments *args, const char *log_full_path,
|
static int isulad_server_init_log(const struct service_arguments *args, const char *log_full_path,
|
||||||
const char *fifo_full_path)
|
const char *fifo_full_path)
|
||||||
{
|
{
|
||||||
#define FIFO_DRIVER "fifo"
|
#define FIFO_DRIVER "fifo"
|
||||||
@ -964,7 +964,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_server_pre_init(const struct service_arguments *args, const char *log_full_path,
|
static int isulad_server_pre_init(const struct service_arguments *args, const char *log_full_path,
|
||||||
const char *fifo_full_path)
|
const char *fifo_full_path)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -975,7 +975,7 @@ static int lcrd_server_pre_init(const struct service_arguments *args, const char
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_init_log(args, log_full_path, fifo_full_path) != 0) {
|
if (isulad_server_init_log(args, log_full_path, fifo_full_path) != 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1016,28 +1016,28 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_server_init_common()
|
static int isulad_server_init_common()
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
struct service_arguments *args = NULL;
|
struct service_arguments *args = NULL;
|
||||||
char *log_full_path = NULL;
|
char *log_full_path = NULL;
|
||||||
char *fifo_full_path = NULL;
|
char *fifo_full_path = NULL;
|
||||||
|
|
||||||
if (lcrd_get_log_path(&log_full_path, &fifo_full_path) != 0) {
|
if (isulad_get_log_path(&log_full_path, &fifo_full_path) != 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_conf_rdlock()) {
|
if (isulad_server_conf_rdlock()) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = conf_get_server_conf();
|
args = conf_get_server_conf();
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
ERROR("Failed to get lcrd server config");
|
ERROR("Failed to get isulad server config");
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_pre_init(args, log_full_path, fifo_full_path) != 0) {
|
if (isulad_server_pre_init(args, log_full_path, fifo_full_path) != 0) {
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,7 +1063,7 @@ static int lcrd_server_init_common()
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
unlock_out:
|
unlock_out:
|
||||||
if (lcrd_server_conf_unlock()) {
|
if (isulad_server_conf_unlock()) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1153,18 +1153,18 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_server_init_service()
|
static int isulad_server_init_service()
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
struct service_arguments *args = NULL;
|
struct service_arguments *args = NULL;
|
||||||
|
|
||||||
if (lcrd_server_conf_rdlock()) {
|
if (isulad_server_conf_rdlock()) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = conf_get_server_conf();
|
args = conf_get_server_conf();
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
ERROR("Failed to get lcrd server config");
|
ERROR("Failed to get isulad server config");
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
}
|
}
|
||||||
#ifdef GRPC_CONNECTOR
|
#ifdef GRPC_CONNECTOR
|
||||||
@ -1184,7 +1184,7 @@ static int lcrd_server_init_service()
|
|||||||
}
|
}
|
||||||
|
|
||||||
unlock_out:
|
unlock_out:
|
||||||
if (lcrd_server_conf_unlock()) {
|
if (isulad_server_conf_unlock()) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1192,12 +1192,12 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcrd_server_init_engines()
|
static int isulad_server_init_engines()
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *engine = NULL;
|
char *engine = NULL;
|
||||||
|
|
||||||
engine = conf_get_lcrd_engine();
|
engine = conf_get_isulad_engine();
|
||||||
if (engine == NULL) {
|
if (engine == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
@ -1246,13 +1246,13 @@ static int start_monitord()
|
|||||||
msync.monitord_sem = &monitord_sem;
|
msync.monitord_sem = &monitord_sem;
|
||||||
msync.exit_code = &monitord_exitcode;
|
msync.exit_code = &monitord_exitcode;
|
||||||
if (sem_init(msync.monitord_sem, 0, 0)) {
|
if (sem_init(msync.monitord_sem, 0, 0)) {
|
||||||
lcrd_set_error_message("Failed to init monitor sem");
|
isulad_set_error_message("Failed to init monitor sem");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_monitord(&msync)) {
|
if (new_monitord(&msync)) {
|
||||||
lcrd_set_error_message("Create monitord thread failed");
|
isulad_set_error_message("Create monitord thread failed");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
sem_destroy(msync.monitord_sem);
|
sem_destroy(msync.monitord_sem);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1261,7 +1261,7 @@ static int start_monitord()
|
|||||||
sem_wait(msync.monitord_sem);
|
sem_wait(msync.monitord_sem);
|
||||||
sem_destroy(msync.monitord_sem);
|
sem_destroy(msync.monitord_sem);
|
||||||
if (monitord_exitcode) {
|
if (monitord_exitcode) {
|
||||||
lcrd_set_error_message("Monitord start failed");
|
isulad_set_error_message("Monitord start failed");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1323,7 +1323,7 @@ static int start_daemon_threads(char **msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_monitord()) {
|
if (start_monitord()) {
|
||||||
*msg = g_lcrd_errmsg ? g_lcrd_errmsg : "Failed to init cgroups path";
|
*msg = g_isulad_errmsg ? g_isulad_errmsg : "Failed to init cgroups path";
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1356,7 @@ static int pre_init_daemon_log()
|
|||||||
{
|
{
|
||||||
struct log_config lconf = { 0 };
|
struct log_config lconf = { 0 };
|
||||||
|
|
||||||
lconf.name = "lcrd";
|
lconf.name = "isulad";
|
||||||
lconf.quiet = true;
|
lconf.quiet = true;
|
||||||
lconf.file = NULL;
|
lconf.file = NULL;
|
||||||
lconf.priority = "ERROR";
|
lconf.priority = "ERROR";
|
||||||
@ -1373,15 +1373,15 @@ static int pre_init_daemon(int argc, char **argv, char **msg)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
/*
|
/*
|
||||||
* must call lcrd by root
|
* must call isulad by root
|
||||||
*/
|
*/
|
||||||
if (geteuid() != 0) {
|
if (geteuid() != 0) {
|
||||||
*msg = "LCRD must be called by root";
|
*msg = "iSulad must be called by root";
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server_conf_parse_save(argc, (const char **)argv)) {
|
if (server_conf_parse_save(argc, (const char **)argv)) {
|
||||||
*msg = g_lcrd_errmsg ? g_lcrd_errmsg : "Failed to parse and save server conf";
|
*msg = g_isulad_errmsg ? g_isulad_errmsg : "Failed to parse and save server conf";
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,7 +1391,7 @@ static int pre_init_daemon(int argc, char **argv, char **msg)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_init_engines()) {
|
if (isulad_server_init_engines()) {
|
||||||
*msg = "Failed to init engines";
|
*msg = "Failed to init engines";
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1418,7 +1418,7 @@ int main(int argc, char **argv)
|
|||||||
double use_time = 0;
|
double use_time = 0;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
|
|
||||||
prctl(PR_SET_NAME, "lcrd");
|
prctl(PR_SET_NAME, "isulad");
|
||||||
|
|
||||||
if (pre_init_daemon_log() != 0) {
|
if (pre_init_daemon_log() != 0) {
|
||||||
exit(ECOMMON);
|
exit(ECOMMON);
|
||||||
@ -1434,12 +1434,12 @@ int main(int argc, char **argv)
|
|||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_init_common() != 0) {
|
if (isulad_server_init_common() != 0) {
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init_cgroups_path("/lxc", 0)) {
|
if (init_cgroups_path("/lxc", 0)) {
|
||||||
msg = g_lcrd_errmsg ? g_lcrd_errmsg : "Failed to init cgroups path";
|
msg = g_isulad_errmsg ? g_isulad_errmsg : "Failed to init cgroups path";
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,7 +1452,7 @@ int main(int argc, char **argv)
|
|||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcrd_server_init_service()) {
|
if (isulad_server_init_service()) {
|
||||||
msg = "Failed to init services";
|
msg = "Failed to init services";
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
@ -1465,7 +1465,7 @@ int main(int argc, char **argv)
|
|||||||
clock_gettime(CLOCK_MONOTONIC, &t_end);
|
clock_gettime(CLOCK_MONOTONIC, &t_end);
|
||||||
use_time = (double)(t_end.tv_sec - t_start.tv_sec) * (double)1000000000 + (double)(t_end.tv_nsec - t_start.tv_nsec);
|
use_time = (double)(t_end.tv_sec - t_start.tv_sec) * (double)1000000000 + (double)(t_end.tv_nsec - t_start.tv_nsec);
|
||||||
use_time /= 1000000000;
|
use_time /= 1000000000;
|
||||||
INFO("Lcrd successfully booted in %.3f s", use_time);
|
INFO("iSulad successfully booted in %.3f s", use_time);
|
||||||
#ifdef GRPC_CONNECTOR
|
#ifdef GRPC_CONNECTOR
|
||||||
INFO("Starting grpc server...");
|
INFO("Starting grpc server...");
|
||||||
#else
|
#else
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# get current directory sources files
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_base_srcs)
|
|
||||||
|
|
||||||
set(LCRC_BASE_SRCS
|
|
||||||
${lcrc_base_srcs}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# get current directory sources files
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_extend_srcs)
|
|
||||||
|
|
||||||
set(LCRC_EXTEND_SRCS
|
|
||||||
${lcrc_extend_srcs}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# get current directory sources files
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_images_srcs)
|
|
||||||
|
|
||||||
set(LCRC_IMAGES_SRCS
|
|
||||||
${lcrc_images_srcs}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# get current directory sources files
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_information_srcs)
|
|
||||||
|
|
||||||
set(LCRC_INFORMATION_SRCS
|
|
||||||
${lcrc_information_srcs}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# get current directory sources files
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} lcrc_stream_srcs)
|
|
||||||
|
|
||||||
set(LCRC_STREAM_SRCS
|
|
||||||
${lcrc_stream_srcs}
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user