3 # Copyright (c) 2003 Intel Corporation
6 # Copyright (c) 2004-2006 The Trustees of Princeton University
8 # expected /proc/partitions format
10 from Exceptions import *
20 Except the following variables from the store:
21 SYSIMG_PATH the path where the system image will be mounted
22 (always starts with TEMP_PATH)
23 NODE_ID The db node_id for this machine
24 PLCONF_DIR The directory to store the configuration file in
26 Sets the following variables:
31 log.write( "\n\nStep: Install: Final node initialization.\n" )
33 # make sure we have the variables we need
35 SYSIMG_PATH= vars["SYSIMG_PATH"]
37 raise ValueError, "SYSIMG_PATH"
39 NODE_ID= vars["NODE_ID"]
41 raise ValueError, "NODE_ID"
43 PLCONF_DIR= vars["PLCONF_DIR"]
45 raise ValueError, "PLCONF_DIR"
48 raise BootManagerException, "Missing variable in vars: %s\n" % var
49 except ValueError, var:
50 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
53 log.write( "Running PlanetLabConf to update any configuration files\n" )
55 # PlanetLabConf requires /etc/planetlab/node_id, which is normally
56 # maintained in ValidateNodeInstal. so, write out the node_id here
57 # so PlanetLabConf can run.
59 node_id_file_path= "%s/%s/node_id" % (SYSIMG_PATH,PLCONF_DIR)
60 node_id_file= file( node_id_file_path, "w" )
61 node_id_file.write( str(NODE_ID) )
65 raise BootManagerException, \
66 "Unable to write out /etc/planetlab/node_id for PlanetLabConf"
68 if not utils.sysexec( "chroot %s PlanetLabConf.py noscripts" %
70 log.write( "PlanetLabConf failed, install incomplete.\n" )
73 services= [ "netfs", "rawdevices", "cpuspeed", "smartd" ]
74 for service in services:
75 if os.path.exists("%s/etc/init.d/%s" % (SYSIMG_PATH,service)):
76 log.write( "Disabling unneeded service: %s\n" % service )
77 utils.sysexec( "chroot %s chkconfig --level 12345 %s off" %
78 (SYSIMG_PATH,service), log )