Skip to content

Commit

Permalink
[fix]tools-v2: update branch
Browse files Browse the repository at this point in the history
  • Loading branch information
victorseptember committed Oct 19, 2023
1 parent 6ffcf3a commit b7c2728
Show file tree
Hide file tree
Showing 154 changed files with 8,781 additions and 5,120 deletions.
16 changes: 16 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,20 @@ build:gcc7-later --cxxopt -faligned-new
build --incompatible_blacklisted_protos_requires_proto_info=false
build --copt=-fdiagnostics-color=always

build:sanitize-common --strip=never
build:sanitize-common --copt -O1
build:sanitize-common --copt -g
build:sanitize-common --copt -fno-omit-frame-pointer

build:asan --config=sanitize-common
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
build:asan --linkopt -fsanitize=address

build:asan --config=sanitize-common
build:msan --copt -fsanitize=memory
build:msan --copt -fsanitize=undefined
build:msan --linkopt -fsanitize=address
build:msan --linkopt -fsanitize=undefined

run --copt=-fdiagnostics-color=always
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Clang Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# fetch everything to be able to compare with any ref
fetch-depth: 0
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Static Checker

on: pull_request

jobs:
cppcheck:
name: CppCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: chmorgan/[email protected]
with:
enable: all
std: c++11
inconclusive: disable
output_file: ./cppcheck_report.txt
other_options: "-j4 --suppressions-list=util/cppcheck/cppcheck.suppressions --error-exitcode=1 -itest -icurvefs/test -inebd/test -inbd/test -icurvefs_python -icurvesnapshot_python -ithirdparties"

- name: Show cppcheck report
if: failure()
run: |
cat ./cppcheck_report.txt
exit 1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ runlog/
!curve-snapshotcloneserver-nginx/app/lib
!nebd/nebd-package/usr/bin

# build output
build

# mac
.DS_Store

Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ Examples:

