always pass log to sysexec for consistency between bm.log and tty output
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 18 Jan 2011 13:07:02 +0000 (14:07 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 18 Jan 2011 13:07:02 +0000 (14:07 +0100)
source/steps/ChainBootNode.py
source/steps/InstallBootstrapFS.py
source/steps/InstallInit.py
source/steps/MakeInitrd.py
source/steps/UpdateNodeConfiguration.py
source/steps/ValidateNodeInstall.py

index 43f4688..3b9df6d 100644 (file)
@@ -262,11 +262,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
index 67930e3..a40e2e3 100644 (file)
@@ -179,7 +179,7 @@ def Run( vars, log ):
     utils.makedirs(SYSIMG_PATH + "/etc/pki/rpm-gpg")
     utils.sysexec("gpg --homedir=/root --export --armor" \
                   " --no-default-keyring --keyring %s/usr/boot/pubring.gpg" \
-                  " >%s/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab" % (SYSIMG_PATH, SYSIMG_PATH))
-    utils.sysexec_chroot(SYSIMG_PATH, "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab")
+                  " >%s/etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab" % (SYSIMG_PATH, SYSIMG_PATH), log)
+    utils.sysexec_chroot(SYSIMG_PATH, "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab", log)
 
     return 1
index 2cf247a..32fbafe 100644 (file)
@@ -64,10 +64,10 @@ def Run( vars, log ):
     except OSError, e:
         pass
 
-    utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH )
-    utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH )
-    utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH )
-    utils.sysexec_noerr( "umount %s" % SYSIMG_PATH )
+    utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH , log )
+    utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH , log )
+    utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH , log )
+    utils.sysexec_noerr( "umount %s" % SYSIMG_PATH , log )
     vars['ROOT_MOUNTED']= 0
 
 #    log.write( "Removing any old files, directories\n" )
index 878f28b..a98c8f0 100644 (file)
@@ -15,14 +15,14 @@ import systeminfo
 # for centos5.3
 # 14:42:27(UTC) No module dm-mem-cache found for kernel 2.6.22.19-vs2.3.0.34.33.onelab, aborting.
 # http://kbase.redhat.com/faq/docs/DOC-16528;jsessionid=7E984A99DE8DB094D9FB08181C71717C.ab46478d
-def bypassRaidIfNeeded(sysimg_path):
+def bypassRaidIfNeeded(sysimg_path, log):
     try:
         [ a,b,c,d]=file('%s/etc/redhat-release'%sysimg_path).readlines()[0].strip().split()
         if a !='CentOS': return
         [major,minor]=[int(x) for x in c.split('.')]
         if minor >= 3:
-            utils.sysexec_noerr('echo "DMRAID=no" >> %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path)
-            utils.sysexec_noerr('chmod 755 %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path)
+            utils.sysexec_noerr('echo "DMRAID=no" >> %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path , log )
+            utils.sysexec_noerr('chmod 755 %s/etc/sysconfig/mkinitrd/noraid' % sysimg_path, log )
     except:
         pass
             
@@ -67,10 +67,10 @@ def Run( vars, log ):
         print "%s/boot/%s is already removed" % (SYSIMG_PATH, initrd)
 
     # hack for CentOS 5.3
-    bypassRaidIfNeeded(SYSIMG_PATH)
+    bypassRaidIfNeeded(SYSIMG_PATH , log )
     utils.sysexec_chroot( SYSIMG_PATH, "mkinitrd -v --allow-missing /boot/initrd-%s.img %s" % \
                (kernel_version, kernel_version), log )
 
-    utils.sysexec_noerr("umount %s/sys" % SYSIMG_PATH)
-    utils.sysexec_noerr("umount %s/dev" % SYSIMG_PATH)
+    utils.sysexec_noerr("umount %s/sys" % SYSIMG_PATH , log )
+    utils.sysexec_noerr("umount %s/dev" % SYSIMG_PATH , log)
 
index cbb0033..683bd94 100644 (file)
@@ -185,8 +185,8 @@ def update_vserver_network_files( vserver_dir, vars, log ):
             # 2.6.22/f8 root environment.  files randomly show up with the
             # immutible attribute set.  this clears it before trying to write
             # the files below.
-            utils.sysexec( "chattr -i %s/etc/hosts" % vserver_dir )
-            utils.sysexec( "chattr -i %s/etc/resolv.conf" % vserver_dir )
+            utils.sysexec( "chattr -i %s/etc/hosts" % vserver_dir , log )
+            utils.sysexec( "chattr -i %s/etc/resolv.conf" % vserver_dir , log )
         except:
             pass
 
index 771813c..c987170 100644 (file)
@@ -87,13 +87,13 @@ def Run( vars, log ):
             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, True)
+                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)) )
                 try:
                     log.write( "Trying to recover filesystem errors on %s\n" % filesystem )
-                    utils.sysexec("e2fsck -v -y %s" % (PARTITIONS[filesystem]),log, True)
+                    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)) )