-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: Merged fixed code into the main branch
- Loading branch information
Showing
145 changed files
with
5,560 additions
and
2,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.