-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-cosbench.sh
executable file
·83 lines (70 loc) · 2.55 KB
/
start-cosbench.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
: ${DRIVERS:=http://127.0.0.1:18088/driver}
: ${CONTROLLER:=true}
: ${DRIVER:=true}
: ${COSBENCH_PLUGINS:=OPENIO}
: ${VERSION:="0.4.1"}
### Driver configuration
if [ "$DRIVER" = true ]; then
# Fix invalid option '-i 0' and add timeout option
sed -i -e 's@^TOOL_PARAMS=.*@TOOL_PARAMS="-w 1"@g' \
cosbench-start.sh
# Activate backend support for fast startup
unset COSBENCH_OSGI
for plugin in ${COSBENCH_PLUGINS//,/ }
do
case $plugin in
'CDMI') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-cdmi-util_${VERSION} cosbench-cdmi-swift_${VERSION} cosbench-cdmi-base_${VERSION}' ;;
'SWIFT') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-swift_${VERSION} cosbench-keystone_${VERSION}' ;;
'OPENIO') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-openio_${VERSION}' ;;
'SCALITY') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-scality_${VERSION}' ;;
'S3') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-s3_${VERSION}' ;;
'CEPH') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-librados_${VERSION}' ;;
'AMPLI') COSBENCH_OSGI="$COSBENCH_OSGI"' cosbench-ampli_${VERSION}' ;;
esac
done
# Set minimal plugins to optimize startup time
sed -i -e 's@^OSGI_BUNDLES=.*@OSGI_BUNDLES="cosbench-log_${VERSION} cosbench-tomcat_${VERSION} cosbench-config_${VERSION} cosbench-http_${VERSION} cosbench-core_${VERSION} cosbench-core-web_${VERSION} cosbench-api_${VERSION} cosbench-mock_${VERSION} cosbench-httpauth_${VERSION} cosbench-driver_${VERSION} cosbench-driver-web_${VERSION} %COSBENCH_OSGI%"@g' start-driver.sh
# Set custom backends
sed -i -e "s@%COSBENCH_OSGI%@$COSBENCH_OSGI@g" start-driver.sh
fi
### Controller configuration
if [ "$CONTROLLER" = true -a -z "$DRIVERS" ]; then
echo "Warning: No drivers specified but configured as controller."
CONTROLLER=false
elif [ "$CONTROLLER" = true ]; then
nbdrivers=$(echo ${DRIVERS//,/ }|wc -w)
# Header
cat <<EOF >conf/controller.conf
[controller]
drivers = $nbdrivers
log_level = INFO
log_file = log/system.log
archive_dir = archive
EOF
# Driver configuration
index=1
for driver in ${DRIVERS//,/ }
do
cat <<EOF >>conf/controller.conf
[driver$index]
name = driver$index
url = $driver
EOF
((index++))
done
fi
### Start services
if [ "$CONTROLLER" = true -a "$DRIVER" = true ]; then
echo "Starting both controller and driver"
./start-all.sh
elif [ "$CONTROLLER" = true ]; then
echo "Sarting controller"
./start-controller.sh
elif [ "$DRIVER" = true ]; then
echo "Starting driver"
./start-driver.sh
else
echo 'Houston, we have had a problem here.'
fi
/bin/bash