# $ run export
# and cut'n paste the export lines before you run make sync
-PLCHOST ?= testplc.onelab.eu
+PLCHOSTLXC ?= lxc64-1.pl.sophia.inria.fr
ifdef PLC
SSHURL:=root@$(PLC):/
SSHCOMMAND:=ssh root@$(PLC)
else
ifdef PLCHOSTLXC
-SSHURL:=root@$(PLCHOST):/var/lib/lxc/$(GUESTNAME)/rootfs
+SSHURL:=root@$(PLCHOSTLXC):/var/lib/lxc/$(GUESTNAME)/rootfs
SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh $(GUESTHOSTNAME)
else
ifdef PLCHOSTVS
##########
tags:
- find . -type f | egrep -v 'TAGS|/\.svn/|\.git/|~$$' | xargs etags
+ find . -type f | egrep -v 'TAGS|DIFF|/\.svn/|\.git/|~$$' | xargs etags
.PHONY: tags
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
-Requires: tar, gnupg, sharutils, bzip2, pypcilib
+Requires: tar, gnupg, sharutils, bzip2
# need the apache user at install-time
Requires: httpd
-Requires: PLCAPI >= 5.0
-# the python code packaged in these are shipped on the node as well
+Requires: plcapi >= 5.2
+# we need to install these on the myplc side too, although this is suboptimal
+# b/c this python code gets shipped on the nodes as well
Requires: pypcilib pyplnet
### avoid having yum complain about updates, as stuff is moving around
/etc/plc.d/bootmanager
%changelog
+* Fri Feb 22 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.1-5
+- fix for heterogeneous bootimage/nodeimage
+
+* Thu Feb 21 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.1-4
+- Turn off WriteModprobeConfig for f18
+- enable btrfs quota
+- fix very old ssh DSA key generation
+
+* Tue Oct 16 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.1-3
+- run parted with --script to keep it from hanging
+
* Fri Aug 31 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.0-24
- run parted with --script to avoid it to hang
+* Wed Jul 18 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.1-2
+- pour the 5.0-22 and 5.0-23 features into the lxc mix
+
* Mon Jul 09 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.0-23
- added support for disks larger than 2Tb using gpt instead of msdos
* Tue May 15 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.0-22
- bootmanager log clearly states duration of download and extraction of node image
+* Fri Apr 13 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.1-1
+- first working draft for dealing with f16 nodes
+- not expected to work with mainline nodes (use 5.0 for that for now)
+
* Fri Apr 13 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - bootmanager-5.0-21
- no significant change, just checkpoint as 5.1 is addressing lxc
* Fri Sep 2 2005 Mark Huang <mlhuang@cotton.CS.Princeton.EDU> -
- Initial build.
-%define module_current_branch 4.3
InstallInit.Run( self.VARS, self.LOG )
ret = ValidateNodeInstall.Run( self.VARS, self.LOG )
if ret == 1:
- WriteModprobeConfig.Run( self.VARS, self.LOG )
+# Thierry - feb. 2013 turning off WriteModprobeConfig for now on lxc
+# for one thing this won't work at all with f18, as modules.pcimap
+# has disappeared (Daniel suggested modules.aliases could be used instead)
+# and second, in any case it's been years now that modprobe.conf was deprecated
+# so most likely this code has no actual effect
+ if vars['virt'] == 'vs':
+ WriteModprobeConfig.Run( self.VARS, self.LOG )
WriteNetworkConfig.Run( self.VARS, self.LOG )
CheckForNewDisks.Run( self.VARS, self.LOG )
SendHardwareConfigToPLC.Run( self.VARS, self.LOG )
# the current version of the bootmanager
-VERSION=3.2
+VERSION=5.2
# this is the server to contact if we don't have a bootcd
DEFAULT_BOOT_SERVER=boot.planet-lab.org
# this sets the size of the root logical volume,
# after the root and swap has been created, remaining
# goes to the vserver partition
-ROOT_SIZE=14G
+vs_ROOT_SIZE=14G
+lxc_ROOT_SIZE=70G
# override the swap size
# total minimum disk size in GB if all usable disks are below this
# size, the node cannot be installed
-TOTAL_MINIMUM_DISK_SIZE=50
+vs_TOTAL_MINIMUM_DISK_SIZE=50
+lxc_TOTAL_MINIMUM_DISK_SIZE=120
# set of langugase for install (used in /etc/rpm/macros)
import string
import re
import os
+import time
-import UpdateNodeConfiguration
-import MakeInitrd
-import StopRunlevelAgent
-from Exceptions import *
import utils
import systeminfo
-import BootAPI
import notify_messages
-import time
-
+import BootAPI
import ModelOptions
+from Exceptions import BootManagerException
+
+import UpdateNodeConfiguration
+import StopRunlevelAgent
def Run( vars, log ):
"""
utils.sysexec_chroot( SYSIMG_PATH, cmd, log )
# Re-generate initrd right before kexec call
- MakeInitrd.Run( vars, log )
+ # this is not required anymore on recent depls.
+ if vars['virt'] == 'vs':
+ MakeInitrd.Run( vars, log )
# the following step should be done by NM
UpdateNodeConfiguration.Run( vars, log )
option = 'smp'
log.write( "Copying kernel and initrd for booting.\n" )
- utils.sysexec( "cp %s/boot/kernel-boot%s /tmp/kernel" % (SYSIMG_PATH,option), log )
- utils.sysexec( "cp %s/boot/initrd-boot%s /tmp/initrd" % (SYSIMG_PATH,option), log )
+ if vars['virt'] == 'vs':
+ utils.sysexec( "cp %s/boot/kernel-boot%s /tmp/kernel" % (SYSIMG_PATH,option), log )
+ utils.sysexec( "cp %s/boot/initrd-boot%s /tmp/initrd" % (SYSIMG_PATH,option), log )
+ else:
+ # Use chroot to call rpm, b/c the bootimage&nodeimage rpm-versions may not work together
+ kversion = os.popen("chroot %s rpm -qa kernel | tail -1 | cut -c 8-" % SYSIMG_PATH).read().rstrip()
+ utils.sysexec( "cp %s/boot/vmlinuz-%s /tmp/kernel" % (SYSIMG_PATH,kversion), log )
+ utils.sysexec( "cp %s/boot/initramfs-%s.img /tmp/initrd" % (SYSIMG_PATH,kversion), log )
BootAPI.save(vars)
utils.sysexec_noerr( "killall dhclient", log )
- utils.sysexec_noerr( "umount -a -r -t ext2,ext3", log )
+ if vars['virt'] == 'vs':
+ utils.sysexec_noerr( "umount -a -r -t ext2,ext3", log )
+ else:
+ utils.sysexec_noerr( "umount -a -r -t ext2,ext3,btrfs", log )
utils.sysexec_noerr( "modprobe -r lvm-mod", log )
# modules that should not get unloaded
MINIMUM_DISK_SIZE= int(vars["MINIMUM_DISK_SIZE"])
- TOTAL_MINIMUM_DISK_SIZE= \
- int(vars["TOTAL_MINIMUM_DISK_SIZE"])
+ # use vs_ or lxc_variants
+ varname=vars['virt']+"_TOTAL_MINIMUM_DISK_SIZE"
+ TOTAL_MINIMUM_DISK_SIZE= int(vars[varname])
SKIP_HARDWARE_REQUIREMENT_CHECK= \
int(vars["SKIP_HARDWARE_REQUIREMENT_CHECK"])
# Copyright (c) 2004-2006 The Trustees of Princeton University
# All rights reserved.
+import sys, traceback
import string
from Exceptions import *
vars['INTERFACES']= interfaces
+ # call getNodeFlavour and store in VARS['node_flavour']
+ try:
+ node_flavour = BootAPI.call_api_function(vars, "GetNodeFlavour", (vars['NODE_ID'], ) )
+ nodefamily = node_flavour['nodefamily']
+ extensions = node_flavour['extensions']
+ plain = node_flavour['plain']
+ except:
+ exc_type, exc_value, exc_traceback = sys.exc_info()
+ lines=traceback.format_exception(exc_type,exc_value,exc_traceback)
+ for line in lines: log.write(line)
+ raise BootManagerException ("Could not call GetNodeFlavour - need PLCAPI-5.2")
+
+ # 'vs' or 'lxc'
+ vars['virt'] = node_flavour['virt']
+ # the basename for downloading nodeimage
+ vars['nodefamily'] = node_flavour['nodefamily']
+ # extensions to be applied on top of the base nodeimage
+ vars['extensions'] = node_flavour ['extensions']
+ # false if compressed image, true if not
+ vars['plain'] = node_flavour ['plain']
+ log.write ("NodeFlavour as returned from PLC: %s\n"%node_flavour)
+
return 1
# All rights reserved.
# expected /proc/partitions format
-import os, sys, string
+import os, string
import popen2
import shutil
import traceback
log.write( "mounting root file system\n" )
utils.sysexec( "mount -t ext3 %s %s" % (PARTITIONS["root"],SYSIMG_PATH), log )
- log.write( "mounting vserver partition in root file system\n" )
+ fstype = 'ext3' if vars['virt']=='vs' else 'btrfs'
+ log.write( "mounting vserver partition in root file system (type %s)\n"%fstype )
utils.makedirs( SYSIMG_PATH + "/vservers" )
- utils.sysexec( "mount -t ext3 %s %s/vservers" % (PARTITIONS["vservers"],
- SYSIMG_PATH), log )
+ utils.sysexec( "mount -t %s %s %s/vservers" % \
+ (fstype, PARTITIONS["vservers"], SYSIMG_PATH), log )
+
+ if vars['virt']=='lxc':
+ # NOTE: btrfs quota is supported from version: >= btrfs-progs-0.20 (f18+)
+ # older versions will not recongize the 'quota' command.
+ log.write( "Enabling btrfs quota on %s/vservers\n"%SYSIMG_PATH )
+ utils.sysexec_noerr( "btrfs quota enable %s/vservers" % SYSIMG_PATH )
vars['ROOT_MOUNTED']= 1
- # call getNodeFlavour
- try:
- node_flavour = BootAPI.call_api_function(vars, "GetNodeFlavour", (NODE_ID,) )
- nodefamily = node_flavour['nodefamily']
- extensions = node_flavour['extensions']
- plain = node_flavour['plain']
- except:
- exc_type, exc_value, exc_traceback = sys.exc_info()
- lines=traceback.format_exception(exc_type,exc_value,exc_traceback)
- for line in lines: log.write(line)
- raise BootManagerException ("Could not call GetNodeFlavour - need PLCAPI-5.0")
-
- log.write ("Retrieved 'virt' style %s from GetNodeFlavour\n"%node_flavour['virt'])
+ # this is now retrieved in GetAndUpdateNodeDetails
+ nodefamily = vars['nodefamily']
+ extensions = vars['extensions']
# the 'plain' option is for tests mostly
+ plain = vars['plain']
if plain:
download_suffix=".tar"
uncompress_option=""
if( len(INSTALL_BLOCK_DEVICES) == 0 ):
raise ValueError, "INSTALL_BLOCK_DEVICES is empty"
- ROOT_SIZE= vars["ROOT_SIZE"]
+ # use vs_ROOT_SIZE or lxc_ROOT_SIZE as appropriate
+ varname=vars['virt']+"_ROOT_SIZE"
+ ROOT_SIZE= vars[varname]
if ROOT_SIZE == "" or ROOT_SIZE == 0:
raise ValueError, "ROOT_SIZE invalid"
# reserved-blocks-percentages
filesystems = {"root":5,"vservers":0}
- # make the file systems
- for fs in filesystems.keys():
- # get the reserved blocks percentage
- rbp = filesystems[fs]
- devname = PARTITIONS[fs]
+ # ROOT filesystem is always with ext2
+ fs = 'root'
+ rbp = filesystems[fs]
+ devname = PARTITIONS[fs]
+ log.write("formatting %s partition (%s)%s.\n" % (fs,devname,txt))
+ utils.sysexec( "mkfs.ext2 -q %s -m %d -j %s" % (option,rbp,devname), log )
+ # disable time/count based filesystems checks
+ utils.sysexec_noerr( "tune2fs -c -1 -i 0 %s" % devname, log)
+
+ # VSERVER filesystem with btrfs to support snapshoting and stuff
+ fs = 'vservers'
+ rbp = filesystems[fs]
+ devname = PARTITIONS[fs]
+ if vars['virt']=='vs':
log.write("formatting %s partition (%s)%s.\n" % (fs,devname,txt))
utils.sysexec( "mkfs.ext2 -q %s -m %d -j %s" % (option,rbp,devname), log )
-
- # disable time/count based filesystems checks
- for filesystem in ("root","vservers"):
- utils.sysexec_noerr( "tune2fs -c -1 -i 0 %s" % PARTITIONS[filesystem], log)
+ # disable time/count based filesystems checks
+ utils.sysexec_noerr( "tune2fs -c -1 -i 0 %s" % devname, log)
+ else:
+ log.write("formatting %s btrfs partition (%s).\n" % (fs,devname))
+ utils.sysexec( "mkfs.btrfs %s" % (devname), log )
+ # as of 2013/02 it looks like there's not yet an option to set fsck frequency with btrfs
# save the list of block devices in the log
log.write( "Block devices used (in lvm): %s\n" % repr(used_devices))
from Exceptions import *
import utils
-import systeminfo
import BootAPI
import ModelOptions
utils.sysexec_chroot( SYSIMG_PATH,
"ln -sf /usr/share/zoneinfo/UTC /etc/localtime", log )
+ # clearly this does not depend on vs / lxc but let's keep it simple
log.write( "Enabling ntp at boot\n" )
- utils.sysexec_chroot( SYSIMG_PATH, "chkconfig ntpd on", log )
+ if vars['virt'] == 'vs':
+ utils.sysexec_chroot( SYSIMG_PATH, "chkconfig ntpd on", log )
+ else:
+ utils.sysexec_chroot( SYSIMG_PATH, "systemctl enable ntpd.service", log )
log.write( "Creating system directory %s\n" % PLCONF_DIR )
if not utils.makedirs( "%s/%s" % (SYSIMG_PATH,PLCONF_DIR) ):
PARTITIONS["mapper-swap"] )
fstab.write( "%s / ext3 defaults 1 1\n" % \
PARTITIONS["mapper-root"] )
- fstab.write( "%s /vservers ext3 tagxid,defaults 1 2\n" % \
- PARTITIONS["mapper-vservers"] )
+ if vars['virt'] == 'vs':
+ fstab.write( "%s /vservers ext3 tagxid,defaults 1 2\n" % \
+ PARTITIONS["mapper-vservers"] )
+ else:
+ fstab.write( "%s /vservers btrfs defaults 1 2\n" % \
+ PARTITIONS["mapper-vservers"] )
fstab.write( "none /proc proc defaults 0 0\n" )
fstab.write( "none /dev/shm tmpfs defaults 0 0\n" )
fstab.write( "none /dev/pts devpts defaults 0 0\n" )
key=ssh_dir+"/ssh_host_dsa_key"
if not os.path.isfile (key):
log.write("Creating host dsa key %s\n"%key)
- utils.sysexec( "ssh-keygen -d -f %s -N ''" % key, log )
+ # very old versions did 'ssh-keygen -d' instead of 'ssh-keygen -t dsa'
+ utils.sysexec( "ssh-keygen -t dsa -f %s -N ''" % key, log )
# (over)write sshd config
utils.sysexec( "cp -f %s/sshd_config %s/sshd_config" % (ssh_source_files,ssh_dir), log )
utils.makedirs( SYSIMG_PATH )
- for filesystem in ("root","vservers"):
+ # xxx - TODO - need to fsck the btrfs partition
+ if vars['virt'] == 'vs':
+ filesystems_tocheck = ['root', 'vservers']
+ else:
+ filesystems_tocheck = ['root']
+ for filesystem in filesystems_tocheck:
try:
# first run fsck to prevent fs corruption from hanging mount...
log.write( "fsck %s file system\n" % filesystem )
try:
VSERVERS_PATH = "%s/vservers" % SYSIMG_PATH
utils.makedirs(VSERVERS_PATH)
- log.write( "mounting vserver partition in root file system\n" )
- utils.sysexec("mount -t ext3 %s %s" % (PARTITIONS["vservers"], VSERVERS_PATH), log)
+ log.write( "mounting vservers partition in root file system\n" )
+ if vars['virt']=='vs':
+ utils.sysexec("mount -t ext3 %s %s" % (PARTITIONS["vservers"], VSERVERS_PATH), log)
+ else:
+ utils.sysexec("mount -t btrfs %s %s" % (PARTITIONS["vservers"], VSERVERS_PATH), log)
except BootManagerException, e:
log.write( "BootManagerException during mount of /vservers: %s\n" % str(e) )
return -2
# these 2 links are created by our kernel's post-install scriplet
log.write("Checking for a custom kernel\n")
try:
- os.stat("%s/boot/kernel-boot" % SYSIMG_PATH)
+ if vars['virt'] == 'vs':
+ os.stat("%s/boot/kernel-boot" % SYSIMG_PATH)
+ else:
+ kversion = os.popen("chroot %s rpm -qa kernel | tail -1 | cut -c 8-" % SYSIMG_PATH).read().rstrip()
+ os.stat("%s/boot/vmlinuz-%s" % (SYSIMG_PATH,kversion))
except OSError, e:
log.write( "Couldn't locate base kernel (you might be using the stock kernel).\n")
return -3
# if the network modules are activated in a different order that the
# boot cd.
+ log.write( "\n\nStep: WriteModProbeConfig.\n" )
+
# make sure we have this class loaded
try: