Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8

This commit is contained in:
Jarrod Johnson 2014-04-30 10:32:12 -04:00
commit 73f2226193
3 changed files with 69 additions and 10 deletions

View File

@ -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;

View File

@ -3459,5 +3459,61 @@ 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;

View File

@ -280,7 +280,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#
@ -290,7 +292,8 @@ sub subvars {
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$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/;