This step assumes the disks are mounted on SYSIMG_PATH.
If successful, this function will not return. If it returns, no chain
booting has occurred.
-
+
Expect the following variables:
SYSIMG_PATH the path where the system image will be mounted
(always starts with TEMP_PATH)
NODE_SESSION the unique session val set when we requested
the current boot state
PLCONF_DIR The directory to store PL configuration files in
-
+
Sets the following variables:
ROOT_MOUNTED the node root file system is mounted
"""
ROOT_MOUNTED = 0
if vars.has_key('ROOT_MOUNTED'):
ROOT_MOUNTED = vars['ROOT_MOUNTED']
-
+
if ROOT_MOUNTED == 0:
log.write("Mounting node partitions\n")
# block devices will make them show up so vgscan can find the planetlab
# volume group
systeminfo.get_block_devices_dict(vars, log)
-
+
utils.sysexec("vgscan", log)
utils.sysexec("vgchange -ay planetlab", log)
log.write("conf_files failed with \n {}".format(e))
# update node packages
- log.write("Running node update.\n")
- if os.path.exists(SYSIMG_PATH + "/usr/bin/NodeUpdate.py"):
- cmd = "/usr/bin/NodeUpdate.py start noreboot"
- else:
+ #log.write("Running node update.\n")
+ #if os.path.exists(SYSIMG_PATH + "/usr/bin/NodeUpdate.py"):
+ # cmd = "/usr/bin/NodeUpdate.py start noreboot"
+ #else:
# for backwards compatibility
- cmd = "/usr/local/planetlab/bin/NodeUpdate.py start noreboot"
- utils.sysexec_chroot(SYSIMG_PATH, cmd, log)
+ # cmd = "/usr/local/planetlab/bin/NodeUpdate.py start noreboot"
+ #utils.sysexec_chroot(SYSIMG_PATH, cmd, log)
+ log.write("NodeUpdate skipped\n")
# Re-generate initrd right before kexec call
# this is not required anymore on recent depls.
# kernel and initrd come in various locations depending on the distro
kernel_candidates = []
- kernel_candidates.append("/boot/vmlinux-{}*".format(kversion))
+ kernel_candidates.append("/boot/vmlinuz-{}*".format(kversion))
# on f23 starting dec. 2015 - what a twisted naming scheme
- kernel_candidates.append("/boot/*/{}*/initrd".format(kversion))
+ kernel_candidates.append("/boot/*/{}*/linux".format(kversion))
initrd_candidates = []
# f16/18: expect initramfs image here
# Ubuntu:
initrd_candidates.append ("/boot/initrd.img-{}".format(kversion))
- def find_file_in_sysimg (candidates):
+ def install_from_sysimg_to_tmp (candidates, name):
import glob
+ found = None
for pattern in candidates:
matches = glob.glob(SYSIMG_PATH+pattern)
- log.write("locating initrd: found {} matches in {}\n".format(len(matches), pattern))
+ log.write("locating {}: found {} matches in {}\n".format(name, len(matches), pattern))
if matches:
- return matches[0]
-
- kernel = find_file_in_sysimg(kernel_candidates)
- if kernel:
- utils.sysexec("cp {} /tmp/kernel".format(kernel), log)
- else:
- raise Exception("Unable to locate kernel - bailing out")
-
+ found = matches[0]
+ break
+ if not found:
+ raise Exception("Unable to locate {} for kexec'ing".format(name))
+ utils.sysexec("cp {} /tmp/{}".format(found, name))
- initrd = find_file_in_sysimg(initrd_candidates)
- if initrd:
- utils.sysexec("cp {} /tmp/initrd".format(initrd), log)
- else:
- raise Exception("Unable to locate initrd - bailing out")
+ install_from_sysimg_to_tmp(kernel_candidates, 'kernel')
+ install_from_sysimg_to_tmp(initrd_candidates, 'initrd')
BootAPI.save(vars)
log.write("Unmounting disks.\n")
-
+
if (vars['ONE_PARTITION'] != '1'):
utils.sysexec("umount {}/vservers".format(SYSIMG_PATH), log)
utils.sysexec("umount {}/proc".format(SYSIMG_PATH), log)
# to get kexec to work correctly. Even on 3.x cds (2.6 kernel),
# there are a few buggy drivers that don't disable their hardware
# correctly unless they are first unloaded.
-
- utils.sysexec_noerr("ifconfig eth0 down", log)
+
+ utils.sysexec_noerr("ifconfig eth0 down || /usr/libexec/nm-ifdown eth0",
+ log, shell=True)
utils.sysexec_noerr("killall dhclient", 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
# unloading cpqphp causes a kernel panic
blacklist = [ "floppy", "cpqphp", "i82875p_edac", "mptspi"]
try:
modules = file("/tmp/loadedmodules","r")
-
+
for line in modules:
module = string.strip(line)
if module in blacklist :
except IOError:
# /kargs.txt does not exist, which is fine. Just kexec with default
# kargs, which is ramdisk_size=8192
- pass
+ pass
utils.sysexec_noerr('hwclock --systohc --utc ', log)
# utils.breakpoint("Before kexec");