Skip to content

Commit

Permalink
intel-cloud#210 multiple drivers on the same physical node
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuanwa committed Jan 16, 2015
1 parent 1a73253 commit 937a2ce
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 25 deletions.
75 changes: 53 additions & 22 deletions release/start-driver.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
#!/bin/bash
#
#Copyright 2013 Intel Corporation, All Rights Reserved.
#
#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.
#

#-------------------------------
# COSBENCH DRIVER STARTER
#-------------------------------

if [ $# -eq 0 ];then
ip=127.0.0.1
num=1
base_port=18088
elif [ $# -eq 3 ];then

This comment has been minimized.

Copy link
@ywang19

ywang19 Jan 16, 2015

better to support any number of parameters, e.g, ./start-driver.sh, or ./start-driver.sh 3; or ./start-driver.sh 3 127.0.0.1; or ./start-driver.sh 3 127.0.0.1 18088.

num=$1
ip=$2
base_port=$3
else
echo "<default>:none of parameter,create one driver"
echo "<mult>:three pareameters"
echo " <1>the number of drivers on one node"
echo " <2>the ip of driver"
echo " <3>base of port"
exit 1
fi

SERVICE_NAME=driver
VERSION=`cat VERSION`

OSGI_BUNDLES="cosbench-log_${VERSION} cosbench-tomcat_${VERSION} cosbench-config_${VERSION} cosbench-http_${VERSION} cosbench-cdmi-util_${VERSION} cosbench-core_${VERSION} cosbench-core-web_${VERSION} cosbench-api_${VERSION} cosbench-mock_${VERSION} cosbench-ampli_${VERSION} cosbench-swift_${VERSION} cosbench-keystone_${VERSION} cosbench-httpauth_${VERSION} cosbench-s3_${VERSION} cosbench-librados_${VERSION} cosbench-scality_${VERSION} cosbench-cdmi-swift_${VERSION} cosbench-cdmi-base_${VERSION} cosbench-driver_${VERSION} cosbench-driver-web_${VERSION}"

OSGI_CONSOLE_PORT=18089

sh cosbench-start.sh $SERVICE_NAME "$OSGI_BUNDLES" $OSGI_CONSOLE_PORT
rm -f ip-port.list
for i in $(seq 1 $num)
do
# driver.conf
name=""
url=""
cd conf
let "x=($i-1)*100+$base_port"
rm -f driver.conf
rm -f driver_$i.conf
cp model_driver.conf driver_$i.conf
name="$ip:$x"
url="http:\/\/$ip:$x\/driver"
sed -i "s/^name=.*$/name=${name}/" driver_$i.conf
sed -i "s/^url=.*$/url=${url}/" driver_$i.conf
ln -s driver_$i.conf driver.conf

#make driver-tomcat-server.xml
rm -f driver-tomcat-server.xml
rm -f driver-tomcat-server_$i.xml
cp model_driver-tomcat-server.xml driver-tomcat-server_$i.xml
sed -i "s/\(.*Connector port=\"\)[^\"]*\(.*\)/\1${x}\2/" driver-tomcat-server_$i.xml
let "x=$x+1"
ln -s driver-tomcat-server_$i.xml driver-tomcat-server.xml
cd ../
OSGI_CONSOLE_PORT=$x
sh cosbench-start.sh $SERVICE_NAME "$OSGI_BUNDLES" $OSGI_CONSOLE_PORT

#ip/port list
echo "$name" >> ip-port.list
done





41 changes: 38 additions & 3 deletions release/stop-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,43 @@
# COSBENCH DRIVER STOPPER
#-------------------------------

SERVICE_NAME=driver
checkAll(){
cat ip-port.list |while read line
do
echo $line
port=`echo $line |awk -F ":" 'NR==1{print $NF}'`
let "x=1+$port"
OSGI_CONSOLE_PORT=$x
echo $port
SERVICE_NAME=driver
sh cosbench-stop.sh $SERVICE_NAME $OSGI_CONSOLE_PORT
done
}

checkOne(){
s=$(awk 'NR=='$1' {print $0}' ip-port.list)
port=`echo $s |awk -F ":" 'NR==1{print $NF}'`
let "x=1+$port"
OSGI_CONSOLE_PORT=$x
echo $port
SERVICE_NAME=driver
sh cosbench-stop.sh $SERVICE_NAME $OSGI_CONSOLE_PORT
}

if [ $# -eq 0 ];then
checkAll
elif [ $# -eq 1 ];then
checkOne $1
else
echo " <All>:none parameter, stop all"
echo " <one>:one parameter,the serial number in ip-port.list "
exit 1
fi







OSGI_CONSOLE_PORT=18089

sh cosbench-stop.sh $SERVICE_NAME $OSGI_CONSOLE_PORT

1 comment on commit 937a2ce

@ywang19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to support windows version.

Please sign in to comment.