package details
authorMark Huang <mlhuang@cs.princeton.edu>
Mon, 13 Nov 2006 20:04:44 +0000 (20:04 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Mon, 13 Nov 2006 20:04:44 +0000 (20:04 +0000)
Makefile
NodeManager.spec [new file with mode: 0644]
nm.init [new file with mode: 0755]
nm.logrotate [new file with mode: 0644]
setup.py [new file with mode: 0644]

index 5ee8c18..0ceb9bb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,31 @@
+#
+# Node Manager Makefile
+#
+# David Eisenstat <deisenst@cs.princeton.edu>
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+# $Id$
+#
+
+# autoconf compatible variables
+datadir := /usr/share
+bindir := /usr/bin
+
+all: forward_api_calls
+       python setup.py build
+
 forward_api_calls: forward_api_calls.c
        $(CC) -Wall -Os -o $@ $?
        strip $@
+
+install:
+       python setup.py install \
+           --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
+           --install-scripts=$(DESTDIR)/$(bindir)
+
 clean:
-       rm -f forward_api_calls
-.PHONY: clean
+       python setup.py clean
+       rm -f forward_api_calls *.pyc
+
+.PHONY: all install clean
diff --git a/NodeManager.spec b/NodeManager.spec
new file mode 100644 (file)
index 0000000..458672c
--- /dev/null
@@ -0,0 +1,50 @@
+Summary: PlanetLab Node Manager
+Name: NodeManager
+Version: 0.1
+Release: 1
+License: PlanetLab
+Group: System Environment/Daemons
+URL: http://cvs.planet-lab.org/cvs/NodeManager
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Obsoletes: sidewinder
+
+# Uses function decorators
+Requires: python >= 2.4
+
+%description
+The PlanetLab Node Manager manages all aspects of PlanetLab node and
+slice management once the node has been initialized and configured by
+the Boot Manager. It periodically contacts its management authority
+for configuration updates. It provides an XML-RPC API for performing
+local operations on slices.
+
+%prep
+%setup -q
+
+%build
+%{__make} %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} %{?_smp_mflags} install DESTDIR="$RPM_BUILD_ROOT"
+
+install -D -m 755 nm.init $RPM_BUILD_ROOT/%{_initrddir}/nm
+install -D -m 644 nm.logrotate $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/nm
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc
+%dir %{_datadir}/NodeManager
+%{_datadir}/NodeManager/*
+%{_bindir}/forward_api_calls
+%{_initrddir}/nm
+
+%changelog
+* Mon Nov 13 2006 Mark Huang <mlhuang@paris.CS.Princeton.EDU> - 
+- Initial build.
+
diff --git a/nm.init b/nm.init
new file mode 100755 (executable)
index 0000000..d97c215
--- /dev/null
+++ b/nm.init
@@ -0,0 +1,69 @@
+#!/bin/bash
+#
+# nm       Starts and stops Node Manager daemon
+#
+# chkconfig: 3 86 26
+# description: Starts and stops Node Manager daemon
+#
+# $Id: vnet.init,v 1.21 2006/02/27 15:41:27 mlhuang Exp $
+
+# Source function library.
+. /etc/init.d/functions
+
+if [ -f /etc/sysconfig/NodeManager ]; then
+    . /etc/sysconfig/NodeManager
+fi
+
+nm=${NM-"python /usr/share/NodeManager/nm.py"}
+prog="Node Manager"
+options=${OPTIONS-"-d -s"}
+pidfile=${PIDFILE-/var/run/nm.pid}
+lockfile=${LOCKFILE-/var/lock/subsys/nm}
+RETVAL=0
+
+start()
+{
+    echo -n $"Starting $prog: "
+    daemon --check=nm $nm $options
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && touch ${lockfile}
+    return $RETVAL
+}
+
+stop()
+{
+    echo -n $"Stopping $prog: "
+    killproc nm
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
+}
+
+case "$1" in
+    start)
+       start
+       ;;
+    stop)
+       stop
+       ;;
+    status)
+       status $nm
+       RETVAL=$?
+       ;;
+    restart|reload)
+       stop
+       start
+       ;;
+    condrestart)
+       if [ -f ${pidfile} ] ; then
+           stop
+           start
+       fi
+       ;;
+    *)
+       echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+       exit 1
+esac
+
+exit 0
diff --git a/nm.logrotate b/nm.logrotate
new file mode 100644 (file)
index 0000000..548cfb1
--- /dev/null
@@ -0,0 +1,8 @@
+/var/log/nm.log {
+    copytruncate
+    compress
+    daily
+    notifempty
+    rotate 5
+    missingok
+}
diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..0869b8f
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+#
+# Setup script for the Node Manager application
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+# $Id: setup.py,v 1.1 2005/12/22 21:43:25 mlhuang Exp $
+#
+
+from distutils.core import setup
+
+setup(
+    py_modules=[
+    'accounts',
+    'api',
+    'conf_files',
+    'config',
+    'curlwrapper',
+    'database',
+    'delegate',
+    'logger',
+    'plcapi',
+    'safexmlrpc',
+    'sliver_vs',
+    'sm',
+    'ticket',
+    'tools',
+    ],
+    scripts = [
+    'forward_api_calls',
+    ],
+    )