Permalink
Browse files

repackaging lantorrent to be more pythonic

  • Loading branch information...
1 parent cf96ce4 commit 8d187eaababd58a72c23cd2e5cf0a7b9a3798f0f @buzztroll buzztroll committed May 19, 2011
@@ -110,7 +110,8 @@
if lantorrent_enabled:
LT_HOME = os.path.join(NIMBUS_HOME, "lantorrent/")
- LT_SERVICE_EXE = os.path.join(LT_HOME, "bin/lt-daemon")
+ os.environ['LANTORRENT_HOME'] = LT_HOME
+ LT_SERVICE_EXE = os.path.join(NIMBUS_HOME, "ve/bin/ltdaemon")
if not os.path.exists(LT_SERVICE_EXE):
sys.exit("The services executable does not exist: " +
LT_SERVICE_EXE)
View
@@ -115,7 +115,12 @@ if [ ! -f $CUMULUS_ENV ]; then
fi
export NIMBUS_HOME
-$NIMBUS_SRC/lantorrent/install.sh $NIMBUS_HOME/lantorrent | tee -a $NIMBUS_HOME/install.log
+
+export LANTORRENT_HOME=$NIMBUS_HOME/lantorrent
+mkdir $LANTORRENT_HOME
+cd $NIMBUS_SRC/lantorrent
+pwd
+$pyve_path/bin/python setup.py install | tee -a $NIMBUS_HOME/install.log
rc=$PIPESTATUS
if [ $rc -ne 0 ]; then
echo "lantorrent install failed"
View
@@ -72,14 +72,32 @@ To install LANTorrent you must take the following steps:
be sure to expand $NIMBUS_HOME to its full and actual path.
3) install lantorrent on VMM
- - run ./vmm-install.sh on each node
- either run it as your workspace control user or specify the workspace
- control user as the first and only argument to the script.
+
+ - run: python setup-vmm.py install. This will output the contents of
+ the xinetd configuration file that you will need in the next step.
4) install lantorrent into xinetd
- - the vmm-install.sh script creates the file lantorrent. This
- file is ready to be copied into /etc/xinetd.d/. Once this is done
- restart xinetd (/etc/init.d/xinetd restart).
+ - the above step outputs and xinetd file like this:
+
+ ============== START WITH THE NEXT LINE ==================
+ service lantorrent
+ {
+ type = UNLISTED
+ disable = no
+ socket_type = stream
+ protocol = tcp
+ user = bresnaha
+ wait = no
+ port = 2893
+ server = /home/bresnaha/lt1/bin/ltserver
+ }
+ =============== END WITH THE PREVIOUS LINE =================
+
+ note the 'user' value. We strongly recommend that it is not 'root'.
+ This user will be the owner of all received files (the nimbus user)
+
+ Copy the output to a file called /etc/xinetd.d/lantorrent. Once
+ this is done restart xinetd (/etc/init.d/xinetd restart).
5) change the propagation method.
- edit the file:
View
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-
-exec python ./pylantorrent/client.py "${@}"
View
@@ -1,7 +0,0 @@
-#!/bin/bash
-#rm -f /var/lib/eucalyptus/nimbustests/FILE_here
-
-
-
-ssh user04 /home/nimbus/virga/bin/req.sh $ip 2893 /var/lib/eucalyptus/nimbustests/FILE /var/lib/eucalyptus/nimbustests/FILE_here $1 $2
-
View
@@ -1,44 +0,0 @@
-{
- "destinations": [
- {
- "block_size": "131072",
- "file": "//home/bresnaha/FIRST.1\n",
- "host": "localhost",
- "id": "f935987a-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
- },
- {
- "block_size": "131072",
- "file": "//home/bresnaha/FIRST.2\n",
- "host": "localhost",
- "id": "f935d22c-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
- },
- {
- "block_size": "131072",
- "file": "//home/bresnaha/FIRST.3\n",
- "host": "localhost",
- "id": "f9360a76-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
- },
- {
- "block_size": "131072",
- "file": "//home/bresnaha/FIRST.4\n",
- "host": "localhost",
- "id": "f9364176-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
- },
- {
- "block_size": "131072",
- "file": "//home/bresnaha/FIRST.5\n",
- "host": "localhost",
- "id": "f9367af6-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
- }
- ],
- "file": "/dev/null",
- "host": "localhost",
- "id": "f93680a0-9da8-11df-a88c-001e378a7ce9",
- "port": "2893"
-}
-EOH : bLSbr4uinA/XfK+eziRHlDJuruE=
View
@@ -1,23 +0,0 @@
-{
- "destinations": [
- {
- "file": "/home/bresnaha/test2",
- "host": "localhost",
- "id": "63d90130-9db3-11df-9927-001e378a7ce9",
- "port": "2893",
- "block_size": "2893"
- },
- {
- "file": "/home/bresnaha/test3",
- "host": "localhost",
- "id": "63d90130-9db3-11df-9927-001e378a7ce9",
- "port": "2893",
- "block_size": "2893"
- }
- ],
- "file": "/dev/null",
- "host": "localhost",
- "id": "63d90130-9db3-11df-9927-001e378a7ce9",
- "port": "2893"
-}
-EOH : JWuClmImi9FKTJL/5D0CpqBk4Qg=
View
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-# this is the only end that will be located with the nimbus service
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-# so that we pick up the ini file
-export LANTORRENT_HOME=$pypath
-cd ../
-export NIMBUS_HOME=`pwd`
-source $NIMBUS_HOME/ve/bin/activate
-
-exec python $LANTORRENT_HOME/pylantorrent/daemon.py "${@}"
-
-
View
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# this is the only end that will be located with the nimbus service
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-# so that we pick up the ini file
-export LANTORRENT_HOME=$pypath
-cd ../
-export NIMBUS_HOME=`pwd`
-source $NIMBUS_HOME/ve/bin/activate
-
-exec python $LANTORRENT_HOME/pylantorrent/request.py "${@}"
View
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-
-export LANTORRENT_HOME=$pypath
-exec python ./pylantorrent/server.py "${@}"
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-count=$1
-if [ "X$1" == "X" ]; then
- count=1
-fi
-pidfile=$2
-
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-# so that we pick up the ini file
-export LANTORRENT_HOME=$pypath
-
-who=`whoami`
-delim=""
-ports_str=""
-rm -f $LANTORRENT_HOME/tests/xinetd.d/*
-for i in `seq 1 $count`
-do
-
- PORT=$RANDOM
- while [ $PORT -lt 2048 ];
- do
- PORT=$RANDOM
- x=`netstat -l --tcp --numeric-ports | grep $PORT`
- if [ "X$x" != "X" ]; then
- $PORT=0
- fi
- done
-
- SERVNAME="lantorrent$PORT"
-
- ports_str="$ports_str$delim$PORT"
- delim=","
- echo "s/@PORT@/$PORT/"
- echo "s/@SERVICENAME@/$SERVNAME/"
- echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
- sed -e "s/@WHO@/$who/" -e "s/@PORT@/$PORT/" -e "s/@SERVICENAME@/$SERVNAME/" -e "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/lantorrent.inet.in | tee $LANTORRENT_HOME/tests/xinetd.d/$SERVNAME
-
-done
-
-echo "export LANTORRENT_TEST_PORTS=$ports_str" > $LANTORRENT_HOME/tests/ports_env.sh
-
-ls -l $LANTORRENT_HOME/tests/xinetd.d/
-echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
-sed "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/xinetd.conf.in | tee $LANTORRENT_HOME/tests/xinetd.conf
-
-
-pidfile=$2
-exec xinetd -f $LANTORRENT_HOME/tests/xinetd.conf -pidfile $pidfile
View
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-# most users will not have xinetd in their path even if it is installed
-export PATH=/usr/sbin/:$PATH
-dir=`dirname $0`
-cd $dir/..
-pypath=`pwd`
-
-cd ../
-export NIMBUS_HOME=`pwd`
-source $NIMBUS_HOME/ve/bin/activate
-
-if [ "X${PYTHONPATH}" == "X" ]; then
- export PYTHONPATH=$pypath
-else
- export PYTHONPATH=$pypath:${PYTHONPATH}
-fi
-# so that we pick up the ini file
-export LANTORRENT_HOME=$pypath
-
-pidfile=`mktemp`
-$LANTORRENT_HOME/bin/make_lt_server.sh 4 $pidfile
-xinet_pid=`cat $pidfile`
-echo "xinet on $xinet_pid"
-
-cd $LANTORRENT_HOME
-$dir/lt-daemon &
-ltd_pid=$!
-
-trap "kill $xinet_pid $ltd_pid; sleep 10; kill -9 $xinet_pid $ltd_pid" EXIT
-source $LANTORRENT_HOME/tests/ports_env.sh
-nosetests tests/*_test.py
@@ -7,5 +7,5 @@ service @SERVICENAME@
user = @WHO@
wait = no
port = @PORT@
- server = @LANTORRENT_HOME@/bin/lt.sh
+ server = @SERVER@
}
View
@@ -2,7 +2,7 @@
password=nimbus
[log]
-file=@LANTORRENT_HOME@/log/lantorrent.@PGM@.log
-level=debug
+file=@LANTORRENT_HOME@/lantorrent.@PGM@.log
+level=info
[db]
-file=@LANTORRENT_HOME@/etc/req.db
+file=@LANTORRENT_HOME@/req.db
View
@@ -1,15 +0,0 @@
-create table requests(
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- rid varchar(36) UNIQUE NOT NULL,
- src_filename varchar(1024) NOT NULL,
- dst_filename varchar(1024) NOT NULL,
- xfer_id varchar(64),
- hostname varchar(1024) NOT NULL,
- port INTEGER NOT NULL DEFAULT 2893,
- state INTEGER DEFAULT 0,
- message TEXT,
- entry_time TIMESTAMP,
- attempt_count INTEGER DEFAULT 0,
- UNIQUE(hostname, port, dst_filename)
-);
-
View
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-if [ "X$1" == "X-h" ]; then
- echo "<install dir>"
- exit 0
-fi
-if [ "X$1" == "X" ]; then
- echo "please specify a target directory"
- exit 1
-fi
-
-echo "-----------------------------------------------------------------"
-echo " Installing LANTorrent"
-echo "-----------------------------------------------------------------"
-
-src_dir=`dirname $0`
-cd $src_dir
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "could not change directories"
- exit $rc
-fi
-src_dir=`pwd`
-
-installdir=$1
-mkdir $installdir
-cd $installdir
-installdir=`pwd`
-
-
-echo ""
-echo "Copying from $src_dir to $installdir"
-cp -r $src_dir/* $installdir/
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "failed to copy over lantorrent"
- exit $rc
-fi
-
-cd $installdir
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "could not change to the installation directory"
- exit $rc
-fi
-
-rm -f etc/req.db
-sqlite3 etc/req.db < etc/lt.sql
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "could not create the database"
- exit $rc
-fi
-echo "Success."
-exit 0
Oops, something went wrong.

0 comments on commit 8d187ea

Please sign in to comment.