On 01/28/2014 12:16 AM, Christopher Samuel wrote:
> Hi folks,
> 
> One thing that we notice with stateless nodes and software kits is
> that it can take quite a while to compress with bzip2.
> 
> However, for RHEL EPEL there are two parallel bzip2 implementations
> (pbzip2 and lbzip2) and a parallel gzip implementation (pigz).
> 
> It might be nice to offer sites a way to tell xCAT to use those rather
> than the standard single threaded one to speed up these tasks.
> 
> What do people think?
> 
> All the best!
> Chris

Hi Chris,

Yes, I quite agree. Please see the attached (rough) patch that we use on
our production install. It could easily be adapted to other implementations.

Best regards,
Dan Weeks

-- 
Daniel M. Weeks
Systems Programmer
Center for Computational Innovations
Rensselaer Polytechnic Institute
Troy, NY 12180
518-276-4458
--- xcat/lib/perl/xCAT_plugin/packimage.pm	2013-06-03 10:39:07.409390705 -0400
+++ xcat/lib/perl/xCAT_plugin/packimage.pm	2013-06-03 12:02:12.693820359 -0400
@@ -354,12 +354,22 @@
        $callback->({error=>["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"]});
        return;
     }
-    $callback->({data=>["$verb contents of $rootimg_dir"]});
+
+    my $gzip_bin = `which pigz 2>/dev/null`;
+    if ($? != 0) {
+        $gzip_bin = "gzip";
+    } else {
+        $gzip_bin = "pigz";
+    }
+
+    $method_explain = ($method =~ /cpio/ ? "$method+$gzip_bin" : "$method");
+
+    $callback->({data=>["$verb contents of $rootimg_dir using $method_explain"]});
     unlink("$destdir/rootimg.gz");
     unlink("$destdir/rootimg.sfs");
     if ($method =~ /cpio/) {
         if ( ! $exlistloc ) {
-            $excludestr = "find . -xdev |cpio -H newc -o | gzip -c - > ../rootimg.gz";
+            $excludestr = "find . -xdev |cpio -H newc -o | $gzip_bin -c > ../rootimg.gz";
         }else {
             chdir("$rootimg_dir");
             system("$excludestr >> $xcat_packimg_tmpfile"); 
@@ -367,7 +377,7 @@
             	system("$includestr >> $xcat_packimg_tmpfile"); 
             }
             #$excludestr =~ s!-a \z!|cpio -H newc -o | gzip -c - > ../rootimg.gz!;
-            $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | gzip -c - > ../rootimg.gz";
+            $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $gzip_bin -c > ../rootimg.gz";
         }
         $oldmask = umask 0077;
     } elsif ($method =~ /squashfs/) {
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
xCAT-user mailing list
xCAT-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xcat-user

Reply via email to