Support to handle /smp model option properly and boot the SMP rather than UNI kernel.
authorMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 11 Apr 2006 21:04:40 +0000 (21:04 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 11 Apr 2006 21:04:40 +0000 (21:04 +0000)
source/steps/ChainBootNode.py
source/steps/InstallWriteConfig.py
source/steps/ValidateNodeInstall.py

index dc55c83..7d43616 100644 (file)
@@ -11,6 +11,8 @@ from systeminfo import systeminfo
 import BootAPI
 import notify_messages
 
+from GetAndUpdateNodeDetails import SMP_OPT
+
 
 def Run( vars, log ):
     """
@@ -51,6 +53,8 @@ def Run( vars, log ):
         # its ok if this is blank
         NODE_SESSION= vars["NODE_SESSION"]
 
+        NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+
     except KeyError, var:
         raise BootManagerException, "Missing variable in vars: %s\n" % var
     except ValueError, var:
@@ -121,9 +125,14 @@ def Run( vars, log ):
     (network_count,storage_count)= \
              InstallWriteConfig.write_modprobeconf_file( vars, log )
 
+    # get the kernel version
+    option = ''
+    if NODE_MODEL_OPTIONS & SMP_OPT:
+        option = 'smp'
+
     log.write( "Copying kernel and initrd for booting.\n" )
-    utils.sysexec( "cp %s/boot/kernel-boot /tmp/kernel" % SYSIMG_PATH, log )
-    utils.sysexec( "cp %s/boot/initrd-boot /tmp/initrd" % SYSIMG_PATH, log )
+    utils.sysexec( "cp %s/boot/kernel-boot%s /tmp/kernel" % (SYSIMG_PATH,option), log )
+    utils.sysexec( "cp %s/boot/initrd-boot%s /tmp/initrd" % (SYSIMG_PATH,option), log )
 
     log.write( "Unmounting disks.\n" )
     try:
index 9349f54..b6038c9 100644 (file)
@@ -47,6 +47,7 @@ import utils
 from systeminfo import systeminfo
 import BootAPI
 
+from GetAndUpdateNodeDetails import SMP_OPT
 
 def Run( vars, log ):
 
@@ -106,6 +107,8 @@ def Run( vars, log ):
         if BOOT_CD_VERSION == "":
             raise ValueError, "BOOT_CD_VERSION"
 
+        NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+
     except KeyError, var:
         raise BootManagerException, "Missing variable in vars: %s\n" % var
     except ValueError, var:
@@ -227,7 +230,10 @@ def Run( vars, log ):
         rootdev= file( "%s/%s" % (SYSIMG_PATH,PARTITIONS["mapper-root"]), "w" )
         rootdev.close()
 
-    initrd= os.readlink( "%s/boot/initrd-boot" % SYSIMG_PATH )
+    option = ''
+    if NODE_MODEL_OPTIONS & SMP_OPT:
+        option = 'smp'
+    initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) )
     kernel_version= initrd.replace("initrd-", "").replace(".img", "")
     utils.removefile( "%s/boot/%s" % (SYSIMG_PATH, initrd) )
     utils.sysexec( "chroot %s mkinitrd /boot/initrd-%s.img %s" % \
@@ -405,6 +411,8 @@ def write_modprobeconf_file( vars, log, filename = "/etc/modprobe.conf"):
         if SYSIMG_PATH == "":
             raise ValueError, "SYSIMG_PATH"
 
+        NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+
     except KeyError, var:
         raise BootManagerException, "Missing variable in vars: %s\n" % var
     except ValueError, var:
@@ -412,7 +420,10 @@ def write_modprobeconf_file( vars, log, filename = "/etc/modprobe.conf"):
 
     
     # get the kernel version
-    initrd= os.readlink( "%s/boot/initrd-boot" % SYSIMG_PATH )
+    option = ''
+    if NODE_MODEL_OPTIONS & SMP_OPT:
+        option = 'smp'
+    initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) )
     kernel_version= initrd.replace("initrd-", "").replace(".img", "")
 
     sysinfo= systeminfo()
index aea2e17..9d632cc 100644 (file)
@@ -4,6 +4,7 @@ from Exceptions import *
 import utils
 from systeminfo import systeminfo
 import compatibility
+from GetAndUpdateNodeDetails import SMP_OPT
 
 
 def Run( vars, log ):
@@ -44,6 +45,8 @@ def Run( vars, log ):
         if PLCONF_DIR == "":
             raise ValueError, "PLCONF_DIR"
         
+        NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+
     except KeyError, var:
         raise BootManagerException, "Missing variable in vars: %s\n" % var
     except ValueError, var:
@@ -89,15 +92,21 @@ def Run( vars, log ):
         ROOT_MOUNTED= 1
         vars['ROOT_MOUNTED']= 1
         
-    valid= 0
     
-    if os.access("%s/boot/kernel-boot" % SYSIMG_PATH, os.F_OK | os.R_OK) and \
-           os.access("%s/boot/initrd-boot" % SYSIMG_PATH, os.F_OK | os.R_OK):
-        valid= 1
-
+    # get the kernel version
+    option = ''
+    if NODE_MODEL_OPTIONS & SMP_OPT:
+        option = 'smp'
+
+    files = ("kernel-boot%s" % option, "initrd-boot%s" % option)
+    valid= 1
+    for filepath in files:
+        if not os.access("%s/boot/%s"%(SYSIMG_PATH,filepath),os.F_OK|os.R_OK):
+            log.write( "Node not properly installed:\n")
+            log.write( "\tmissing file /boot/%s\n" % filepath )
+            valid= 0
+    
     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" )
         return 0
 
     # write out the node id to /etc/planetlab/node_id. if this fails, return