Reintroduce network option

Only for testing purpose, don't use it otherwise.
This commit is contained in:
Sheng Yang 2017-04-14 14:31:52 -07:00
parent c2fc0f6e6e
commit 93da17f8e8
3 changed files with 39 additions and 4 deletions

View File

@ -13,13 +13,38 @@ sleep 1
source ./common.sh
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-n|--network)
network="$2"
shift # past argument
;;
*)
# unknown
# option
echo ${USAGE}
break
;;
esac
shift
done
NFS_SERVER=longhorn-nfs-server
NFS_IMAGE=docker.io/erezhorev/dockerized_nfs_server
BACKUPSTORE_PATH=/opt/backupstore
network_option=
if [ "$network" != "" ]; then
network_option="--network ${network}"
fi
docker run -d \
--name ${NFS_SERVER} \
${network_option} \
--privileged \
${NFS_IMAGE} ${BACKUPSTORE_PATH}

View File

@ -39,7 +39,6 @@ if [ "$etcd_ip" == "" ]; then
fi
network_option=
if [ "$network" != "" ]; then
network_option="--network ${network}"
fi

View File

@ -15,6 +15,10 @@ do
port="$2"
shift # past argument
;;
-n|--network)
network="$2"
shift # past argument
;;
*)
# unknown
# option
@ -25,9 +29,15 @@ do
shift
done
port_option=
options=
if [ "$port" != "" ]; then
port_option="-p $port"
options="${options} -p $port"
fi
network_option=
if [ "$network" != "" ]; then
options="${options} -n ${network}"
network_option="--network ${network}"
fi
ETCD_SERVER=longhorn-etcd-server
@ -38,6 +48,7 @@ cleanup $ETCD_SERVER
docker run -d \
--name $ETCD_SERVER \
--volume /etcd-data \
${network_option} \
$ETCD_IMAGE \
/usr/local/bin/etcd \
--name longhorn-etcd-server \
@ -49,4 +60,4 @@ etcd_ip=$(get_container_ip $ETCD_SERVER)
echo etcd server is up at ${etcd_ip}
echo
./longhorn-deploy-node.sh -e ${etcd_ip} $port_option
./longhorn-deploy-node.sh -e ${etcd_ip} ${options}