From 7983748b45e18eaae2c0626bca97bfcc9cd59bcd Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Apr 2014 14:59:23 -0400 Subject: [PATCH 1/4] Fix UpdateExpress under genesis Newer versions would experience a hard failure if the embedded CIM implementation cannot start. strace revealed that said process was failing because /var/tmp did not exist --- xCAT-genesis-builder/xcat-cmdline.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index c0ce5b519..0b60f30d9 100644 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -5,6 +5,7 @@ clear echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bashrc echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile mkdir -p /etc/ssh +mkdir -p /var/tmp/ mkdir -p /var/empty/sshd echo root:x:0:0::/:/bin/bash >> /etc/passwd echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd From 2426c38282bcc7ae3d00171d5ab30078be195654 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 30 Apr 2014 02:27:50 -0700 Subject: [PATCH 2/4] fix bug 4109 mkvm failed with non-int parameters --- perl-xCAT/xCAT/FSPvm.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 9145ae678..d76415c75 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -849,17 +849,17 @@ sub do_op_extra_cmds { if ($2 == "G" or $2 == '') { $min = $min * 1024; } - $min = $min/$memsize; + $min = int($min/$memsize); my $cur = $3; if ($4 == "G" or $4 == '') { $cur = $cur * 1024; } - $cur = $cur/$memsize; + $cur = int($cur/$memsize); my $max = $5; if ($6 == "G" or $6 == '') { $max = $max * 1024; } - $max = $max/$memsize; + $max = int($max/$memsize); $request->{opt}->{$op} ="$min/$cur/$max"; $param = $request->{opt}->{$op}; } else { @@ -895,7 +895,7 @@ sub do_op_extra_cmds { my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array); # need to add update db here $lpar_hash{$name} = $rethash; - $lpar_hash{$name}->{parent} = @$d[4]; + $lpar_hash{$name}->{parent} = @$d[3]; } } if (%lpar_hash) { @@ -2280,9 +2280,9 @@ sub mkspeclpar { return([[$name, "Parameter for 'vmmemory' is invalid", 1]]); } my $memsize = $memhash->{mem_region_size}; - $mmin = ($mmin + $memsize - 1) / $memsize; - $mcur = ($mcur + $memsize - 1) / $memsize; - $mmax = ($mmax + $memsize - 1) / $memsize; + $mmin = int(($mmin + $memsize - 1) / $memsize); + $mcur = int(($mcur + $memsize - 1) / $memsize); + $mmax = int(($mmax + $memsize - 1) / $memsize); $tmp_ent->{memory} = "$mmin/$mcur/$mmax"; $tmp_ent->{mem_region_size} = $memsize; } else { @@ -2376,7 +2376,7 @@ sub mkspeclpar { #need to add update db here my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]); $lpar_hash{$name} = $rethash; - $lpar_hash{$name}->{parent} = @$d[4]; + $lpar_hash{$name}->{parent} = @$d[3]; $name = undef; $d = undef; From 7f4e4a5283dd87d786e4d659b4356225c5fb7e80 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 30 Apr 2014 08:45:28 -0400 Subject: [PATCH 3/4] add gettimezone common routine --- perl-xCAT/xCAT/Utils.pm | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index e7c2cc6bc..ad55f70a2 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3487,4 +3487,60 @@ sub fullpathbin return $fullpath; } +#-------------------------------------------------------------------------------- + +=head3 gettimezone + returns the name of the timezone defined on the Linux distro. + This routine was written to replace the use of /etc/sysconfig/clock which in no + longer supported on future Linux releases such as RHEL7. It is suppose to be a routine + that can find the timezone on any Linux OS or AIX. + Arguments: + none + Returns: + Name of timezone, for example US/Eastern + Globals: + none + Error: + None + Example: + my $timezone = xCAT::Utils->gettimezone(); + Comments: + none +=cut + +#-------------------------------------------------------------------------------- +sub gettimezone +{ + my ($class) = @_; + + my $tz; + if (xCAT::Utils->isAIX()) { + $tz= $ENV{'TZ'}; + } else { # all linux + my $localtime = "/etc/localtime"; + my $zoneinfo = "/usr/share/zoneinfo"; + my $cmd = "find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV"; + my $zone_result = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + $tz="Could not determine timezone checksum"; + return $tz; + } + my @zones = split /\n/, $zone_result; + + $zones[0] =~ s/$zoneinfo\///; + if (!$zones[0]) { # if we still did not get one, then default + $tz = `cat /etc/timezone`; + chomp $tz; + } else { + $tz=$zones[0]; + } + + + } + return $tz; + + +} + 1; From e0d5594d67ddfa084a48a9a9433ed42bc5fd1df5 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 30 Apr 2014 07:21:58 -0700 Subject: [PATCH 4/4] #3987 partitionfile=s: issues when using variables --- xCAT-server/lib/perl/xCAT/Template.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 592941823..7e03dff72 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -281,7 +281,9 @@ sub subvars { my $tempstr = "%include /tmp/partitionfile\n"; $inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/; #modify the content in the file, and write into %pre part - $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n"; + #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n"; + $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n"; + $partcontent .= "chmod 755 /tmp/partscript\n"; $partcontent .= "/tmp/partscript\n"; #replace the #XCA_PARTITION_SCRIPT# @@ -291,7 +293,8 @@ sub subvars { elsif ($inc =~ //){ my $tempstr = "XCATPARTITIONTEMP"; $inc =~ s/[\s\S]*/$tempstr/; - $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n"; + #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n"; + $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n"; $partcontent .= "chmod 755 /tmp/partscript\n"; $partcontent .= "/tmp/partscript\n"; $inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;