From 6b9baa15e516cb9842b1e285789be8a0edd87bea Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 29 Mar 2013 11:36:48 +0000 Subject: [PATCH] fix defect 3426 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15723 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 15 +++++++++++++++ xCAT-server/sbin/xcatd | 22 +++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index d70e7da93..2ea3fbdd1 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -130,6 +130,21 @@ else $::osname = 'Linux'; } +# if on rhel6, check to see if perl-IO-Compress-Zlib* is installed +if (($::INITIALINSTALL) || ($::UPDATEINSTALL)) +{ + my $os = xCAT::Utils->osver(); + my $arch = `uname -p`; + if (($os =~ /^rh.*6$/) && ($arch =~ /^x86_64/)) { + if (!(-e "/usr/lib64/perl5/IO/Uncompress/Gunzip.pm")) { + xCAT::MsgUtils->message('I', "perl-IO-Compress-Zlib* is not installed. If you try and use genesis discovery, you will have fatal errors in the xcat daemon.\n Install perl-IO-Compress-Zlib,perl-IO-Compress-Base rpms."); + + } + + } +} + + # # If the XCATPGPW environment variable is specified, # call pgsqlsetup command with -N flag to setup PostgreSQL database. diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index fa2751f17..4d77b730e 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -23,7 +23,6 @@ BEGIN if ($^O =~ /^aix/i) { unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); } - use lib "$::XCATROOT/lib/perl"; use Storable qw(freeze thaw); use xCAT::Utils; @@ -31,7 +30,16 @@ use xCAT::TableUtils; use xCAT::NetworkUtils; use xCAT::MsgUtils; use xCAT::xcatd; -use IO::Uncompress::Gunzip qw/gunzip/; +my $IOCompress =1; +my $os = xCAT::Utils->osver(); +my $arch = `uname -p`; +# These do not have the IO::Uncompress rpm available +if (($^O =~ /^aix/i) || ($os =~ /^sle[sc]10/) || (($os =~ /^rh.*5$/) && ($arch =~ /ppc64/))){ + $IOCompress =0; +} +if ($IOCompress == 1 ) { + eval {require IO::Uncompress::Gunzip;} +} use File::Path; use Time::HiRes qw(sleep); use Thread qw(yield); @@ -565,12 +573,12 @@ sleep 0.05; $data=$packets{$pkey}->[1]; $peerhost=gethostbyaddr($client,AF_INET); $peerhost .="\n"; - if ($data =~ /^\037\213/) { #per rfc 1952, these two bytes are gzip, and they are invalid for + if ($data =~ /^\037\213/) { #per rfc 1952, these two bytes are gzip, and they are invalid for #xcatrequest xml, so go ahead and decompress it - my $bigdata; - gunzip \$data => \$bigdata; - $data = $bigdata - } + my $bigdata; + IO::Uncompress::Gunzip::gunzip(\$data,\$bigdata); + $data = $bigdata + } my $req = eval { XMLin($data, SuppressEmpty=>undef,ForceArray=>1) }; if ($req and $req->{command} and ($req->{command}->[0] eq "findme")) { $req->{'_xcat_clienthost'}=gethostbyaddr($client,AF_INET);