X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FChainBootNode.py;h=98c49694f29034a5f8a96d20d675e88912a2be63;hb=9e35fd49162bec845da883c5b986921335257eb3;hp=baba4837766192ca41e956d9f36ef7107d15258a;hpb=9a1597edcbb668dcd6100f3ad9f6e0c109bc51c3;p=bootmanager.git diff --git a/source/steps/ChainBootNode.py b/source/steps/ChainBootNode.py index baba483..98c4969 100644 --- a/source/steps/ChainBootNode.py +++ b/source/steps/ChainBootNode.py @@ -78,7 +78,7 @@ def Run(vars, log): # simply creating an instance of this class and listing the system # block devices will make them show up so vgscan can find the planetlab # volume group - systeminfo.get_block_device_list(vars, log) + systeminfo.get_block_devices_dict(vars, log) utils.sysexec("vgscan", log) utils.sysexec("vgchange -ay planetlab", log) @@ -94,7 +94,8 @@ def Run(vars, log): ROOT_MOUNTED = 1 vars['ROOT_MOUNTED'] = 1 - + + utils.display_disks_status(PARTITIONS, "In ChainBootNode", log) # write out the session value /etc/planetlab/session try: @@ -167,29 +168,39 @@ def Run(vars, log): major_version = int(kversion[0]) # Check if the string looks like a kernel version except: # Try a different method for non-rpm-based distributions - kversion = os.popen("ls -lrt {}/lib/modules | tail -1 | awk '{print $9;}'"\ + kversion = os.popen("ls -lrt {}/lib/modules | tail -1 | awk '{{print $9;}}'"\ .format(SYSIMG_PATH)).read().rstrip() - utils.sysexec("cp {}/boot/vmlinuz-{} /tmp/kernel".format(SYSIMG_PATH, kversion), log) - candidates = [] + # kernel and initrd come in various locations depending on the distro + + kernel_candidates = [] + kernel_candidates.append("/boot/vmlinuz-{}*".format(kversion)) + # on f23 starting dec. 2015 - what a twisted naming scheme + kernel_candidates.append("/boot/*/{}*/linux".format(kversion)) + + initrd_candidates = [] # f16/18: expect initramfs image here - candidates.append ("/boot/initramfs-{}.img".format(kversion)) + initrd_candidates.append ("/boot/initramfs-{}.img".format(kversion)) # f20: uses a uid of some kind, e.g. /boot/543f88c129de443baaa65800cf3927ce//initrd - candidates.append ("/boot/*/{}/initrd".format(kversion)) + initrd_candidates.append ("/boot/*/{}/initrd".format(kversion)) # Ubuntu: - candidates.append ("/boot/initrd.img-{}".format(kversion)) - def find_file_in_sysimg (candidates): + initrd_candidates.append ("/boot/initrd.img-{}".format(kversion)) + + 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] - initrd = find_file_in_sysimg(candidates) - if initrd: - utils.sysexec("cp {} /tmp/initrd".format(initrd), log) - else: - raise Exception("Unable to locate initrd - 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)) + + install_from_sysimg_to_tmp(kernel_candidates, 'kernel') + install_from_sysimg_to_tmp(initrd_candidates, 'initrd') BootAPI.save(vars) @@ -296,7 +307,7 @@ def Run(vars, log): log.write("Couldn't read /proc/modules, continuing.\n") - kargs = "root={} ramdisk_size=8192".format(PARTITIONS["mapper-root"]) + kargs = "root={} ramdisk_size=8192".format(PARTITIONS["root"]) if NODE_MODEL_OPTIONS & ModelOptions.SMP: kargs = kargs + " " + "acpi=off" try: @@ -312,7 +323,7 @@ def Run(vars, log): pass utils.sysexec_noerr('hwclock --systohc --utc ', log) - utils.breakpoint ("Before kexec"); +# utils.breakpoint("Before kexec"); try: utils.sysexec('kexec --force --initrd=/tmp/initrd --append="{}" /tmp/kernel'.format(kargs), log) except BootManagerException as e: