X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FValidateNodeInstall.py;h=0d1d16561473a6e5a334e1feda721e6167f92b04;hb=30cbd3c60178e01643ec5100a068ed82c8f38013;hp=30cb0afb8077d3361975f8a112caa31131794d04;hpb=ae73c450bffe036dccf37e8d96a4b655c3cd900e;p=bootmanager.git diff --git a/source/steps/ValidateNodeInstall.py b/source/steps/ValidateNodeInstall.py index 30cb0af..0d1d165 100644 --- a/source/steps/ValidateNodeInstall.py +++ b/source/steps/ValidateNodeInstall.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 -u +#!/usr/bin/python # Copyright (c) 2003 Intel Corporation # All rights reserved. @@ -11,7 +11,6 @@ import os from Exceptions import * import utils import systeminfo -import compatibility import ModelOptions @@ -24,7 +23,6 @@ def Run( vars, log ): Expect the following variables to be set: SYSIMG_PATH the path where the system image will be mounted (always starts with TEMP_PATH) - BOOT_CD_VERSION A tuple of the current bootcd version ROOT_MOUNTED the node root file system is mounted NODE_ID The db node_id for this machine PLCONF_DIR The directory to store the configuration file in @@ -37,10 +35,6 @@ def Run( vars, log ): # make sure we have the variables we need try: - BOOT_CD_VERSION= vars["BOOT_CD_VERSION"] - if BOOT_CD_VERSION == "": - raise ValueError, "BOOT_CD_VERSION" - SYSIMG_PATH= vars["SYSIMG_PATH"] if SYSIMG_PATH == "": raise ValueError, "SYSIMG_PATH" @@ -66,16 +60,13 @@ def Run( vars, log ): ROOT_MOUNTED= 0 - if 'ROOT_MOUNTED' in vars.keys(): + if vars.has_key('ROOT_MOUNTED'): ROOT_MOUNTED= vars['ROOT_MOUNTED'] # mount the root system image if we haven't already. # capture BootManagerExceptions during the vgscan/change and mount # calls, so we can return 0 instead if ROOT_MOUNTED == 0: - # old cds need extra utilities to run lvm - if BOOT_CD_VERSION[0] == 2: - compatibility.setup_lvm_2x_cd( 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 @@ -93,12 +84,29 @@ def Run( vars, log ): utils.makedirs( SYSIMG_PATH ) try: - utils.sysexec("mount %s %s" % (PARTITIONS["root"],SYSIMG_PATH),log) - utils.sysexec("mount %s %s/vservers" % \ + # first run fsck to prevent fs corruption from hanging mount... + log.write( "fsck root file system\n" ) + utils.sysexec("e2fsck -v -p %s" % (PARTITIONS["root"]),log) + + log.write( "fsck vserver file system\n" ) + utils.sysexec("e2fsck -v -p %s" % (PARTITIONS["vservers"]),log) + except BootManagerException, e: + log.write( "BootManagerException during fsck of /root and /vservers : %s\n" % + str(e) ) + + try: + # then attempt to mount them + 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" ) + utils.sysexec("mount -t ext3 %s %s/vservers" % \ (PARTITIONS["vservers"], SYSIMG_PATH), log) + + log.write( "mounting /proc\n" ) utils.sysexec( "mount -t proc none %s/proc" % SYSIMG_PATH, log ) except BootManagerException, e: - log.write( "BootManagerException during vgscan/vgchange: %s\n" % + log.write( "BootManagerException during mount of /root, /vservers and /proc: %s\n" % str(e) ) return 0 @@ -106,12 +114,14 @@ def Run( vars, log ): vars['ROOT_MOUNTED']= 1 - # check if the base kernel is installed + # check if the base kernel is installed + # 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) os.stat("%s/boot/initrd-boot" % SYSIMG_PATH) except OSError, e: - log.write( "FATAL: Couldn't locate base kernel.\n") + log.write( "Couldn't locate base kernel (you might be using the stock kernel).\n") return 0 # check if the model specified kernel is installed @@ -142,6 +152,6 @@ def Run( vars, log ): log.write( "Unable to write out /etc/planetlab/node_id\n" ) return 0 - log.write( "Everything appears to be ok\n" ) + log.write( "Node installation appears to be ok\n" ) return 1