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

This commit is contained in:
root 2014-11-18 19:18:14 -08:00
commit a139146cba
6 changed files with 123 additions and 28 deletions

View File

@ -206,8 +206,9 @@ sub chvm_parse_args {
# Process command-line arguments
#############################################
if ( !defined( $args )) {
$request->{method} = $cmd;
return( \%opt );
#$request->{method} = $cmd;
#return( \%opt );
return ( usage() );
}
#############################################
# Checks case in GetOptions, allows opts
@ -863,6 +864,10 @@ sub do_op_extra_cmds {
my @td = @$d;
@td[0] = 0;
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem"]);
unless (scalar keys(%$memhash)) {
push @values, [$mtms, "Can not get hypervisor information", 1];
next;
}
if (!exists($memhash->{run})) {
if ($param =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
my $memsize = $memhash->{mem_region_size};
@ -921,10 +926,16 @@ sub do_op_extra_cmds {
push @values, [$name, "Success", '0'];
}
}
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[3];
if (@query_array) {
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
unless (scalar keys(%$memhash)) {
push @values, [$mtms, "Can not get hypervisor information", 1];
next;
}
# need to add update db here
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
}
}
}
if (%lpar_hash) {
@ -1971,12 +1982,24 @@ sub query_cec_info {
}
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
#push @result, [$name, $rethash, 0];
push @result, @$rethash;
#push @result, @$rethash;
if (scalar (@$rethash)) {
push @result, @$rethash;
} else {
push @result, [$name, "No information got", -1];
last;
}
$lpar_hash{$name} = \%tmp_hash;
$lpar_hash{$name}->{parent} = @$d[3];
}
if (@td[0] == 0) {
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
if (scalar (@$rethash)) {
push @result, @$rethash;
} else {
push @result, [@td[3], "No information got", -1];
last;
}
#push @result, [@td[3], $rethash, 0];
push @result, @$rethash;
}
@ -2252,7 +2275,7 @@ sub mkspeclpar {
return([["Error","Cannot open vm table", 1]]);
}
while (my ($mtms, $h) = each (%$hash)) {
my $memhash;
my $memhash = undef;
my @nodes = keys(%$h);
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings', 'storage', 'nics']);
while (my ($name, $d) = each (%$h)) {
@ -2261,12 +2284,17 @@ sub mkspeclpar {
last;
}
#if (!exists($memhash->{run}))
{
#{
my @td = @$d;
@td[0] = 0;
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac","part_get_all_io_bus_info"]);
unless (scalar keys(%$memhash)) {
push @result, [$mtms, "Can not get hypervisor information", 1];
last;
}
#$memhash->{run} = 1;
}
#}
my $tmp_ent = $ent->{$name}->[0];
if (exists($opt->{vmcpus})) {
$tmp_ent->{cpus} = $opt->{vmcpus};
@ -2427,6 +2455,10 @@ sub mkspeclpar {
push @result, @$values;
#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"]);
unless (scalar keys(%$rethash)) {
push @result, [$mtms, "Can not get hypervisor information", 1];
next;
}
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[3];
@ -2456,8 +2488,9 @@ sub mkfulllpar {
my @td = @$d;
@td[0] = 0;
$rethash = query_cec_info_actions($request, $name, \@td, 1);
if (ref($rethash) ne 'HASH') {
return ([[$mtms, "Cann't get hypervisor info hash", 1]]);
unless (scalar keys(%$rethash)) {
push @result, [$mtms, "Can not get hypervisor information", 1];
next;
}
$rethash->{run} = 1;
#print Dumper($rethash);

View File

@ -336,14 +336,14 @@ if (($INIT) && ($xcatrunningpgsql == 0))
#
# Init Pg database and setup pg_hba.conf and postgresql.conf
#
&initpgdb;
&initpgdb;
#
# Start Postgresql server
#
if ($pgsqlrunning == 0) # if not already running
{
&pgstart;
&pgstart(0);
}
#
@ -705,6 +705,7 @@ sub runpgcmd_chkoutput
sub initpgdb
{
my $cmd;
my $dbrestart = 0;
# init the database, must su to postgres
@ -759,6 +760,7 @@ sub initpgdb
xCAT::MsgUtils->message("E", " $cmd failed.");
exit(1);
}
$dbrestart = 1;
}
# setup the postgresql.conf file
@ -800,6 +802,7 @@ sub initpgdb
$cmd = qq~echo log_min_messages = notice >> $pgconf~;
`$cmd`;
}
$dbrestart = 1;
}
# make sure everything in /var/lib/pgsql/data is owned by postgres
if ($::installdatadir) { # for protection
@ -819,6 +822,11 @@ sub initpgdb
}
}
if ($dbrestart){
&pgstart(1);
}
}
#-----------------------------------------------------------------------------
@ -826,14 +834,18 @@ sub initpgdb
=head3 pgstart
Start the Postgresql server
Start or restart the Postgresql server
startflg = 0 start postgresql
startflg = 1 restart postgresql
=cut
#-----------------------------------------------------------------------------
sub pgstart
{
my $startflg = shift;
my $cmd;
my $ret=0;
xCAT::MsgUtils->message("I", "Starting the PosgreSQL Server");
@ -853,9 +865,11 @@ sub pgstart
#$cmd = "service postgresql start";
$cmd = "postgresql";
}
#system($cmd)
#if ($? > 0) {
$ret=xCAT::Utils->startservice($cmd);
if ($startflg == 0) {
$ret=xCAT::Utils->startservice($cmd);
} else {
$ret=xCAT::Utils->restartservice($cmd);
}
if ($ret != 0) {
xCAT::MsgUtils->message("E", " failed to start $cmd.");
exit(1);

View File

@ -189,7 +189,7 @@ sub copycd
if ($sitetab)
{
(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
print Dumper($ref);
#print Dumper($ref);
if ($ref and $ref->{value})
{
$installroot = $ref->{value};

View File

@ -408,12 +408,16 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL)
# TERM is needed for KVM consoles(actually screen command needs TERM)
# import the TERM into systemd
if ( -d "/usr/lib/systemd/system" ) {
my $cmd = "systemctl import-environment TERM";
my $term=$ENV{'TERM'};
if (!$term) {
$term = "vt100";
}
my $cmd = "systemctl set-environment TERM=$term";
xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0) {
xCAT::MsgUtils->message('E', "Could not import TERM into systemd.");
xCAT::MsgUtils->message('E', "Could not set TERM into systemd.");
} else {
verbose("Imported TERM=$ENV{'TERM'} into systemd.");
verbose("Imported TERM=$term into systemd.");
}
}

View File

@ -0,0 +1,44 @@
#!/bin/sh
#-- Do not remove following line if you want to make use of CVS version tracking
#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $
#-- jurij.sikorsky@t-systems.cz
#--
#-- this script is run after all packages from $profile.pkglist are installed
#--
#-- it gets these arguments:
#--
#-- $1 = install root (chroot directory for profile)
#-- $2 = OS version
#-- $3 = architecture
#-- $4 = profile name
#-- $5 = work dir (where genimage is located)
#--
#--
installroot=$1
osver=$2
arch=$3
profile=$4
workdir=$5
#-- Example how /etc/fstab can be automatically generated during image generation:
#cat <<END >$installroot/etc/fstab
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /tmp tmpfs defaults 0 2
tmpfs /var/tmp tmpfs defaults 0 2
compute_ppc64el / tmpfs rw 0 1
#END
#-- Uncomment the line contains "cons" in /etc/inittab
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
#cat /dev/null > $installroot/etc/IMGVERSION
#for ext in pkglist exlist postinstall repolist; do
# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION
#done

View File

@ -778,9 +778,9 @@ EOF`
elif [ $hasapt -eq 1 ]; then
apt_get_update_if_repos_changed $REPOFILE
if [ $VERBOSE ]; then
echo "$envlist apt-get -y upgrade"
echo "$envlist DEBIAN_FRONTEND=noninteractive apt-get -y upgrade"
fi
result=`eval $envlist apt-get -y upgrade 2>&1`
result=`eval $envlist DEBIAN_FRONTEND=noninteractive apt-get -y upgrade 2>&1`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
@ -826,9 +826,9 @@ EOF`
elif [ $hasapt -eq 1 ]; then
apt_get_update_if_repos_changed $REPOFILE
if [ $VERBOSE ]; then
echo "apt-get -y remove $repo_pkgs_preremove"
echo "DEBIAN_FRONTEND=noninteractive apt-get -y remove $repo_pkgs_preremove"
fi
result=`apt-get -y remove $repo_pkgs_preremove 2>&1`
result=`DEBIAN_FRONTEND=noninteractive apt-get -y remove $repo_pkgs_preremove 2>&1`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R
@ -893,9 +893,9 @@ EOF`
elif [ $hasapt -eq 1 ]; then
apt_get_update_if_repos_changed $REPOFILE
if [ $VERBOSE ]; then
echo "$envlist apt-get -q -y --force-yes install $repo_pkgs"
echo "$envlist DEBIAN_FRONTEND=noninteractive apt-get -q -y --force-yes install $repo_pkgs"
fi
result=`eval $envlist apt-get -q -y --force-yes install $repo_pkgs 2>&1`
result=`eval $envlist DEBIAN_FRONTEND=noninteractive apt-get -q -y --force-yes install $repo_pkgs 2>&1`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R