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 forward_api_calls $(DESTDIR)/$(bindir)/forward_api_calls
47 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
48 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
49 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
50 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
51 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
52 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
53 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
54 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
55 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
56 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
58 # this now is for the startup of nodemanager itself
59 ifneq "$(WITH_SYSTEMD)" ""
60 install-startup: install-systemd
62 ifneq "$(WITH_INIT)" ""
63 install-startup: install-init
67 mkdir -p $(DESTDIR)$(initdir)
68 chmod 755 initscripts/*
69 rsync -av initscripts/ $(DESTDIR)$(initdir)/
72 mkdir -p $(DESTDIR)/$(systemddir)
73 rsync -av systemd/ $(DESTDIR)/$(systemddir)
75 #################### clean
77 $(PYTHON) setup.py clean
78 rm -f forward_api_calls *.pyc build
80 .PHONY: all install clean
82 ################################################## devel-oriented
84 git ls-files | xargs etags
89 # for use with the test framework; push local stuff on a test node
90 # howto use: go on testmaster in the build you want to use and just run
92 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
93 # $ export BUILD=2013.07.02--lxc18
94 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
95 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
96 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
97 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
98 # $ export NODE=vnode01.pl.sophia.inria.fr
102 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
103 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
104 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
105 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
108 NODEURL:=root@$(NODE):/
111 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
112 # WARNING: keep this in sync with setup.spec
113 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
115 # run with make SYNC_RESTART=false if you want to skip restarting nm
120 synclxc: $(NODE).key.rsa
122 @echo "sync: You must define NODE on the command line"
123 @echo " e.g. make sync NODE=vnode01.inria.fr"
126 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
127 @echo WARNING : this target might not be very reliable - use with care
128 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
129 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
130 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
131 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
132 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
135 # this is for vs only, we need to exclude the lxc stuff that otherwise messes up everything on node
136 # xxx keep this in sync with setup.spec
137 VS_EXCLUDES= --exclude sliver_libvirt.py --exclude sliver_lxc.py --exclude cgroups.py --exclude coresched_lxc.py --exclude privatebridge.py
139 syncvs: $(NODE).key.rsa
141 @echo "syncvs: You must define NODE on the command line"
142 @echo " e.g. make sync NODE=vnode01.inria.fr"
145 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
146 @echo WARNING : this target might not be very reliable - use with care
147 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
148 +$(RSYNC) $(VS_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
149 +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
150 # +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
151 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
157 TESTMASTER ?= testmaster.onelab.eu
160 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
167 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
168 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
169 @echo " note that for now all test builds use the same key, so any BUILD would do"
180 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
181 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
182 echo "remember to run 'systemctl --system daemon-reload' within this slice"