## build
Usage:
make build stor=bs/fs only=TARGET dep=0/1 release=0/1 os=OS
make build stor=bs/fs only=TARGET1,...,TARGETx dep=0/1 release=0/1 os=OS
Examples:
make build stor=bs only=//src/chunkserver:chunkserver
make build stor=bs only=src/* dep=0
make build stor=bs only=src/*,test/* dep=0
make build stor=fs only=test/* os=debian9
make build stor=fs release=1

Note:
Extra build options can be specified using BUILD_OPTS environment variable, which will be passed to bazel build command.

## dep
Usage:
Expand All @@ -50,6 +51,14 @@ Usage:
make image stor=bs/fs tag=TAG os=OS
Examples:
make image stor=bs tag=opencurvedocker/curvebs:v1.2 os=debian9


## package
Usage:
make <tar|deb> release=0/1 dep=0/1 os=OS
Examples:
make deb
make tar release=1 dep=1 os=debian11
endef
export help_msg

Expand All @@ -66,7 +75,7 @@ dep:
@bash util/build.sh --stor=$(stor) --only="" --dep=1

ci-build:
@bash util/build_in_image.sh --stor=$(stor) --only=$(only) --dep=$(dep) --release=$(release) --ci=$(ci) --os=$(os)
@bash util/build_in_image.sh --stor=$(stor) --only=$(only) --dep=$(dep) --release=$(release) --ci=$(ci) --os=$(os) --sanitizer=$(sanitizer)

ci-dep:
@bash util/build_in_image.sh --stor=$(stor) --only="" --dep=1
Expand All @@ -77,6 +86,9 @@ install:
image:
@bash util/image.sh $(stor) $(tag) $(os)

tar deb:
@RELEASE=$(release) DEP=$(dep) OS=$(os) bash util/package.sh $@

playground:
@bash util/playground.sh

Expand Down
4 changes: 2 additions & 2 deletions curve-ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ chunkserver_num=13
### 3、包管理
curve-ansible同时提供了debian包和tar包的方式安装curve软件包。默认使用tar包方式安装,如果想用debian包的方式,需要在inventory或者命令行中指定install_with_deb=true。(debian的方式目前不支持格式化指定盘,只支持格式化全部ATA盘)

- debian包的方式下,需要使用mk-deb.sh打debian包,并将debian包上传到debian源中,使其能够用apt-get命令安装。
- tar包的方式下,tar包可以是来自curve github release,也可以是自己执行mk-tar.sh脚本获取到的
- debian包的方式下,需要使用 make deb 打debian包,并将debian包上传到debian源中,使其能够用apt-get命令安装。
- tar包的方式下,tar包可以是来自curve github release,也可以是自己执行 make tar 获取到的

## 三、使用命令
### 1、集群部署
Expand Down
9 changes: 9 additions & 0 deletions curvefs/docker/openeuler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM opencurvedocker/curve-base:openeuler
COPY libmemcached.so libmemcached.so.11 libhashkit.so.2 libfuse3.so.3.10.5 libsnappy.so.1.1.9 libetcdclient.so /usr/lib/
COPY curvefs /curvefs
RUN mkdir -p /etc/curvefs /core /etc/curve && chmod a+x /entrypoint.sh \
&& cp /curvefs/tools/sbin/curvefs_tool /usr/bin \
&& cp /curvefs/tools-v2/sbin/curve /usr/bin/ \
&& ln -s /usr/lib/libfuse3.so.3.10.5 /usr/lib/libfuse3.so.3 \
&& ln -s /usr/lib64/libsnappy.so.1.1.9 /usr/lib64/libsnappy.so.1 \
&& ldconfig
136 changes: 136 additions & 0 deletions curvefs/docker/openeuler/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env bash

# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc.

############################ GLOBAL VARIABLES
g_role=""
g_args=""
g_prefix=""
g_binary=""
g_start_args=""
g_preexec="/curvefs/tools-v2/sbin/daemon"

############################ BASIC FUNCTIONS
function msg() {
printf '%b' "$1" >&2
}

function success() {
msg "\33[32m[✔]\33[0m ${1}${2}"
}

function die() {
msg "\33[31m[✘]\33[0m ${1}${2}"
exit 1
}

############################ FUNCTIONS
function usage () {
cat << _EOC_
Usage:
entrypoint.sh --role=ROLE
entrypoint.sh --role=ROLE --args=ARGS
Examples:
entrypoint.sh --role=etcd
entrypoint.sh --role=client --args="-o default_permissions"
_EOC_
}

function get_options() {
local long_opts="role:,args:,help"
local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"`
eval set -- "${args}"
while true
do
case "$1" in
-r|--role)
g_role=$2
shift 2
;;
-a|--args)
g_args=$2
shift 2
;;
-h)
usage
exit 1
;;
--)
shift
break
;;
*)
exit 1
;;
esac
done
}

function prepare() {
g_prefix="/curvefs/$g_role"
conf_path="$g_prefix/conf/$g_role.conf"

case $g_role in
etcd)
g_binary="$g_prefix/sbin/etcd"
g_start_args="--config-file $conf_path"
;;
mds)
g_binary="$g_prefix/sbin/curvefs-mds"
g_start_args="--confPath $conf_path"
;;
metaserver)
g_binary="$g_prefix/sbin/curvefs-metaserver"
g_start_args="--confPath $conf_path"
;;
client)
g_binary="$g_prefix/sbin/curve-fuse"
g_start_args="--confPath $conf_path"
;;
monitor)
g_binary="python3"
g_start_args="target_json.py"
;;
*)
usage
exit 1
;;
esac

if [ "$g_args" != "" ]; then
g_start_args=$g_args
fi
}

function create_directory() {
chmod 700 "$g_prefix/data"
if [ "$g_role" == "etcd" ]; then
mkdir -p "$g_prefix/data/wal"
elif [ "$g_role" == "metaserver" ]; then
mkdir -p "$g_prefix/data/storage"
elif [ "$g_role" == "client" ]; then
mkdir -p "$g_prefix/mnt"
fi
}

function main() {
get_options "$@"

prepare
create_directory
[[ $(command -v crontab) ]] && cron
[[ ! -z $g_preexec ]] && $g_preexec &
if [ $g_role == "etcd" ]; then
exec $g_binary $g_start_args >>$g_prefix/logs/etcd.log 2>&1
elif [ $g_role == "monitor" ]; then
cd $g_prefix
exec $g_binary $g_start_args
else
exec $g_binary $g_start_args
fi

}

############################ MAIN()
main "$@"
Loading

0 comments on commit b7c2728

Please sign in to comment.