Bump version to 0.3.5next
[archipelago] / xseg / launch
index 4f632ae..e85281d 100755 (executable)
@@ -1,6 +1,39 @@
 #!/bin/bash
+
+# Copyright 2012 GRNET S.A. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+#
+#   1. Redistributions of source code must retain the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer in the documentation and/or other materials
+#      provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and
+# documentation are those of the authors and should not be
+# interpreted as representing official policies, either expressed
+# or implied, of GRNET S.A.
 #
-# Launcher for xseg configurations
+
 
 NI_SAVED=${NONINTERACTIVE}
 export NONINTERACTIVE=1
@@ -26,23 +59,27 @@ function parse_config {
        [ -z "${HOSTNAME}" ] && HOSTNAME=`hostname`
        [ -z "${XSEG_HOME}" ] && XSEG_HOME="/root/archip/xseg"
        [ -z "${MODULES_DIR}" ] && MODULES_DIR="${XSEG_HOME}/lib/kernel"
-       #type:name:nr_ports:nr_requests:request_size:extra_size:page_shift
-       [ -z "${SPEC}" ] && SPEC="segdev:xsegbd:16:1024:12"
+       [ -z "${SPEC}" ] && SPEC="segdev:xsegbd:512:1024:12"
        [ -z "${REQS}" ] && REQS=512
-       [ -z "${PORTS}" ] && PORTS=16
+       [ -z "${PORTS}" ] && PORTS=512
        [ -z "${IMAGES}" ] && IMAGES="/home/user/archip/xseg/peers/user/foo"
+       [ -z "${MAPS}" ] && MAPS="/home/user/archip/xseg/peers/user/foo"
        [ -z "${PITHOS}" ] && PITHOS="/srv/pithos/data/blocks"
-       [ -z "${XSEG_LOGS}" ] && XSEG_LOGS="/home/user/archip/logs"
+       [ -z "${PITHOSMAPS}" ] && PITHOSMAPS="/srv/pithos/data/maps"
+       [ -z "${XSEG_LOGS}" ] && XSEG_LOGS="/srv/archip/logs"
        [ -z "${DEVICE_PREFIX}" ] && DEVICE_PREFIX="/dev/xsegbd"
        [ -z "${XSEGBD_SYSFS}" ] && XSEGBD_SYSFS="/sys/bus/xsegbd"
        [ -z "${CHRDEV_NAME}" ] && CHRDEV_NAME="/dev/`cat /proc/devices | grep segdev | awk '{print $2}'`"
        [ "${CHRDEV_NAME}" = "/dev/" ] && CHRDEV_NAME="/dev/segdev"
        [ -z "${CHRDEV_MAJOR}" ] && CHRDEV_MAJOR=`cat /proc/devices | grep segdev | awk '{print $1}'`
        [ -z "${CHRDEV_MAJOR}" ] && CHRDEV_MAJOR=60
-       [ -z "${NR_OPS}" ] && NR_OPS=16
+       [ -z "${NR_OPS}" ] && NR_OPS=128
        [ -z "${BPORT}" ] && BPORT=0
-       [ -z "${VPORT}" ] && VPORT=2
+       [ -z "${VPORT_START}" ] && VPORT_START=4
+       [ -z "${VPORT_END}" ] && VPORT_END=200
        [ -z "${MPORT}" ] && MPORT=1
+       [ -z "${MBPORT}" ] && MBPORT=2
+       [ -z "${VTOOL}" ] && VTOOL=3
 }
 
 
