Merge branch '4.3' of ssh://git.planet-lab.org/git/bootmanager into 4.3
authorS.Çağlar Onur <caglar@verivue.com>
Tue, 15 Mar 2011 16:00:40 +0000 (12:00 -0400)
committerS.Çağlar Onur <caglar@verivue.com>
Tue, 15 Mar 2011 16:00:40 +0000 (12:00 -0400)
source/steps/InstallPartitionDisks.py
source/steps/MakeInitrd.py

index 81d100d..e40a233 100644 (file)
@@ -183,20 +183,27 @@ def single_partition_device( device, vars, log ):
     """
 
     # two forms, depending on which version of pyparted we have
+    # v1 does not have a 'version' method
+    # v2 and above does, but to make it worse, 
+    # parted-3.4 on f14 has parted.version broken and raises SystemError
     try:
-        version=parted.version()
+        parted.version()
         return single_partition_device_2_x (device, vars, log)
-    except:
+    except AttributeError:
+        # old parted does not have version at all
         return single_partition_device_1_x (device, vars, log)
-
-        
+    except SystemError:
+        # let's assume this is >=2
+        return single_partition_device_2_x (device, vars, log)
+    except:
+        raise
 
 def single_partition_device_1_x ( device, vars, log):
     
     lvm_flag= parted.partition_flag_get_by_name('lvm')
     
     try:
-        print >>log, "Using pyparted 1.x"
+        log.write("Using pyparted 1.x\n")
         # wipe the old partition table
         utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log )
 
@@ -239,7 +246,7 @@ def single_partition_device_1_x ( device, vars, log):
 
 def single_partition_device_2_x ( device, vars, log):
     try:
-        print >>log, "Using pyparted 2.x"
+        log.write("Using pyparted 2.x\n")
         # wipe the old partition table
         utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log )
         # get the device
index 42ccf87..16c6341 100644 (file)
@@ -6,12 +6,11 @@
 # Copyright (c) 2004-2006 The Trustees of Princeton University
 # All rights reserved.
 
-import os, string
+import os
 
 from Exceptions import *
 import utils
 import systeminfo
-import shutil
 
 def kernelHasMkinitrd():
     #  Older bootcds only support LinuxThreads.  This hack is to get mkinitrd
@@ -63,6 +62,11 @@ def Run( vars, log ):
 
     # mkinitrd needs /dev and /proc to do the right thing.
     # /proc is already mounted, so bind-mount /dev here
+    # xxx tmp - trying to work around the f14 case:
+    # check that /dev/ is mounted with devtmpfs
+    # tmp - sysexec_noerr not returning what one would expect
+    # if utils.sysexec_noerr ("grep devtmpfs /proc/mounts") != 0:
+    utils.sysexec_noerr("mount -t devtmpfs none /dev")
     utils.sysexec("mount -o bind /dev %s/dev" % SYSIMG_PATH)
     utils.sysexec("mount -t sysfs none %s/sys" % SYSIMG_PATH)
 
@@ -75,7 +79,8 @@ def Run( vars, log ):
     # hack for CentOS 5.3
     bypassRaidIfNeeded(SYSIMG_PATH)
     if kernelHasMkinitrd() == True:
-        utils.sysexec_chroot( SYSIMG_PATH, "mkinitrd -v --allow-missing /boot/initrd-%s.img %s" % \
+    # specify ext3 for fedora14 and above as their default fs is ext4
+        utils.sysexec_chroot( SYSIMG_PATH, "mkinitrd -v --with=ext3 --allow-missing /boot/initrd-%s.img %s" % \
                    (kernel_version, kernel_version), log )
     else:
         shutil.copy("./mkinitrd.sh","%s/tmp/mkinitrd.sh" % SYSIMG_PATH)