run parted with the --script option to prevent from hanging
[bootmanager.git] / source / steps / CheckForNewDisks.py
index 44489e8..09a001d 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-
+#
 # Copyright (c) 2003 Intel Corporation
 # All rights reserved.
 #
@@ -81,7 +81,7 @@ def Run( vars, log ):
         # this is the lvm partition, if it exists on that device
         lvm_partition= InstallPartitionDisks.get_partition_path_from_device( device, vars, log )
         cmd = "pvdisplay %s | grep -q 'planetlab'" % lvm_partition
-        already_added= utils.sysexec_noerr(cmd, log)
+        already_added = utils.sysexec_noerr(cmd, log, shell=True)
 
         if already_added:
             log.write( "It appears %s is part of the volume group, continuing.\n" %
@@ -91,7 +91,7 @@ def Run( vars, log ):
         # just to be extra paranoid, ignore the device if it already has
         # an lvm partition on it (new disks won't have this, and that is
         # what this code is for, so it should be ok).
-        cmd = "sfdisk -l %s | grep -q 'Linux LVM'" % device 
+        cmd = "parted --script --list %s | grep -q lvm$" % device
         has_lvm= utils.sysexec_noerr(cmd, log)
         if has_lvm:
             log.write( "It appears %s has lvm already setup on it.\n" % device)
@@ -136,7 +136,7 @@ def Run( vars, log ):
         try:
             # backwards compat, though, we should never hit this case post PL 3.2
             os.stat("%s/rcfs/taskclass"%SYSIMG_PATH)
-            utils.sysexec_noerr( "chroot %s umount /rcfs" % SYSIMG_PATH, log )
+            utils.sysexec_chroot_noerr( SYSIMG_PATH, "umount /rcfs", log )
         except OSError, e:
             pass
 
@@ -169,7 +169,7 @@ def Run( vars, log ):
                 res = 1
                 break
 
-            log.write( "making the ext3 filesystem match new logical volume size.\n" )
+            log.write( "making the ext filesystem match new logical volume size.\n" )
 
             vars['ROOT_MOUNTED']= 1
             cmd = "mount %s %s" % (PARTITIONS["root"],SYSIMG_PATH)
@@ -177,7 +177,7 @@ def Run( vars, log ):
             cmd = "mount %s %s/vservers" % \
                 (PARTITIONS["vservers"],SYSIMG_PATH)
             utils.sysexec_noerr( cmd, log )
-            cmd = "ext2online %s/vservers" % SYSIMG_PATH
+            cmd = "resize2fs %s" % PARTITIONS["vservers"]
             resize = utils.sysexec_noerr(cmd,log)
             utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH, log )
             utils.sysexec_noerr( "umount %s" % SYSIMG_PATH, log )