@@ -103,22 +140,40 @@ function spawn_filed {
 }
 
 function spawn_pfiled {
-       pgrep -f "peers/user/pfiled" || \
        "${XSEG_HOME}/peers/user/pfiled" -p "$BPORT" -g "${SPEC}" -n \
-       ${NR_OPS} "${PITHOS}" "${IMAGES}" &> "${XSEG_LOGS}/pfiled-${HOSTNAME}" &
+       ${NR_OPS} "${PITHOS}" "${IMAGES}" -v 1 &> "${XSEG_LOGS}/pfiled-${HOSTNAME}" &
+}
+
+function spawn_pfiledm {
+       "${XSEG_HOME}/peers/user/pfiled" -p "$MBPORT" -g "${SPEC}" -n \
+       ${NR_OPS} "${PITHOSMAPS}" "${MAPS}" -v 1  &> "${XSEG_LOGS}/pfiledm-${HOSTNAME}" &
+}
+
+function spawn_sosd {
+       "${XSEG_HOME}/peers/user/mt-sosd" -p "$BPORT" -g "${SPEC}" -n \
+       ${NR_OPS} --pool "blocks" -v 3 &> "${XSEG_LOGS}/sosd-${HOSTNAME}" &
+}
+
+function spawn_sosdm {
+       "${XSEG_HOME}/peers/user/mt-sosd" -p "$MBPORT" -g "${SPEC}" -n \
+       ${NR_OPS} --pool "maps" -v 3  &> "${XSEG_LOGS}/sosdm-${HOSTNAME}" &
 }
 
 function spawn_vlmcd {
-       pgrep -f "peers/user/mt-vlmcd" || \
-       "${XSEG_HOME}/peers/user/mt-vlmcd" -t 1 -p "$VPORT" -bp "$BPORT" -mp "$MPORT" -g \
-       "${SPEC}" -n ${NR_OPS} &> "${XSEG_LOGS}/vlmcd-${HOSTNAME}" &
+       pgrep -f "peers/user/st-vlmcd" || \
+       "${XSEG_HOME}/peers/user/st-vlmcd" -t 1 -sp "$VPORT_START" \
+       -ep "$VPORT_END" -bp "$BPORT" -mp "$MPORT" -g \
+       "${SPEC}" -n ${NR_OPS} -v 3 &> "${XSEG_LOGS}/vlmcd-${HOSTNAME}" &
 #      alloc_requests "$VPORT:0" 128
 }
 
 function spawn_mapperdc {
+       echo "\"${XSEG_HOME}/peers/user/mt-mapperd\" -t 1 -sp \"$MPORT\" -ep
+       \"$MPORT\" -bp \"$BPORT\" -mbp \"$MBPORT\" -g \"${SPEC}\" -n ${NR_OPS} -v 3" 
        pgrep -f "mt-mapperd" || \
-       "${XSEG_HOME}/peers/user/mt-mapperd" -t 1 -p "$MPORT" -bp "$BPORT"  -g "${SPEC}" \
-       &> "${XSEG_LOGS}/mapperd-${HOSTNAME}" &
+       "${XSEG_HOME}/peers/user/mt-mapperd" -t 1 -sp "$MPORT" -ep "$MPORT"\
+       -bp "$BPORT" -mbp "$MBPORT" -g "${SPEC}"\
+       -n ${NR_OPS} -v 3 &> "${XSEG_LOGS}/mapperd-${HOSTNAME}" & 
 #      alloc_requests "$MPORT:0" 128
 }
 
@@ -195,13 +250,15 @@ filed)
        case $2 in
        start)
                load_all
+               sleep 0.5
                spawn_filed
-               map_volume xsegvol 0 1
+               sleep 0.5
+               map_volume xsegvol 3 0
                ;;
        stop)
                pkill -f peers/user/filed
                sleep 0.5
-               unmap_device 0
+               unmap_device 3
                unload_all
                ;;
        esac
@@ -252,10 +309,10 @@ one)
        case $2 in
        start)
                load_all
-               sleep 0.5
-               spawn_filed
+               sleep 1
+               spawn_filed 
                spawn_mapperdc
-               spawn_vlmcd
+               spawn_vlmcd 
                ;;
        stop)
                pkill -f peers/user/mt-vlmcd || true
@@ -271,6 +328,80 @@ one)
                ;;
        esac
        ;;
+doublemap)
+       case $2 in
+       start)
+               load_all
+               sleep 0.5
+               spawn_pfiled
+               spawn_pfiledm
+               spawn_mapperdc
+               spawn_vlmcd
+               ;;
+       stop)
+               pkill -f peers/user/st-vlmcd || true
+#              free_requests "$VPORT:0" 128 || true
+               pkill -f peers/user/mt-mapperd || true
+#              free_requests "$MPORT:0" 128 || true
+               pkill -f peers/user/pfiled || true
+               sleep 0.5
+               unload_all
+               ;;
+       *)
+               help
+               ;;
+       esac
+       ;;
+mapperd)
+       case $2 in
+       start)
+               spawn_mapperdc
+               ;;
+       stop)
+               pkill -f peers/user/mt-mapperd || true
+               ;;
+       *)
+               help
+               ;;
+       esac
+       ;;
+doublesosd)
+       case $2 in
+       start)
+               load_all
+               sleep 0.5
+               spawn_sosd
+               spawn_sosdm
+               spawn_mapperdc
+               spawn_vlmcd
+               ;;
+       stop)
+               pkill -f peers/user/st-vlmcd || true
+#              free_requests "$VPORT:0" 128 || true
+               pkill -f peers/user/mt-mapperd || true
+#              free_requests "$MPORT:0" 128 || true
+               pkill -f peers/user/mt-sosd || true
+               sleep 0.5
+               unload_all
+               ;;
+       *)
+               help
+               ;;
+       esac
+       ;;
+mtmapperd)
+       case $2 in
+       start)
+               spawn_mapperdc
+               ;;
+       stop)
+               pkill -f peers/user/mt-mapperd || true
+               ;;
+       *)
+               help
+               ;;
+       esac
+       ;;
 *)
        help
        ;;