2 # Node Manager Makefile
4 # David Eisenstat <deisenst@cs.princeton.edu>
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
9 # autoconf compatible variables
12 initdir=/etc/rc.d/init.d
13 systemddir := /usr/lib/systemd/system
17 # call with either WITH_SYSTEMD=true or WITH_INIT=true
18 # otherwise we try to guess some reasonable default
19 ifeq "$(WITH_INIT)$(WITH_SYSTEMD)" ""
20 ifeq "$(wildcard $systemddir/*)" ""
27 all: forward_api_calls
28 $(PYTHON) setup.py build
30 forward_api_calls: forward_api_calls.c
31 $(CC) -Wall -Os -o $@ $?
34 #################### install
35 install: install-miscell install-startup
36 $(PYTHON) setup.py install \
37 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
38 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
39 --install-scripts=$(DESTDIR)/$(bindir)
41 # might be better in setup.py ?
42 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
43 # need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
44 # impacts how nodemanager itself gets started
46 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
47 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
48 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
49 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
50 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
51 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
52 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
53 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
54 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
55 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
57 # this now is for the startup of nodemanager itself
58 ifneq "$(WITH_SYSTEMD)" ""
59 install-startup: install-systemd
61 ifneq "$(WITH_INIT)" ""
62 install-startup: install-init
66 mkdir -p $(DESTDIR)$(initdir)
67 chmod 755 initscripts/*
68 rsync -av initscripts/ $(DESTDIR)$(initdir)/
71 mkdir -p $(DESTDIR)/$(systemddir)
72 rsync -av systemd/ $(DESTDIR)/$(systemddir)
74 #################### clean
76 $(PYTHON) setup.py clean
77 rm -f forward_api_calls *.pyc build
79 .PHONY: all install clean
81 ################################################## devel-oriented
83 git ls-files | xargs etags
88 # for use with the test framework; push local stuff on a test node
89 # howto use: go on testmaster in the build you want to use and just run
91 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
92 # $ export BUILD=2013.07.02--lxc18
93 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
94 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
95 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
96 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
97 # $ export NODE=vnode01.pl.sophia.inria.fr
101 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
102 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
103 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
104 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
107 NODEURL:=root@$(NODE):/
110 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
111 # WARNING: keep this in sync with setup.spec
112 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
114 # run with make SYNC_RESTART=false if you want to skip restarting nm
119 synclxc: $(NODE).key.rsa
121 @echo "sync: You must define NODE on the command line"
122 @echo " e.g. make sync NODE=vnode01.inria.fr"
125 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
126 @echo WARNING : this target might not be very reliable - use with care
127 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
128 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
129 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
130 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
131 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
134 # this is for vs only, we need to exclude the lxc stuff that otherwise messes up everything on node
135 # xxx keep this in sync with setup.spec
136 VS_EXCLUDES= --exclude sliver_libvirt.py --exclude sliver_lxc.py --exclude cgroups.py --exclude coresched_lxc.py --exclude privatebridge.py
138 syncvs: $(NODE).key.rsa
140 @echo "syncvs: You must define NODE on the command line"
141 @echo " e.g. make sync NODE=vnode01.inria.fr"
144 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
145 @echo WARNING : this target might not be very reliable - use with care
146 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
147 +$(RSYNC) $(VS_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
148 +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
149 # +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
150 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
156 TESTMASTER ?= testmaster.onelab.eu
159 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
166 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
167 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
168 @echo " note that for now all test builds use the same key, so any BUILD would do"
179 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
180 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
181 echo "remember to run 'systemctl --system daemon-reload' within this slice"