Load stock kernel rather than a custom kernel
[bootmanager.git] / source / steps / ValidateNodeInstall.py
index 85dcf5e..5f63598 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-
+#
 # Copyright (c) 2003 Intel Corporation
 # All rights reserved.
 #
@@ -83,20 +83,31 @@ def Run( vars, log ):
             
         utils.makedirs( SYSIMG_PATH )
 
-        for filesystem in ("root","vservers"):
+        for filesystem in ["root"]:
             try:
                 # first run fsck to prevent fs corruption from hanging mount...
                 log.write( "fsck %s file system\n" % filesystem )
-                utils.sysexec("e2fsck -v -p %s" % (PARTITIONS[filesystem]),log)
+                utils.sysexec("e2fsck -v -p %s" % (PARTITIONS[filesystem]), log, fsck=True)
             except BootManagerException, e:
                 log.write( "BootManagerException during fsck of %s (%s) filesystem : %s\n" %
                            (filesystem, PARTITIONS[filesystem], str(e)) )
-                return -1
+                try:
+                    log.write( "Trying to recover filesystem errors on %s\n" % filesystem )
+                    utils.sysexec("e2fsck -v -y %s" % (PARTITIONS[filesystem]),log, fsck=True)
+                except BootManagerException, e:
+                    log.write( "BootManagerException during trying to recover filesystem errors on %s (%s) filesystem : %s\n" %
+                           (filesystem, PARTITIONS[filesystem], str(e)) )
+                    return -1
+            else:
+                # disable time/count based filesystems checks
+                utils.sysexec_noerr( "tune2fs -c -1 -i 0 %s" % PARTITIONS[filesystem], log)
+        
+        # TODO: add fschk for btrfs vserver volume!! 
 
         try:
             # then attempt to mount them
             log.write( "mounting root file system\n" )
-            utils.sysexec("mount -t ext2 %s %s" % (PARTITIONS["root"],SYSIMG_PATH),log)
+            utils.sysexec("mount -t ext3 %s %s" % (PARTITIONS["root"],SYSIMG_PATH),log)
         except BootManagerException, e:
             log.write( "BootManagerException during mount of /root: %s\n" % str(e) )
             return -2
@@ -114,7 +125,7 @@ def Run( vars, log ):
             VSERVERS_PATH = "%s/vservers" % SYSIMG_PATH
             utils.makedirs(VSERVERS_PATH)
             log.write( "mounting vserver partition in root file system\n" )
-            utils.sysexec("mount -t ext2 %s %s" % (PARTITIONS["vservers"], VSERVERS_PATH), log)
+            utils.sysexec("mount -t btrfs %s %s" % (PARTITIONS["vservers"], VSERVERS_PATH), log)
         except BootManagerException, e:
             log.write( "BootManagerException during mount of /vservers: %s\n" % str(e) )
             return -2
@@ -126,7 +137,8 @@ def Run( vars, log ):
     # these 2 links are created by our kernel's post-install scriplet
     log.write("Checking for a custom kernel\n")
     try:
-        os.stat("%s/boot/kernel-boot" % SYSIMG_PATH)
+        kversion = os.popen('rpm -r /tmp/mnt/sysimg -qa kernel | tail -1 | cut -c 8-').read().rstrip()
+        os.stat("%s/boot/vmlinuz-%s" % (SYSIMG_PATH,kversion))
     except OSError, e:            
         log.write( "Couldn't locate base kernel (you might be using the stock kernel).\n")
         return -3