- if not valid:
- log.write( "Node does not appear to be installed correctly:\n" )
- log.write( "missing file /boot/ initrd-boot or kernel-boot\n" )
+ # check if the model specified kernel is installed
+ option = ''
+ if NODE_MODEL_OPTIONS & ModelOptions.SMP:
+ option = 'smp'
+ try:
+ os.stat("%s/boot/kernel-boot%s" % (SYSIMG_PATH,option))
+ except OSError, e:
+ # smp kernel is not there; remove option from modeloptions
+ # such that the rest of the code base thinks we are just
+ # using the base kernel.
+ NODE_MODEL_OPTIONS = NODE_MODEL_OPTIONS & ~ModelOptions.SMP
+ vars["NODE_MODEL_OPTIONS"] = NODE_MODEL_OPTIONS
+ log.write( "WARNING: Couldn't locate smp kernel.\n")
+
+ # write out the node id to /etc/planetlab/node_id. if this fails, return
+ # 0, indicating the node isn't a valid install.
+ try:
+ node_id_file_path= "%s/%s/node_id" % (SYSIMG_PATH,PLCONF_DIR)
+ node_id_file= file( node_id_file_path, "w" )
+ node_id_file.write( str(NODE_ID) )
+ node_id_file.close()
+ node_id_file= None
+ log.write( "Updated /etc/planetlab/node_id\n" )
+ except IOError, e:
+ log.write( "Unable to write out /etc/planetlab/node_id\n" )