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
15 # call with either WITH_SYSTEMD=true or WITH_INIT=true
16 # otherwise we try to guess some reasonable default
17 ifeq "$(WITH_INIT)$(WITH_SYSTEMD)" ""
18 ifeq "$(wildcard $systemddir/*)" ""
25 all: forward_api_calls
28 forward_api_calls: forward_api_calls.c
29 $(CC) -Wall -Os -o $@ $?
32 #################### install
33 install: install-miscell install-startup
34 python setup.py install \
35 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
36 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
37 --install-scripts=$(DESTDIR)/$(bindir)
39 # might be better in setup.py ?
40 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
41 # need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
42 # impacts how nodemanager itself gets started
44 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
45 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
46 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
47 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
48 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
49 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
50 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
51 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
52 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
53 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
55 # this now is for the startup of nodemanager itself
56 ifneq "$(WITH_SYSTEMD)" ""
57 install-startup: install-systemd
59 ifneq "$(WITH_INIT)" ""
60 install-startup: install-init
64 mkdir -p $(DESTDIR)$(initdir)
65 chmod 755 initscripts/*
66 rsync -av initscripts/ $(DESTDIR)$(initdir)/
69 mkdir -p $(DESTDIR)/$(systemddir)
70 rsync -av systemd/ $(DESTDIR)/$(systemddir)
72 #################### clean
75 rm -f forward_api_calls *.pyc build
77 .PHONY: all install clean
79 #################### debian-related
80 # This is called from the build with the following variables set
81 # (see build/Makefile and target_debian)
86 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
87 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
88 DATE=$(shell date -u +"%a, %d %b %Y %T")
91 debian: DESTDIR=debian/tmp
92 debian: forward_api_calls install debian/changelog debian.source debian.package
94 debian/changelog: debian/changelog.in
95 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
98 rsync -a $(RPMTARBALL) $(DEBTARBALL)
101 debuild --set-envvar PREFIX=/usr -uc -us -b
104 $(MAKE) -f debian/rules clean
105 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
106 find . -name '*.pyc' -delete
108 ################################################## devel-oriented
110 (find . '(' -name '*.py' -o -name '*.c' -o -name '*.spec' ')' ; ls initscripts/*) | xargs etags
115 # for use with the test framework; push local stuff on a test node
116 # howto use: go on testmaster in the build you want to use and just run
118 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
119 # $ export BUILD=2013.07.02--lxc18
120 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
121 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
122 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
123 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
124 # $ export NODE=vnode01.pl.sophia.inria.fr
128 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
129 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
130 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
131 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
134 NODEURL:=root@$(NODE):/
137 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
138 # WARNING: keep this in sync with setup.spec
139 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
141 # run with make SYNC_RESTART=false if you want to skip restarting nm
146 synclxc: $(NODE).key.rsa
148 @echo "sync: You must define NODE on the command line"
149 @echo " e.g. make sync NODE=vnode01.inria.fr"
152 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
153 @echo WARNING : this target might not be very reliable - use with care
154 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
155 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
156 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
157 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
158 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
161 # this is for vs only, we need to exclude the lxc stuff that otherwise messes up everything on node
162 # xxx keep this in sync with setup.spec
163 VS_EXCLUDES= --exclude sliver_libvirt.py --exclude sliver_lxc.py --exclude cgroups.py --exclude coresched_lxc.py --exclude privatebridge.py
165 syncvs: $(NODE).key.rsa
167 @echo "syncvs: You must define NODE on the command line"
168 @echo " e.g. make sync NODE=vnode01.inria.fr"
171 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
172 @echo WARNING : this target might not be very reliable - use with care
173 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
174 +$(RSYNC) $(VS_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
175 +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
176 # +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
177 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
183 TESTMASTER ?= testmaster.onelab.eu
186 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
193 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
194 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
195 @echo " note that for now all test builds use the same key, so any BUILD would do"
206 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
207 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
208 echo "remember to run 'systemctl --system daemon-reload' within this slice"