3 from Exceptions import *
5 from systeminfo import systeminfo
11 See if a node installation is valid. More checks should certainly be
12 done in the future, but for now, make sure that the sym links kernel-boot
13 and initrd-boot exist in /boot
15 Expect the following variables to be set:
16 SYSIMG_PATH the path where the system image will be mounted
17 (always starts with TEMP_PATH)
18 BOOT_CD_VERSION A tuple of the current bootcd version
19 ROOT_MOUNTED the node root file system is mounted
21 Set the following variables upon successfully running:
22 ROOT_MOUNTED the node root file system is mounted
25 log.write( "\n\nStep: Validating node installation.\n" )
27 # make sure we have the variables we need
29 BOOT_CD_VERSION= vars["BOOT_CD_VERSION"]
30 if BOOT_CD_VERSION == "":
31 raise ValueError, "BOOT_CD_VERSION"
33 SYSIMG_PATH= vars["SYSIMG_PATH"]
35 raise ValueError, "SYSIMG_PATH"
38 raise BootManagerException, "Missing variable in vars: %s\n" % var
39 except ValueError, var:
40 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
44 if 'ROOT_MOUNTED' in vars.keys():
45 ROOT_MOUNTED= vars['ROOT_MOUNTED']
47 # mount the root system image if we haven't already.
48 # capture BootManagerExceptions during the vgscan/change and mount
49 # calls, so we can return 0 instead
51 # old cds need extra utilities to run lvm
52 if BOOT_CD_VERSION[0] == 2:
53 compatibility.setup_lvm_2x_cd( vars, log )
55 # simply creating an instance of this class and listing the system
56 # block devices will make them show up so vgscan can find the planetlab
58 systeminfo().get_block_device_list()
61 utils.sysexec( "vgscan", log )
62 utils.sysexec( "vgchange -ay planetlab", log )
63 except BootManagerException, e:
64 log.write( "BootManagerException during vgscan/vgchange: %s\n" %
68 utils.makedirs( SYSIMG_PATH )
71 utils.sysexec( "mount /dev/planetlab/root %s" % SYSIMG_PATH, log )
72 utils.sysexec( "mount /dev/planetlab/vservers %s/vservers" %
74 except BootManagerException, e:
75 log.write( "BootManagerException during vgscan/vgchange: %s\n" %
80 vars['ROOT_MOUNTED']= 1
84 if os.access("%s/boot/kernel-boot" % SYSIMG_PATH, os.F_OK | os.R_OK) and \
85 os.access("%s/boot/initrd-boot" % SYSIMG_PATH, os.F_OK | os.R_OK):
89 log.write( "Node does not appear to be installed correctly:\n" )
90 log.write( "missing file /boot/ initrd-boot or kernel-boot\n" )
93 log.write( "Everything appears to be ok\n" )