From 8cb889fae488b51ee9a31533394c7494c1e6cc40 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 9 May 2008 15:31:09 +0000 Subject: [PATCH] -In a aufs stateless configuration, make the underlying branches available to the post-switchroot environment -Prevent cpio or squashfs images from being transferred to booting stateless nodes until completed, this causes booting stateless nodes to wait for new image git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1337 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/packimage.pm | 18 ++++++++++++------ xCAT-server-2.0/share/xcat/netboot/rh/genimage | 8 ++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/packimage.pm b/xCAT-server-2.0/lib/xcat/plugins/packimage.pm index 1cf2fb59f..8288dc018 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/packimage.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/packimage.pm @@ -109,24 +109,30 @@ sub process_request { $callback->({data=>["\nNOTE: Contents of $installroot/netboot/$osver/$arch/$profile/rootimg\nMUST be available on all service and management nodes and NFS exported."]}); } my $temppath; + my $oldumask; + if (! -d "$installroot/netboot/$osver/$arch/$profile/rootimg") { + $callback->({error=>["$installroot/netboot/$osver/$arch/$profile/rootimg does not exist, run genimage -o $osver -p $profile on a server with matching architecture"]}); + return; + } if ($method =~ /cpio/) { $excludestr =~ s!-a \z!|cpio -H newc -o | gzip -c - > ../rootimg.gz!; + unlink("$installroot/netboot/$osver/$arch/$profile/rootimg.gz"); + $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { $temppath = mkdtemp("/tmp/packimage.$$.XXXXXXXX"); $excludestr =~ s!-a \z!|cpio -dump $temppath!; + unlink("$installroot/netboot/$osver/$arch/$profile/rootimg.sfs"); } elsif ($method =~ /nfs/) { $excludestr = "touch ../rootimg.nfs"; } else { $callback->({error=>["Invalid method '$method' requested"],errorcode=>[1]}); } - - if (! -d "$installroot/netboot/$osver/$arch/$profile/rootimg") { - $callback->({error=>["$installroot/netboot/$osver/$arch/$profile/rootimg does not exist, run genimage -o $osver -p $profile on a server with matching architecture"]}); - return; - } chdir("$installroot/netboot/$osver/$arch/$profile/rootimg"); system($excludestr); - if ($method =~ /squashfs/) { + if ($method =~ /cpio/) { + chmod 0644,"$installroot/netboot/$osver/$arch/$profile/rootimg.gz"; + umask $oldmask; + } elsif ($method =~ /squashfs/) { my $flags; if ($arch =~ /x86/) { $flags="-le"; diff --git a/xCAT-server-2.0/share/xcat/netboot/rh/genimage b/xCAT-server-2.0/share/xcat/netboot/rh/genimage index 1898ebe83..dfb139994 100755 --- a/xCAT-server-2.0/share/xcat/netboot/rh/genimage +++ b/xCAT-server-2.0/share/xcat/netboot/rh/genimage @@ -234,6 +234,10 @@ if [ "\$NFS" = "1" ]; then done mount -t tmpfs rw /rw mount -t aufs -o dirs=/rw:/ro mergedroot /sysroot + mkdir -p /sysroot/ro + mkdir -p /sysroot/rw + mount --move /ro /sysroot/ro + mount --move /rw /sysroot/rw cp /etc/resolv.conf /sysroot/etc/ elif [ -r /rootimg.sfs ]; then echo Setting up squashfs with ram overlay. @@ -243,6 +247,10 @@ elif [ -r /rootimg.sfs ]; then mount -t squashfs /rootimg.sfs /ro mount -t tmpfs rw /rw mount -t aufs -o dirs=/rw:/ro mergedroot /sysroot + mkdir -p /sysroot/ro + mkdir -p /sysroot/rw + mount --move /ro /sysroot/ro + mount --move /rw /sysroot/rw EOMS print $inifile "elif [ -r /rootimg.gz ]; then\n"; print $inifile "echo Setting up RAM-root tmpfs.\n";