!6 modify package from isulad-tools to syscontainer-tools

Merge pull request !6 from zhangsong234/master
This commit is contained in:
openeuler-ci-bot 2020-02-12 16:15:02 +08:00 committed by Gitee
commit f25c2f5869
71 changed files with 303 additions and 297 deletions

View File

@ -12,7 +12,7 @@
### general
* change Mtu range (MR: #80)
* remove 'add-path/remove-path' commands from isulad-tools (MR: #82)
* remove 'add-path/remove-path' commands from syscontainer-tools (MR: #82)
* network: config net device 'tx/sg/tso' on (MR: #81)
* fix some minor issue(security check, file mode...) (MR: #84)
* fix when supply empty mac address, `add-nic` will panic (MR: #85)
@ -23,22 +23,22 @@
### general
* reorginzed the isulad-tools code (MR: #75)
* use`isulad-tools` in `isulad-tools_wrapper` instead of `isula exec` (MR: #76)
* reorginzed the syscontainer-tools code (MR: #75)
* use`syscontainer-tools` in `syscontainer-tools_wrapper` instead of `isula exec` (MR: #76)
* fix filelock can't lock accross the process issue (MR: #78)
### hooks
* combine 3 hooks binary to `isulad-hooks` (MR: #75)
* combine 3 hooks binary to `syscontainer-hooks` (MR: #75)
## v0.6 (2017-6-23)
### general
* isulad-tools add `add-route & del-nic & del-route` command line. (MR: #71, #68)
* isulad-tools add-nic supports network interface config. (MR: #68)
* isulad-tools supports fidsk in container. (MR: #70)
* isulad-tools could only remove the devices added by isulad-tools (MR: #66)
* syscontainer-tools add `add-route & del-nic & del-route` command line. (MR: #71, #68)
* syscontainer-tools add-nic supports network interface config. (MR: #68)
* syscontainer-tools supports fidsk in container. (MR: #70)
* syscontainer-tools could only remove the devices added by syscontainer-tools (MR: #66)
### network-hook
@ -51,11 +51,11 @@
* fix some dir permissions for potential security risk. (MR: #56, #57, #62)
* move empty_systemd.sh to iSulad project. (MR: #60)
### isulad-tools
### syscontainer-tools
* fix isulad-tools subcommand display orders. (MR: #55)
* when iSulad daemon and isulad-tools are not in the same cgroup path, device-hook will fail to update cgroup permissions. (MR: #58)
* when containers specify cgroup folder (with `--cgroup-parent` flag), isulad-tools will fail to update device cgroup permissions. (MR: #64)
* fix syscontainer-tools subcommand display orders. (MR: #55)
* when iSulad daemon and syscontainer-tools are not in the same cgroup path, device-hook will fail to update cgroup permissions. (MR: #58)
* when containers specify cgroup folder (with `--cgroup-parent` flag), syscontainer-tools will fail to update device cgroup permissions. (MR: #64)
### oci-relabel-hook
@ -67,9 +67,9 @@
* fix some golang security problems based on review comments
### isulad-tools
### syscontainer-tools
* Fix find cgroup path issue when isulad-tools run in container
* Fix find cgroup path issue when syscontainer-tools run in container
* Add upstart support for system container
## v0.3 (2017-1-9)
@ -84,9 +84,9 @@
* device-hook: Update cgroup permission in prestart hook not poststart
* oci-relabel-hook: Use golang to refact oci-relabel-hook
### isulad-tools
### syscontainer-tools
* Add "--force" flag for `isulad-tools add-device`
* Add "--force" flag for `syscontainer-tools add-device`
* can not use fdisk to partition when add a device to a container
@ -97,7 +97,7 @@
* device-hook: newly introduced device hook to save config for new added devices.
* oci-relabel-hook: use container's SELinux policy to adapt various images.
### isulad-tools
### syscontainer-tools
* use device-hook instead of "isula update" to keep resource persistent in container.
* add syslog support, all log will be written to syslog.
@ -119,7 +119,7 @@ This is first initial release with lots of new features:
* network-hook: move network interface from host to container when container starts.
* oci-relabel-hook: relabel container's rootfs when container starts.
### isulad-tools
### syscontainer-tools
New Commands:

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -7,7 +7,7 @@
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v1 for more details.
# Description: makefile for isulad-tools
# Description: makefile for syscontainer-tools
# Author: zhangwei
# Create: 2018-01-18
@ -17,29 +17,29 @@ DEPS_LINK := $(CURDIR)/vendor/
TAGS="cgo static_build"
VERSION := $(shell cat ./VERSION)
BEP_DIR=/tmp/isulad-tools-build-bep
BEP_FLAGS=-tmpdir=/tmp/isulad-tools-build-bep
BEP_DIR=/tmp/syscontainer-tools-build-bep
BEP_FLAGS=-tmpdir=/tmp/syscontainer-tools-build-bep
GO_LDFLAGS="-s -w -buildid=IdByiSula -extldflags=-zrelro -extldflags=-znow $(BEP_FLAGS) -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
ENV = GOPATH=${GOPATH} CGO_ENABLED=1
## PLEASE be noticed that the vendor dir can only work with golang > 1.6 !!
all: dep isulad-tools isulad-hooks
all: dep syscontainer-tools syscontainer-hooks
dep:
mkdir -p $(BEP_DIR)
init:
sh -x apply-patch
isulad-tools: $(SOURCES) | $(DEPS_LINK)
@echo "Making isulad-tools..."
${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/isulad-tools .
syscontainer-tools: $(SOURCES) | $(DEPS_LINK)
@echo "Making syscontainer-tools..."
${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-tools .
@echo "Done!"
isulad-hooks: $(SOURCES) | $(DEPS_LINK)
@echo "Making isulad-hooks..."
${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/isulad-hooks ./hooks/isulad-hooks
syscontainer-hooks: $(SOURCES) | $(DEPS_LINK)
@echo "Making syscontainer-hooks..."
${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-hooks ./hooks/syscontainer-hooks
@echo "Done!"
localtest:

View File

@ -1,38 +1,38 @@
# isulad-tools
# syscontainer-tools
## Introduction
**isulad-tools** is a fully customized tool,
**syscontainer-tools** is a fully customized tool,
it is a small auxiliary tool which is expected to work with isulad with hook support,
and provides enhanced functions which is inappropriate to be included in isulad itself.
The project includes two main parts: `isulad-tools` and `hooks`.
`isulad-tools` is used for dynamically operating on running containers,
The project includes two main parts: `syscontainer-tools` and `hooks`.
`syscontainer-tools` is used for dynamically operating on running containers,
and `hooks` is used for executing user defined program at some special timepoint of container's lifecycle.
## Hooks
We provide isulad hooks function.
We provide syscontainer hooks function.
* isulad-hooks:
1. insert block devices added by isulad-tools into container when container restarts(prestart state).
2. insert network interfaces and route rules added by isulad-tools into container when container restarts(prestart state).
* syscontainer-hooks:
1. insert block devices added by syscontainer-tools into container when container restarts(prestart state).
2. insert network interfaces and route rules added by syscontainer-tools into container when container restarts(prestart state).
3. remove udev rules and leaking network interfaces when container stops(post-stop state).
4. handling oci relabel for container in prestart and post stop state.
You could use hook spec to customise your hooks.
For detailed information, See [introduction of isulad-hooks](hooks/isulad-hooks/README.md)
For detailed information, See [introduction of syscontainer-hooks](hooks/syscontainer-hooks/README.md)
## isulad-tools
## syscontainer-tools
Basic usage of `isulad-tools`:
Basic usage of `syscontainer-tools`:
```
NAME:
isulad-tools - Enhanced tools for IT isulad
syscontainer-tools - Enhanced tools for IT isulad
USAGE:
isulad-tools [global options] command [command options] [arguments...]
syscontainer-tools [global options] command [command options] [arguments...]
VERSION:
v0.9
@ -58,7 +58,7 @@ GLOBAL OPTIONS:
--version, -v print the version
```
For usage of each command, you can check with `--help`, e.g. `isulad-tools add-device --help`
For usage of each command, you can check with `--help`, e.g. `syscontainer-tools add-device --help`
## Contributions

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -23,14 +23,14 @@ import (
"strings"
"sync"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/types"
)
const (
defaultConfigFile = "device_hook.json"
// IsuladToolsDir is isulad-tools run dir
IsuladToolsDir = "/run/isulad-tools"
// IsuladToolsDir is syscontainer-tools run dir
IsuladToolsDir = "/run/syscontainer-tools"
)
// QosType defines the qos type by int

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -19,7 +19,7 @@ import (
"os"
"strings"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
)
// HostMapping host path mapping to container path
@ -209,7 +209,7 @@ func (config *ContainerHookConfig) addBind(bind *types.Bind) (bool, error) {
}
func (config *ContainerHookConfig) removeBind(bind *types.Bind) (bool, error) {
// if in add array, remove it, will not restore to Rm array, as it is added by isulad-tools.
// if in add array, remove it, will not restore to Rm array, as it is added by syscontainer-tools.
if index := config.bindIndexInArray(bind, config.Binds); index != -1 {
config.dirty = true
config.Binds = append(config.Binds[:index], config.Binds[index+1:]...)

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -15,12 +15,12 @@ package config
import (
"fmt"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
"path/filepath"
)
var (
// IsuladToolsDirNetns is isulad-tools netns dir
// IsuladToolsDirNetns is syscontainer-tools netns dir
IsuladToolsDirNetns = filepath.Join(IsuladToolsDir, "netns")
)
@ -95,7 +95,7 @@ func (config *ContainerHookConfig) UpdateNetworkInterface(nic *types.InterfaceCo
return nil
}
// IsRouteExist will check if the route is added by isulad-tools
// IsRouteExist will check if the route is added by syscontainer-tools
func (config *ContainerHookConfig) IsRouteExist(route *types.Route) bool {
for _, eRoute := range config.NetworkRoutes {
if types.IsSameRoute(route, eRoute) {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -194,7 +194,7 @@ func getIsuladContainerSpec(id string) (spec *specs.Spec, err error) {
if err != nil {
return nil, err
}
configPath := fmt.Sprintf("%s/engines/lcr/%s/ociconfig.json", graphDriverPath, id)
configPath := fmt.Sprintf("%s/engines/lcr/%s/config.json", graphDriverPath, id)
config, err := os.Open(configPath)
if err != nil {
if os.IsNotExist(err) {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,10 +20,10 @@ import (
"fmt"
"os"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libdevice"
"isula.org/isulad-tools/types"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libdevice"
"isula.org/syscontainer-tools/types"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"

2
go.mod
View File

@ -1,4 +1,4 @@
module isula.org/isulad-tools
module isula.org/syscontainer-tools
replace (
golang.org/x/crypto => github.com/golang/crypto v0.0.0-20190701094942-4def268fd1a4

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -16,10 +16,10 @@
HOOK_DIR=/var/lib/isulad/hooks
ISULAD_TOOLS_DIR=/usr/local/bin
ISULAD_TOOLS_WRAPPER="/lib/udev"
HOOK_SPEC="/etc/isulad-tools"
HOOK_SPEC="/etc/syscontainer-tools"
echo "Hooks will be installed to $HOOK_DIR"
echo "isulad_tools will be installed to $ISULAD_TOOLS_DIR"
echo "syscontainer_tools will be installed to $ISULAD_TOOLS_DIR"
mkdir -p -m 0700 ${HOOK_DIR}
mkdir -p -m 0750 ${ISULAD_TOOLS_DIR}
@ -27,29 +27,29 @@ mkdir -p -m 0750 ${ISULAD_TOOLS_WRAPPER}
mkdir -p -m 0750 ${HOOK_SPEC}
install -m 0755 -p ../build/*-hooks ${HOOK_DIR}
install -m 0755 -p ../build/isulad-tools ${ISULAD_TOOLS_DIR}
install -m 0750 isulad-tools_wrapper ${ISULAD_TOOLS_WRAPPER}/isulad-tools_wrapper
install -m 0755 -p ../build/syscontainer-tools ${ISULAD_TOOLS_DIR}
install -m 0750 syscontainer-tools_wrapper ${ISULAD_TOOLS_WRAPPER}/syscontainer-tools_wrapper
cat << EOF > ${HOOK_SPEC}/hookspec.json
{
"prestart": [
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "prestart"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "prestart"],
"env": []
}
],
"poststart":[
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "poststart"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststart"],
"env": []
}
],
"poststop":[
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "poststop"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststop"],
"env": []
}
]

View File

@ -2,12 +2,12 @@
%define debug_package %{nil}
#Basic Information
Name: isulad-tools
Name: syscontainer-tools
Version: v0.9
Release: 34
Summary: isulad tools for IT, work with iSulad
Release: 35
Summary: syscontainer tools for IT, work with iSulad
License: Mulan PSL v1
URL: https://gitee.com/src-openeuler/iSulad-tools
URL: https://gitee.com/src-openeuler/syscontainer-tools
Source0: %{name}-src.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
@ -18,11 +18,11 @@ Requires: iSulad
Requires: util-linux
%description
This is isulad tools, to make it work, you need a isulad and util-linux
This is syscontainer tools, to make it work, you need a isulad and util-linux
#Build sections
%prep
%setup -q -c -n src/isula.org/isulad-tools
%setup -q -c -n src/isula.org/syscontainer-tools
%build
make init && make
@ -36,9 +36,9 @@ mkdir -p -m 0700 ${HOOK_DIR}
mkdir -p -m 0750 ${ISULAD_TOOLS_DIR}
mkdir -p -m 0750 ${ISULAD_TOOLS_WRAPPER}
install -m 0750 build/isulad-hooks ${HOOK_DIR}
install -m 0750 build/isulad-tools ${ISULAD_TOOLS_DIR}
install -m 0750 hack/isulad-tools_wrapper ${ISULAD_TOOLS_WRAPPER}/isulad-tools_wrapper
install -m 0750 build/syscontainer-hooks ${HOOK_DIR}
install -m 0750 build/syscontainer-tools ${ISULAD_TOOLS_DIR}
install -m 0750 hack/syscontainer-tools_wrapper ${ISULAD_TOOLS_WRAPPER}/syscontainer-tools_wrapper
#Install and uninstall scripts
%pre
@ -53,15 +53,15 @@ fi
if [[ "$GRAPH" != "/var/lib/isulad" ]]; then
mkdir -p -m 0550 $GRAPH/hooks
install -m 0550 -p /var/lib/isulad/hooks/isulad-hooks $GRAPH/hooks
install -m 0550 -p /var/lib/isulad/hooks/syscontainer-hooks $GRAPH/hooks
echo
echo "=================== WARNING! ================================================"
echo " 'iSulad Root Dir' is $GRAPH, move /var/lib/isulad/hooks/isulad-hooks to $GRAPH/hooks"
echo " 'iSulad Root Dir' is $GRAPH, move /var/lib/isulad/hooks/syscontainer-hooks to $GRAPH/hooks"
echo "============================================================================="
echo
fi
HOOK_SPEC=/etc/isulad-tools
HOOK_SPEC=/etc/syscontainer-tools
HOOK_DIR=${GRAPH}/hooks
mkdir -p -m 0750 ${HOOK_SPEC}
mkdir -p -m 0550 ${HOOK_DIR}
@ -69,22 +69,22 @@ cat << EOF > ${HOOK_SPEC}/hookspec.json
{
"prestart": [
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "prestart"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "prestart"],
"env": []
}
],
"poststart":[
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "poststart"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststart"],
"env": []
}
],
"poststop":[
{
"path": "${HOOK_DIR}/isulad-hooks",
"args": ["isulad-hooks", "--state", "poststop"],
"path": "${HOOK_DIR}/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststop"],
"env": []
}
]
@ -97,10 +97,10 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json
#Files list
%files
%defattr(0550,root,root,0550)
/usr/local/bin/isulad-tools
/usr/local/bin/syscontainer-tools
%attr(0550,root,root) /var/lib/isulad/hooks
%attr(0550,root,root) /var/lib/isulad/hooks/isulad-hooks
%attr(0550,root,root) /lib/udev/isulad-tools_wrapper
%attr(0550,root,root) /var/lib/isulad/hooks/syscontainer-hooks
%attr(0550,root,root) /lib/udev/syscontainer-tools_wrapper
#Clean section
@ -108,6 +108,12 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json
rm -rfv %{buildroot}
%changelog
* Tue Jan 07 2020 Zhangsong<zhangsong34@huawei.com> - 0.9.35
- Type:enhancement
- ID:NA
- SUG:restart
- DESC:update package
* Tue Dec 26 2019 Zhangsong<zhangsong34@huawei.com> - 0.9.34
- Type:enhancement
- ID:NA
@ -124,7 +130,7 @@ rm -rfv %{buildroot}
- Type:enhancement
- ID:NA
- SUG:restart
- DESC:rebuild patches for isulad-tools
- DESC:rebuild patches for syscontainer-tools
* Fri Nov 02 2018 Zhangsong<zhangsong34@huawei.com> - 0.9.7-1
- Type:enhancement

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -8,12 +8,12 @@
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v1 for more details.
# Description: isulad tools wrapper
# Author: zhangwei
# Create: 2018-01-18
# Description: syscontainer tools wrapper
# Author: zhangsong234
# Create: 2020-01-17
LOG_DIR=/var/log/hyperagent
LOG_FILE=${LOG_DIR}/isulad-tools.log
LOG_FILE=${LOG_DIR}/syscontainer-tools.log
## by default, isulad is installed in /usr/bin,
## but udevd do not have this path in PATH env
@ -25,10 +25,10 @@ run_cmd() {
$@
}
add_node() {
run_cmd isulad-tools --log $LOG_FILE add-device $id /dev/$o_dev:$devname
run_cmd syscontainer-tools --log $LOG_FILE add-device $id /dev/$o_dev:$devname
}
remove_node() {
run_cmd isulad-tools --log $LOG_FILE remove-device $id /dev/$o_dev:$devname
run_cmd syscontainer-tools --log $LOG_FILE remove-device $id /dev/$o_dev:$devname
}

View File

@ -1,23 +0,0 @@
{
"prestart": [
{
"path": "/var/lib/isulad/hooks/isulad-hooks",
"args": ["isulad-hooks", "--state", "prestart", "--log", "/var/log/device-hook.log"],
"env": []
}
],
"poststart":[
{
"path": "/var/lib/isulad/hooks/isulad-hooks",
"args": ["isulad-hooks", "--state", "prestart", "--log", "/var/log/device-hook.log"],
"env": []
}
],
"poststop":[
{
"path": "/var/lib/isulad/hooks/isulad-hooks",
"args": ["isulad-hooks", "--state", "poststop", "--log", "/var/log/device-hook.log"],
"env": []
}
]
}

View File

@ -1,16 +1,16 @@
# isulad-hooks
# syscontainer-hooks
This is a simple custom isulad hook for our own need,
This is a simple custom syscontainer hook for our own need,
it interacts with isulad as a multifunctional hook.
1. allow user to add your own devices or binds into the container and update device Qos for container(device hook in prestart state).
2. allow user to remove udev rule which added by isulad-tools when container is exiting(device hook in post-stop state).
2. allow user to remove udev rule which added by syscontainer-tools when container is exiting(device hook in post-stop state).
3. allow user to add network interface and route rule to container(network hook in prestart state).
4. allow user to remove network interface on host when container is exiting(network hook in post-stop state).
5. allow user to do oci relabel for container in both prestart and post-stop state for container.
Actually, this hook only handles the container restart process, we use isulad-tools to
add device/binds/network interface/route rule to container. And isulad-tools will save the device/network config to disk.
Actually, this hook only handles the container restart process, we use syscontainer-tools to
add device/binds/network interface/route rule to container. And syscontainer-tools will save the device/network config to disk.
And the hook will make sure the resources you added to container will be persistent after restart.
Rename it to your favourite name afterwards.
@ -30,15 +30,15 @@ it's not a mandatory step, make your own choice for your convenience :)
## customise hook service
We could use `isulad-hooks` to customise the hook service.
We could use `syscontainer-hooks` to customise the hook service.
```
Usage of isulad-hooks:
Usage of syscontainer-hooks:
-log string
set output log file
-state string
set isulad hook state mode: prestart or poststop
set syscontainer hook state mode: prestart or poststop
-with-relabel
isulad hook enable oci relabel hook function
syscontainer hook enable oci relabel hook function
```
As block device and network interface are both in our requirement, so these two function are mandantory.
@ -46,7 +46,7 @@ We could use `--with-relabel=true` to add oci-relabel hook service for container
We could use `--state` to specify which state the hook will be running in.
Full hook config:
[hook spec example of isulad-hooks](hooks/isulad-hooks/example/hookspec.json)
[hook spec example of syscontainer-hooks](hooks/syscontainer-hooks/example/hookspec.json)
## Try it!
@ -58,10 +58,10 @@ after that, you can run it like this:
```
$ isula run -d --name test_device --hook-spec $PWD/example/hookspec.json busybox sleep 20000
```
2.use isulad-tools to add device or binds to container
2.use syscontainer-tools to add device or binds to container
```
isulad-tools add-device test_device /dev/zero:/dev/test_zero:rwm /dev/zero:/dev/test_zero2:rwm
syscontainer-tools add-device test_device /dev/zero:/dev/test_zero:rwm /dev/zero:/dev/test_zero2:rwm
```
3.restart the container. to check the device is still in container.

View File

@ -0,0 +1,23 @@
{
"prestart": [
{
"path": "/var/lib/isulad/hooks/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "prestart", "--log", "/var/log/device-hook.log"],
"env": []
}
],
"poststart":[
{
"path": "/var/lib/isulad/hooks/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "prestart", "--log", "/var/log/device-hook.log"],
"env": []
}
],
"poststop":[
{
"path": "/var/lib/isulad/hooks/syscontainer-hooks",
"args": ["syscontainer-hooks", "--state", "poststop", "--log", "/var/log/device-hook.log"],
"env": []
}
]
}

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -7,7 +7,7 @@
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v1 for more details.
// Description: isulad hook main function
// Description: syscontainer hook main function
// Author: zhangwei
// Create: 2018-01-18
@ -27,15 +27,15 @@ import (
_ "github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/utils"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/utils"
)
var (
defaultHookConfigFile = "device_hook.json"
syslogTag = "hook "
bundleConfigFile = "ociconfig.json"
bundleConfigFile = "config.json"
)
type hookData struct {
@ -140,7 +140,7 @@ func prepareHookData() (*hookData, error) {
func main() {
if reexec.Init() {
// `reexec routine` was registered in isulad-tools/libdevice
// `reexec routine` was registered in syscontainer-tools/libdevice
// Sub nsenter process will come here.
// Isulad reexec package do not handle errors.
// And sub device-hook nsenter init process will send back the error message to parenet through pipe.
@ -150,9 +150,9 @@ func main() {
signal.Ignore(syscall.SIGINT, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM)
flLogfile := flag.String("log", "", "set output log file")
flMode := flag.String("state", "", "set isulad hook state mode: prestart or poststop")
flMode := flag.String("state", "", "set syscontainer hook state mode: prestart or poststop")
// No requirements at present, by default don't enable this function.
flWithRelabel := flag.Bool("with-relabel", false, "isulad hook enable oci relabel hook function")
flWithRelabel := flag.Bool("with-relabel", false, "syscontainer hook enable oci relabel hook function")
flag.Parse()
@ -163,7 +163,7 @@ func main() {
}
if err := os.MkdirAll(hconfig.IsuladToolsDir, 0666); err != nil {
logrus.Errorf("failed to set isulad-tools dir: %v", err)
logrus.Errorf("failed to set syscontainer-tools dir: %v", err)
}
switch *flMode {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,12 +20,12 @@ import (
"path/filepath"
"github.com/opencontainers/runc/libcontainer/configs"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/libdevice"
"isula.org/isulad-tools/libnetwork"
"isula.org/isulad-tools/pkg/udevd"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/libdevice"
"isula.org/syscontainer-tools/libnetwork"
"isula.org/syscontainer-tools/pkg/udevd"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -28,13 +28,13 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/libdevice"
"isula.org/isulad-tools/libdevice/nsexec"
"isula.org/isulad-tools/libnetwork"
"isula.org/isulad-tools/pkg/udevd"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/libdevice"
"isula.org/syscontainer-tools/libdevice/nsexec"
"isula.org/syscontainer-tools/libnetwork"
"isula.org/syscontainer-tools/pkg/udevd"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
)
const (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -34,9 +34,9 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink/nl"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/libdevice/nsexec"
"isula.org/isulad-tools/utils"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/libdevice/nsexec"
"isula.org/syscontainer-tools/utils"
)
var (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -24,8 +24,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/opencontainers/runtime-spec/specs-go"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
)
// ParseBind will parse host path to Bind structure

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -19,7 +19,7 @@ import (
"path/filepath"
"github.com/opencontainers/runc/libcontainer/cgroups"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
)
var (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -26,10 +26,10 @@ import (
"syscall"
"github.com/docker/docker/pkg/reexec"
"isula.org/isulad-tools/libdevice/nsexec"
"isula.org/isulad-tools/pkg/mount"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
"isula.org/syscontainer-tools/libdevice/nsexec"
"isula.org/syscontainer-tools/pkg/mount"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
)
func init() {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -24,7 +24,7 @@ import (
"strings"
"syscall"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
"github.com/sirupsen/logrus"
)

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -22,12 +22,12 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libdevice/nsexec"
"isula.org/isulad-tools/pkg/udevd"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libdevice/nsexec"
"isula.org/syscontainer-tools/pkg/udevd"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
)
func checkDevice(config hconfig.ContainerConfig, devs []*types.Device, opts *types.AddDeviceOptions) error {
@ -279,7 +279,7 @@ func RemoveDevice(c *container.Container, devices []*types.Device, followPartiti
for _, device := range devices {
newDevice := config.FindDeviceByMapping(device)
if newDevice == nil {
errinfo := fmt.Sprint("Device pair(", device.PathOnHost, ":", device.Path, ") is not added by isulad-tools, can not remove it, please check input parameter.")
errinfo := fmt.Sprint("Device pair(", device.PathOnHost, ":", device.Path, ") is not added by syscontainer-tools, can not remove it, please check input parameter.")
retErr = append(retErr, errors.New(errinfo))
continue
}
@ -288,7 +288,7 @@ func RemoveDevice(c *container.Container, devices []*types.Device, followPartiti
if followPartition {
subDevices := config.FindSubPartition(newDevice)
for _, subDev := range subDevices {
// check the sub partition is added by isulad-tools
// check the sub partition is added by syscontainer-tools
if found := config.FindDeviceByMapping(subDev); found == nil {
continue
}
@ -474,7 +474,7 @@ func RemovePath(c *container.Container, binds []*types.Bind) error {
}
if mp == nil {
errinfo := fmt.Sprint("Path pair(", bind.HostPath, ":", bind.ContainerPath, ") is not added by isulad-tools, can not remove it, please check input parameter")
errinfo := fmt.Sprint("Path pair(", bind.HostPath, ":", bind.ContainerPath, ") is not added by syscontainer-tools, can not remove it, please check input parameter")
retErr = append(retErr, errors.New(errinfo))
continue
}

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -17,7 +17,7 @@ import (
"fmt"
"os"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
)
var (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -21,8 +21,8 @@ import (
"os"
"os/exec"
"isula.org/isulad-tools/types"
"isula.org/isulad-tools/utils"
"isula.org/syscontainer-tools/types"
"isula.org/syscontainer-tools/utils"
"github.com/opencontainers/runc/libcontainer"
"github.com/vishvananda/netlink/nl"

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -19,7 +19,7 @@ import (
"strconv"
"strings"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
)
const (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -16,9 +16,9 @@ package bridge
import (
"os/exec"
"isula.org/isulad-tools/libnetwork/bridge/api"
"isula.org/isulad-tools/libnetwork/bridge/linux"
"isula.org/isulad-tools/libnetwork/bridge/ovs"
"isula.org/syscontainer-tools/libnetwork/bridge/api"
"isula.org/syscontainer-tools/libnetwork/bridge/linux"
"isula.org/syscontainer-tools/libnetwork/bridge/ovs"
)
var supportedDrivers map[string]api.BridgeDriver = make(map[string]api.BridgeDriver)

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -16,7 +16,7 @@ package linux
import (
"fmt"
"isula.org/isulad-tools/libnetwork/bridge/api"
"isula.org/syscontainer-tools/libnetwork/bridge/api"
"github.com/vishvananda/netlink"
)

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -18,7 +18,7 @@ import (
"os/exec"
"github.com/vishvananda/netlink"
"isula.org/isulad-tools/libnetwork/bridge/api"
"isula.org/syscontainer-tools/libnetwork/bridge/api"
)
type ovsBridgeDriver struct {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -16,8 +16,8 @@ package common
import (
"net"
"isula.org/isulad-tools/libnetwork/bridge"
"isula.org/isulad-tools/libnetwork/bridge/api"
"isula.org/syscontainer-tools/libnetwork/bridge"
"isula.org/syscontainer-tools/libnetwork/bridge/api"
)
// Driver implement the network driver common options

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,9 +20,9 @@ import (
// "github.com/Sirupsen/logrus"
"github.com/vishvananda/netlink"
"isula.org/isulad-tools/libnetwork/drivers/common"
"isula.org/isulad-tools/libnetwork/drivers/eth"
"isula.org/isulad-tools/libnetwork/drivers/veth"
"isula.org/syscontainer-tools/libnetwork/drivers/common"
"isula.org/syscontainer-tools/libnetwork/drivers/eth"
"isula.org/syscontainer-tools/libnetwork/drivers/veth"
)
var (

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -22,9 +22,9 @@ import (
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink"
"isula.org/isulad-tools/libnetwork/drivers/common"
"isula.org/isulad-tools/libnetwork/nsutils"
"isula.org/isulad-tools/pkg/ethtool"
"isula.org/syscontainer-tools/libnetwork/drivers/common"
"isula.org/syscontainer-tools/libnetwork/nsutils"
"isula.org/syscontainer-tools/pkg/ethtool"
)
type ethDriver struct {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -22,9 +22,9 @@ import (
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink"
"isula.org/isulad-tools/libnetwork/drivers/common"
"isula.org/isulad-tools/libnetwork/nsutils"
"isula.org/isulad-tools/pkg/ethtool"
"isula.org/syscontainer-tools/libnetwork/drivers/common"
"isula.org/syscontainer-tools/libnetwork/nsutils"
"isula.org/syscontainer-tools/pkg/ethtool"
)
type vethDriver struct {
@ -96,7 +96,7 @@ func (d *vethDriver) DeleteIf() error {
veth, err := netlink.LinkByName(d.GetHostNicName())
if err != nil {
// As add-nic supports 'update-config-only' option,
// With this flag, isulad-tools will update config only, don't add device to container.
// With this flag, syscontainer-tools will update config only, don't add device to container.
// So if device dose not exist on host, ignore it.
if strings.Contains(err.Error(), "Link not found") {
return nil

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -19,10 +19,10 @@ import (
"strings"
"github.com/sirupsen/logrus"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libnetwork/drivers"
"isula.org/isulad-tools/types"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libnetwork/drivers"
"isula.org/syscontainer-tools/types"
)
// AddNic will add a network interface to container, it will update the config for container

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -21,10 +21,10 @@ import (
"strings"
"github.com/sirupsen/logrus"
hconfig "isula.org/isulad-tools/config"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libnetwork/nsutils"
"isula.org/isulad-tools/types"
hconfig "isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libnetwork/nsutils"
"isula.org/syscontainer-tools/types"
"github.com/vishvananda/netlink"
)
@ -140,7 +140,7 @@ func DelRoutes(ctr *container.Container, routes []*types.Route, updateConfigOnly
var retErr []error
for _, r := range routes {
if exist := hConfig.IsRouteExist(r); !exist {
errinfo := fmt.Sprint("Route(", r, ") is not added by isulad-tools, can not remove it, please check input parameter.")
errinfo := fmt.Sprint("Route(", r, ") is not added by syscontainer-tools, can not remove it, please check input parameter.")
retErr = append(retErr, errors.New(errinfo))
continue
}

14
main.go
View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -22,8 +22,8 @@ import (
"syscall"
"github.com/docker/docker/pkg/reexec"
"isula.org/isulad-tools/config"
"isula.org/isulad-tools/utils"
"isula.org/syscontainer-tools/config"
"isula.org/syscontainer-tools/utils"
_ "github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/sirupsen/logrus"
@ -55,7 +55,7 @@ func fatalf(t string, v ...interface{}) {
func mainWork() {
app := cli.NewApp()
app.Name = "isulad-tools"
app.Name = "syscontainer-tools"
app.Usage = usage
v := []string{
version,
@ -111,7 +111,7 @@ func mainWork() {
app.Before = func(context *cli.Context) error {
if err := os.MkdirAll(config.IsuladToolsDir, 0666); err != nil {
logrus.Errorf("failed to set isulad-tools dir: %v", err)
logrus.Errorf("failed to set syscontainer-tools dir: %v", err)
}
if logpath := context.GlobalString("log"); logpath != "" {
@ -155,10 +155,10 @@ func mainWork() {
}
func main() {
if reexec.Init() {
// `reexec routine` was registered in isulad-tools/libdevice
// `reexec routine` was registered in syscontainer-tools/libdevice
// Sub nsenter process will come here.
// Isulad reexec package do not handle errors.
// And sub isulad-tools nsenter init process will send back the error message to parenet through pipe.
// And sub syscontainer-tools nsenter init process will send back the error message to parenet through pipe.
// So here do not need to handle errors.
return
}

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -24,9 +24,9 @@ import (
"github.com/docker/libnetwork/netutils"
"github.com/sirupsen/logrus"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libnetwork"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libnetwork"
"isula.org/syscontainer-tools/types"
)
var addNicCommand = cli.Command{

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2017-2019. All rights reserved.
* isulad-tools is licensed under the Mulan PSL v1.
* syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2017-2019. All rights reserved.
* isulad-tools is licensed under the Mulan PSL v1.
* syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -42,7 +42,7 @@ func saveRules(path string, rules []*Rule) error {
return err
}
f.WriteString("## This File is auto-generated by isulad-tools.\n")
f.WriteString("## This File is auto-generated by syscontainer-tools.\n")
f.WriteString("## DO NOT EDIT IT\n\n")
for _, r := range rules {
if _, err := f.WriteString(fmt.Sprintf("%s\n", r.ToUdevRuleString())); err != nil {

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -18,14 +18,14 @@ import (
"os"
"path/filepath"
hconfig "isula.org/isulad-tools/config"
hconfig "isula.org/syscontainer-tools/config"
"golang.org/x/sys/unix"
)
var (
programe = "/lib/udev/isulad-tools_wrapper"
programe = "/lib/udev/syscontainer-tools_wrapper"
lockFile = "udevd_config_locker"
configPath = "/etc/udev/rules.d/99-isulad-tools.rules"
configPath = "/etc/udev/rules.d/99-syscontainer-tools.rules"
)
// Rule defines an udev rule which used to capture the partition udev event

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -19,7 +19,7 @@ import (
"io/ioutil"
"os/exec"
"isula.org/isulad-tools/utils"
"isula.org/syscontainer-tools/utils"
"github.com/opencontainers/runc/libcontainer/selinux"
"github.com/sirupsen/logrus"

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,9 +20,9 @@ import (
"os"
"strings"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libnetwork"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libnetwork"
"isula.org/syscontainer-tools/types"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -13,8 +13,8 @@
#!/bin/bash
## isulad-tools paths.
ISULAD_TOOLS="$CUR/../build/isulad-tools"
## syscontainer-tools paths.
ISULAD_TOOLS="$CUR/../build/syscontainer-tools"
## Ubuntu image
UBUNTU_IMAGE="ubuntu"

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -41,8 +41,8 @@ setupImage(){
setup_device_hook(){
mkdir -p /var/lib/isulad/hooks
cp $CUR/../hooks/isulad-hooks/example/hookspec.json /var/lib/isulad/hooks/
cp $CUR/../build/isulad-hooks /var/lib/isulad/hooks/
cp $CUR/../hooks/syscontainer-hooks/example/hookspec.json /var/lib/isulad/hooks/
cp $CUR/../build/syscontainer-hooks /var/lib/isulad/hooks/
}
main_test(){

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -24,7 +24,7 @@
test_001(){
#testcase01
CONTAINER_ID=`isula run -d $BUSYBOX_IMAGE top`
$ISULAD_TOOLS --debug --log $TMP/isulad-tools.log add-nic \
$ISULAD_TOOLS --debug --log $TMP/syscontainer-tools.log add-nic \
--type veth --name eth10 --ip 192.168.182.2/24 \
--mac "aa:bb:cc:dd:ee:aa" --bridge "docker0" --mtu 1350 \
$CONTAINER_ID
@ -83,7 +83,7 @@ test_002(){
fail "02-1:FAIL"
fi
CONTAINER_ID=`isula run -d $BUSYBOX_IMAGE top`
$ISULAD_TOOLS --debug --log $TMP/isulad-tools.log add-nic \
$ISULAD_TOOLS --debug --log $TMP/syscontainer-tools.log add-nic \
--type veth --name eth11 --ip 192.168.182.2/24 \
--mac "aa:bb:cc:dd:ee:aa" --bridge $OVS_BR --mtu 1350 \
$CONTAINER_ID

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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
@ -24,7 +24,7 @@ test_001(){
ip a a 192.168.182.1/24 dev $BR
CONTAINER_ID=`isula run -d --net none $BUSYBOX_IMAGE top`
$ISULAD_TOOLS --debug --log $TMP/isulad-tools.log add-nic \
$ISULAD_TOOLS --debug --log $TMP/syscontainer-tools.log add-nic \
--type veth --name eth0 --ip 192.168.182.2/24 \
--mac "aa:bb:cc:dd:ee:aa" --bridge $BR --mtu 1450 \
$CONTAINER_ID

View File

@ -1,5 +1,5 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
# isulad-tools is licensed under the Mulan PSL v1.
# syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -33,7 +33,7 @@ func getGraphDriverPath() (string, error) {
return "", err
}
// get /var/lib/isulad from /var/lib/isulad/hooks/isulad-hooks
// get /var/lib/isulad from /var/lib/isulad/hooks/syscontainer-hooks
dir := filepath.Dir(filepath.Dir(path))
return dir, nil
}

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,10 +20,10 @@ import (
"path/filepath"
"syscall"
mymount "isula.org/isulad-tools/pkg/mount"
mymount "isula.org/syscontainer-tools/pkg/mount"
"github.com/docker/docker/pkg/mount"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/types"
"github.com/sirupsen/logrus"
)
@ -36,7 +36,7 @@ const (
/* Add path to container when it is running
We use mount propagation mechanism to do it. Take
isulad tools add-path /hostpath1:/guest1 for example.
syscontainer tools add-path /hostpath1:/guest1 for example.
1. Add a sharing path using hook as belowing. Then every

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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

View File

@ -1,5 +1,5 @@
// Copyright (c) Huawei Technologies Co., Ltd. 2018-2019. All rights reserved.
// isulad-tools is licensed under the Mulan PSL v1.
// syscontainer-tools is 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
@ -20,9 +20,9 @@ import (
"fmt"
"os"
"isula.org/isulad-tools/container"
"isula.org/isulad-tools/libdevice"
"isula.org/isulad-tools/types"
"isula.org/syscontainer-tools/container"
"isula.org/syscontainer-tools/libdevice"
"isula.org/syscontainer-tools/types"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"