--install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
--install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
--install-scripts=$(DESTDIR)/$(bindir)
+ install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
clean:
python setup.py clean
.PHONY: tags
+########## sync
+# for use with the test framework; push local stuff on a test node
+# make sync NODE=vnode01.inria.fr
+# specify TESTMASTER and BUILD if the key is not available yet
+
+LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
+RSYNC_EXCLUDES := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
+RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
+RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
+
+ifdef NODE
+NODEURL:=root@$(NODE):/
+endif
+
+sync: $(NODE).key.rsa
+ifeq (,$(NODEURL))
+ @echo "sync: You must define NODE on the command line"
+ @echo " e.g. make sync NODE=vnode01.inria.fr"
+ @exit 1
+else
+ +$(RSYNC) ./ $(NODEURL)/usr/share/NodeManager/
+ +$(RSYNC) ./initscripts/nm $(NODEURL)/etc/init.d/nm
+endif
+
+### fetching the key
+
+TESTMASTER ?= testmaster.onelab.eu
+
+ifdef BUILD
+KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key1.rsa
+endif
+
+$(NODE).key.rsa:
+ifeq (,$(KEYURL))
+ @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
+ @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
+ @echo " note that for now all test builds use the same key, so any BUILD would do"
+ @exit 1
+else
+ scp $(KEYURL) $@
+endif
+
+### utility - find out the node name for a given BUILD
+
+ifdef BUILD
+NODEIPCOMMAND:=ssh root@$(TESTMASTER) cat $(BUILD)/arg-ips-node
+endif
+
+nodename:
+ifeq (,$(NODEIPCOMMAND))
+ @echo "nodename: You must define TESTMASTER and BUILD on the command line"
+else
+ $(NODEIPCOMMAND)
+endif
%setup -q
%build
+# make manages the C and Python stuff
%{__make} %{?_smp_mflags}
%install
+# make manages the C and Python stuff
rm -rf $RPM_BUILD_ROOT
%{__make} %{?_smp_mflags} install DESTDIR="$RPM_BUILD_ROOT"
Copyright 2008 Princeton University
http://www.planet-lab.org
+
+========================================
+--- NOTES on debugging
+
+
+(*) service nm restartdebug
+this lets you restart the nodemanager in interactive mode, and with faster periods
+
+
+(*) logs
+logging is a bit confusing; the main recipient is
+ /var/log/nm
+together with
+ /var/log/nm.daemon (which should be empty)
+
+but beware that part of the logs eventually end up in
+ /vservers/<slicename>/var/log/nm
+as well as in here (although this should not be used anymore by now)
+ /vservers/<slicename>/var/log/boot.log
+
+
+(*) connecting with PLC
+also, note that each time GetSlivers gets sucessfully fetched, it is saved in
+ /var/log/getslivers.txt
+
+When the connection is broken, for obscure reasons, all modules are
+invoked anyway, but with an empty dict as data, triggering various
+exceptions that complain about missing keys. In general these are red
+herrings.
prog="Node Manager"
options=${OPTIONS-"-d -s"}
restartoptions=${RESTARTOPTIONS-"-d"}
+# debug mode is interactive, and has faster period
+debugoptions=${DEBUGOPTIONS-"-p 60 -r 31"}
pidfile=${PIDFILE-/var/run/nm.pid}
lockfile=${LOCKFILE-/var/lock/subsys/nm}
RETVAL=0
[ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
}
-restart()
-{
- stop
- do_start $restartoptions
-}
-
-
case "$1" in
start)
- start
- ;;
+ start
+ ;;
stop)
- stop
- ;;
+ stop
+ ;;
status)
- status $nm
- RETVAL=$?
- ;;
+ status $nm
+ RETVAL=$?
+ ;;
restart|reload)
- restart
- ;;
+ stop
+ do_start $restartoptions
+ ;;
+ restartdebug)
+ stop
+ echo "Running interactively .."
+ $nm $debugoptions
+ ;;
condrestart)
- if [ -f ${pidfile} ] ; then
- restart
- fi
+ if [ -f ${pidfile} ] ; then
+ restart
+ fi
;;
*)
- echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ echo $"Usage: $0 {start|stop|restart|condrestart|status|restartdebug}"
exit 1
esac
plugin_path = "/usr/share/NodeManager/plugins"
+default_period=600
+default_random=301
+
parser = optparse.OptionParser()
parser.add_option('-d', '--daemon', action='store_true', dest='daemon', default=False, help='run daemonized')
parser.add_option('-s', '--startup', action='store_true', dest='startup', default=False, help='run all sliver startup scripts')
parser.add_option('-f', '--config', action='store', dest='config', default='/etc/planetlab/plc_config', help='PLC configuration file')
parser.add_option('-k', '--session', action='store', dest='session', default='/etc/planetlab/session', help='API session key (or file)')
-parser.add_option('-p', '--period', action='store', dest='period', default=600, help='Polling interval (sec)')
-parser.add_option('-r', '--random', action='store', dest='random', default=301, help='Range for additional random polling interval (sec)')
+parser.add_option('-p', '--period', action='store', dest='period', default=default_period,
+ help='Polling interval (sec) - default %d'%default_period)
+parser.add_option('-r', '--random', action='store', dest='random', default=default_random,
+ help='Range for additional random polling interval (sec) -- default %d'%default_random)
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False, help='more verbose log')
parser.add_option('-P', '--path', action='store', dest='path', default=plugin_path, help='Path to plugins directory')