support for mkfs.ext2 w/ badblock search
authorMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 18 Jul 2006 00:33:48 +0000 (00:33 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 18 Jul 2006 00:33:48 +0000 (00:33 +0000)
source/ModelOptions.py
source/steps/InstallPartitionDisks.py

index ccd64eb..ee1cab3 100644 (file)
@@ -7,6 +7,7 @@ INTEL   = 0x008
 AMD     = 0x010
 NUMA    = 0x020
 GEODE   = 0x040
+BADHD   = 0x080
 LAST    = 0x100
 
 modeloptions = {'smp':SMP,
@@ -17,6 +18,7 @@ modeloptions = {'smp':SMP,
                 'a32':AMD,
                 'numa':NUMA,
                 'geode':GEODE,
+                'badhd':BADHD,
                 'minhw':MINHW}
 
 def Get(model):
index fcece53..f36e2e9 100644 (file)
@@ -50,7 +50,7 @@ import utils
 import BootServerRequest
 import compatibility
 
-
+import ModelOptions
 
 def Run( vars, log ):
     """
@@ -96,6 +96,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:
@@ -183,11 +185,24 @@ def Run( vars, log ):
     # make swap
     utils.sysexec( "mkswap %s" % PARTITIONS["swap"], log )
 
-    # make root file system
-    utils.sysexec( "mkfs.ext2 -j %s" % PARTITIONS["root"], log )
-
-    # make vservers file system
-    utils.sysexec( "mkfs.ext2 -m 0 -j %s" % PARTITIONS["vservers"], log )
+    # check if badhd option has been set
+    option = ''
+    txt = ''
+    if NODE_MODEL_OPTIONS & ModelOptions.BADHD:
+        option = '-c'
+        txt = " with bad block search enabled, which may take a while"
+    
+    # filesystems partitions names and their corresponding
+    # reserved-blocks-percentages
+    filesystems = {"root":5,"vservers":0}
+
+    # make the file systems
+    for fs in filesystems.keys():
+        # get the reserved blocks percentage
+        rbp = filesystems[fs]
+        devname = PARTITIONS[fs]
+        log.write("formatting %s partition (%s)%s.\n" % (fs,devname,txt))
+        utils.sysexec( "mkfs.ext2 -q %s -m %d -j %s" % (option,rbp,devname), log )
 
     # save the list of block devices in the log
     log.write( "Block devices used (in lvm):\n" )