fixed typo
[bootmanager.git] / source / steps / ChainBootNode.py
index 8ee2a88..848cb3d 100644 (file)
@@ -1,8 +1,5 @@
 #!/usr/bin/python
 #
-# $Id$
-# $URL$
-#
 # Copyright (c) 2003 Intel Corporation
 # All rights reserved.
 #
@@ -16,6 +13,7 @@ import os
 
 import UpdateNodeConfiguration
 import MakeInitrd
+import StopRunlevelAgent
 from Exceptions import *
 import utils
 import systeminfo
@@ -146,6 +144,7 @@ def Run( vars, log ):
     update_vals['ssh_rsa_key']= ssh_host_key
     BootAPI.call_api_function( vars, "BootUpdateNode", (update_vals,) )
 
+
     # get the kernel version
     option = ''
     if NODE_MODEL_OPTIONS & ModelOptions.SMP:
@@ -160,12 +159,17 @@ def Run( vars, log ):
     log.write( "Unmounting disks.\n" )
     utils.sysexec( "umount %s/vservers" % SYSIMG_PATH, log )
     utils.sysexec( "umount %s/proc" % SYSIMG_PATH, log )
+    utils.sysexec_noerr( "umount %s/dev" % SYSIMG_PATH, log )
+    utils.sysexec_noerr( "umount %s/sys" % SYSIMG_PATH, log )
     utils.sysexec( "umount %s" % SYSIMG_PATH, log )
     utils.sysexec( "vgchange -an", log )
 
     ROOT_MOUNTED= 0
     vars['ROOT_MOUNTED']= 0
 
+    # Change runlevel to 'boot' prior to kexec.
+    StopRunlevelAgent.Run( vars, log )
+
     log.write( "Unloading modules and chain booting to new kernel.\n" )
 
     # further use of log after Upload will only output to screen
@@ -265,11 +269,10 @@ def Run( vars, log ):
         # kargs, which is ramdisk_size=8192
         pass 
 
-    utils.sysexec_noerr( 'hwclock --systohc --utc ' )
+    utils.sysexec_noerr( 'hwclock --systohc --utc ', log )
     utils.breakpoint ("Before kexec");
     try:
-        utils.sysexec( 'kexec --force --initrd=/tmp/initrd ' \
-                       '--append="%s" /tmp/kernel' % kargs)
+        utils.sysexec( 'kexec --force --initrd=/tmp/initrd --append="%s" /tmp/kernel' % kargs, log)
     except BootManagerException, e:
         # if kexec fails, we've shut the machine down to a point where nothing
         # can run usefully anymore (network down, all modules unloaded, file