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

This commit is contained in:
Jarrod Johnson 2013-09-06 11:16:13 -04:00
commit 742fc45068
41 changed files with 1688 additions and 357 deletions

@ -88,7 +88,8 @@ fi
# for the git case, query the current branch and set REL (changing master to devel if necessary)
function setbranch {
#git checkout $BRANCH
REL=`git rev-parse --abbrev-ref HEAD`
#REL=`git rev-parse --abbrev-ref HEAD`
REL=`git name-rev --name-only HEAD`
if [ "$REL" = "master" ]; then
REL="devel"
fi
@ -349,8 +350,8 @@ if [ "$OSNAME" != "AIX" ]; then
echo "Signing RPMs..."
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
createrepo $DESTDIR
createrepo $SRCDIR
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
createrepo --checksum sha $SRCDIR
rm -f $SRCDIR/repodata/repomd.xml.asc
rm -f $DESTDIR/repodata/repomd.xml.asc
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml

@ -103,9 +103,9 @@ if [ "$OSNAME" != "AIX" ]; then
echo "Creating repodata directories..."
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
if [ -n "$VERBOSEMODE" ]; then
createrepo $i
createrepo --checksum sha $i # specifying checksum so the repo will work on rhel5
else
createrepo $i >/dev/null
createrepo --checksum sha $i >/dev/null
fi
rm -f $i/repodata/repomd.xml.asc
gpg -a --detach-sign $i/repodata/repomd.xml

@ -4185,7 +4185,7 @@ sub parse_and_run_dsh
#
# setup ssh keys on the nodes or ib switch
#
my $rc = xCAT::TableUtils->setupSSH($options{'nodes'});
my $rc = xCAT::TableUtils->setupSSH($options{'nodes'},$options{'timeout'});
my @results = "return code = $rc";
return (@results);
}

@ -368,11 +368,19 @@ sub fsp_api_action {
} elsif( $parameter !=0 && $action =~ /^(on|reset)$/ ) {
#powerinterval for lpars power on
$cmd = "$fsp_api -a $action -i $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
} elsif ($action =~ /^part_set_lpar_def_state$/) {
$cmd = "$fsp_api -a $action -T $tooltype -s $parameter -t $type:$fsp_ip:$id:$node_name:";
} elsif (exists($request->{opt}->{vios})) {
$cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:$parameter";
} else {
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter";
}
} else {
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
if (exists($request->{opt}->{vios})) {
$cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:";
} else {
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
}
}
}
xCAT::MsgUtils->verbose_message($request, "fsp_api_action cmd:$cmd.");

@ -361,7 +361,7 @@ sub mkvm_parse_args {
# if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s full) )) {
# return( usage() );
# }
if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s ) )) {
if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s full part vios) )) {
return( usage() );
}
####################################
@ -408,13 +408,14 @@ sub mkvm_parse_args {
} else {
return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." ));
}
} else {
} elsif (!exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})){
$opt{m} = 2 ;# non-interleaved, which is the default
}
my @ratio = (1, 2, 3, 4, 5);
my %octant_cfg = ();
if ( exists( $opt{r} ) ) {
my @ratio = (1, 2, 3, 4, 5);
my %octant_cfg = ();
my @elems = split(/\,/,$opt{r});
my $range="";
while (my $elem = shift @elems) {
@ -461,12 +462,12 @@ sub mkvm_parse_args {
}
} # end of "if .. else.."
} # end of while
$opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg);
$opt{octant_cfg}{memory_interleave} = $opt{m};
} #end of if
$opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg);
$opt{octant_cfg}{memory_interleave} = $opt{m};
if ( !exists( $opt{i} ) || !exists( $opt{r} ) ) {
if ( (!exists( $opt{i} ) || !exists( $opt{r} )) && !exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})) {
return(usage());
}
@ -483,6 +484,10 @@ sub mkvm_parse_args {
if ( !$p) {
return(usage("Not found the parent of $node"));
}
if (exists($opt{full}) and defined($other_p) and $other_p eq $p){
return(usage("Only one full partition can be created in one CEC"));
}
if(! defined( $other_p)) {
$other_p = $p;
}
@ -490,9 +495,10 @@ sub mkvm_parse_args {
return(usage("For Power 775, please make sure the noderange are in one CEC "));
}
}
$request->{node} = [$other_p];
$request->{noderange} = $other_p;
if (!exists($opt{full}) && !exists($opt{part}) &&!exists($opt{vios})) {
$request->{node} = [$other_p];
$request->{noderange} = $other_p;
}
####################################
# No operands - add command name
####################################
@ -535,10 +541,14 @@ sub rmvm_parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|verbose service r) )) {
if ( !GetOptions( \%opt, qw(V|verbose service r p|part) )) {
return( usage() );
}
return(usage( "rmvm doesn't support for Power 775." ));
if (!exists($opt{p})) {
return(usage( "rmvm doesn't support for Power 775." ));
}
####################################
# Check for "-" with no option
####################################
@ -592,7 +602,7 @@ sub lsvm_parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|verbose l|long) )) {
if ( !GetOptions( \%opt, qw(V|verbose l|long p|part) )) {
return( usage() );
}
####################################
@ -1423,7 +1433,428 @@ sub xCATdB {
}
return undef;
}
########################
#***** partition related
########################
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and_mem part_get_all_io_bus_info get_huge_page get_cec_bsr);
sub parse_part_get_info {
my $hash = shift;
my $data = shift;
my @array = split /\n/, $data;
foreach my $line (@array) {
chomp($line);
if ($line =~ /Num of lpar slots: (\d+)/i) {
$hash->{num_of_lpars} = $1;
} elsif ($line =~ /HYP Configurable Memory[^\(]*\((\d+)\s*regions\)/i) {
$hash->{hyp_config_mem} = $1;
} elsif ($line =~ /HYP Available Memory[^\(]*\((\d+)\s*regions\)/i) {
$hash->{hyp_avail_mem} = $1;
} elsif ($line =~ /HYP Memory Region Size[^\(]*\((\d+)\s*MB\)/i) {
$hash->{mem_region_size} = $1;
} elsif ($line =~ /HYP Configurable Processors: (\d+),\s*Avail Processors: (\d+)/i) {
$hash->{process_units_config} = $1;
$hash->{process_units_avail} = $2;
} elsif ($line =~ /Authority Lpar id:(\w+)/i) {
$hash->{service_lparid} = $1;
} elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),[^,]*,[^,]*,\w*\(([\w| |-|_]*)\)/) {
$hash->{bus}->{$3}->{cur_lparid} = $1;
$hash->{bus}->{$3}->{bus_slot} = $2;
$hash->{bus}->{$3}->{des} = $4;
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
if (($2 == -1) && ($4 == 255)) {
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
}
#} elsif ($line =~ /lpar 0:: Curr Memory::min: 1,cur: (\d+),max:/i) {
} elsif ($line =~ /Curr Memory Req[^\(]*\((\d+)\s*regions\)/i) {
$hash->{lpar0_used_mem} = $1;
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
$hash->{huge_page_avail} = $1;
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
$hash->{cec_bsr_avail} = $1;
}
}
}
sub query_cec_info_actions {
my $request = shift;
my $name = shift;
my $td = shift;
my $usage = shift;
my $action_array = shift;
my $lparid = @$td[0];
my $data;
my @array = ();
my %hash = ();
if (!defined($action_array) or ref($action_array) ne "ARRAY") {
$action_array = \@partition_query_actions;
}
foreach my $action (@$action_array) {
#$data .= "======> ret info for $action:\n";
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $td, $action);
chomp(@$values[1]);
if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
return ([[@$values]]);
}
if (@$values[1] =~ /^$/) {
next;
}
if ($usage eq 0) {
if ($lparid) {
if ($action eq "lpar_lhea_mac") {
my @output = split /\n/,@$values[1];
foreach my $line (@output) {
if ($line =~ /adapter_id=\w+,lpar_id=$lparid,type=hea/) {
#$data .= "$line\n";
push @array, [$name, $line, 0];
}
}
#$data .= "\n";
next;
}
if ($action eq "part_get_all_io_bus_info") {
my @output = split /\n/, @$values[1];
foreach my $line (@output) {
if ($line =~ /$lparid,/) {
#$data .= "$line\n";
push @array, [$name, $line, 0];
}
}
#$data .= "\n";
next;
}
}
#$data .= "@$values[1]\n\n";
push @array, [$name, @$values[1], @$values[2]];
} else {
&parse_part_get_info(\%hash, @$values[1]);
}
}
if ($usage eq 0) {
#return $data;
return \@array;
} else {
return \%hash;
}
}
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
sub query_cec_info {
my $request = shift;
my $hash = shift;
my $args = $request->{opt};
my @td = ();
my @result = ();
while (my ($mtms,$h) = each(%$hash) ) {
while (my ($name, $d) = each (%$h)) {
@td = @$d;
if (@$d[0] == 0 && @$d[4] ne "lpar") {
last;
}
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
#push @result, [$name, $rethash, 0];
push @result, @$rethash;
}
if (@td[0] == 0) {
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
#push @result, [@td[3], $rethash, 0];
push @result, @$rethash;
}
}
return \@result;
}
########################
#***** partition related
########################
my @partition_config_actions = qw/part_set_lpar_def_state part_set_lpar_pending_proc part_set_lpar_pending_mem part_set_pending_max_vslots part_set_lpar_shared_pool_util_auth part_set_lpar_group_id part_set_lpar_avail_priority part_set_partition_placement part_set_lhea_assign_info part_set_phea_port_info part_set_lhea_port_info part_set_veth_slot_config part_set_vscsi_slot_config part_set_vfchan_slot_config part_clear_vslot_config set_huge_page set_lpar_name/;
sub set_lpar_undefined {
my $request = shift;
my $name = shift;
my $attr = shift;
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_lpar_def_state", 0, 0x0);
if (!@$values[2]) {
return ([$name,"Done",0]);
}
return $values;
}
sub clear_service_authority_lpar {
my $request = shift;
my $name = shift;
my $attr = shift;
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_get_service_authority_lpar_id");
my @array = split /\n/, @$values[1];
my $service_lparid = undef;
foreach my $line (@array) {
if ($line =~ /Authority Lpar id:([-|\d]+)./i) {
$service_lparid = $1;
}
}
if (defined($service_lparid) and $service_lparid == @$attr[0]) {
xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_service_authority_lpar_id");
}
}
sub remove {
my $request = shift;
my $hash = shift;
my @result = ();
while (my ($mtms, $h) = each (%$hash)) {
while (my ($name, $d) = each (%$h)) {
&clear_service_authority_lpar($request, $name, $d);
my $values = &set_lpar_undefined($request, $name, $d);
push @result, $values;
}
}
return \@result;
}
sub deal_with_avail_mem {
my $request = shift;
my $name = shift;
my $d = shift;
my $lparhash = shift;
my ($before,$after,$res);
my @td = @$d;
@td[0] = 0;
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory");
my %tmphash;
&parse_part_get_info(\%tmphash, @$values[1]);
if (exists($tmphash{lpar0_used_mem})) {
$before = $tmphash{lpar0_used_mem};
} else {
return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]);
}
my $tmp_param = "1/1/".$lparhash->{hyp_config_mem};
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $tmp_param);
if (@$values[2]) {
return $values;
}
$values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory");
&parse_part_get_info(\%tmphash, @$values[1]);
if (exists($tmphash{lpar0_used_mem})) {
$after = $tmphash{lpar0_used_mem};
$res = $after - $before;
if ($res < 0) {
return([$name, "Parse reserverd regions failed, before $before, after $after.", 1]);
} elsif ($lparhash->{hyp_avail_mem} - $res < 0) {
return([$name, "Parse reserverd regions failed, no enough memory, availe:$lparhash->{hyp_avail_mem}.", -1]);
}
my $mem = $lparhash->{memory};
$mem =~ /(\d+)\/(\d+)\/(\d+)/;
if ($2 > $lparhash->{hyp_avail_mem} - $res) {
my $new_avail_mem = $lparhash->{hyp_avail_mem} - $res;
$lparhash->{memory} = "$1/$new_avail_mem/$3";
}
return 0;
} else {
return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]);
}
}
sub create_lpar {
my $request = shift;
my $name = shift;
my $d = shift;
my $lparhash = shift;
my $values;
if (exists($request->{opt}->{vios})) {
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x03);
} else {
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x01);
}
if (@$values[2] ne 0) {
return ([[$name, @$values[1], @$values[0]]]);
}
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_name", 0, $name);
if (@$values[2] ne 0) {
$values = &set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[0]]);
}
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth");
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id");
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_avail_priority");
$values = &deal_with_avail_mem($request, $name, $d,$lparhash);
if (ref($values) eq "ARRAY") {
return ([@$values]);
}
#print "======>physlots:$lparhash->{physlots}.\n";
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots});
#$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array));
if (@$values[2] ne 0) {
$values = &set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
if (exists($lparhash->{phy_hea})) {
my $phy_hash = $lparhash->{phy_hea};
foreach my $phy_drc (keys %$phy_hash) {
#print "======> set_lhea_assign_info: drc_index:$phy_drc.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_assign_info", 0, $phy_drc);
my $group_hash = $phy_hash->{$phy_drc};
foreach my $group_id (keys %$group_hash) {
my @lhea_drc = (keys %{$lparhash->{logic_drc_phydrc}->{$group_id}});
foreach my $phy_port_id (keys %{$group_hash->{$group_id}}) {
my $tmp_param = "$phy_drc,$group_id,$phy_port_id";
#print "======> set_phea_port_info: $tmp_param.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_phea_port_info", 0, $tmp_param);
my $tmp_lhea_param = $lhea_drc[$phy_port_id].",$phy_port_id";
#print "======> set_lhea_port_info: $tmp_lhea_param.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_port_info", 0, $tmp_lhea_param);
}
delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[0]});
delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[1]});
}
}
}
#print "======>cpus:$lparhash->{cpus}.\n";
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_proc", 0, $lparhash->{cpus});
if (@$values[2] ne 0) {
$values = &set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
#print "======>memory:$lparhash->{memory}.\n";
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory});
if (@$values[2] ne 0) {
$values = &set_lpar_undefined($request, $name, $d);
return ([$name, @$values[1], @$values[2]]);
}
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes");
#print "======>memory:$lparhash->{huge_page}.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_huge_page", 0, $lparhash->{huge_page});
#print "======>bsr:$lparhash->{bsr_num}.\n";
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_bsr", 0, $lparhash->{bsr_num});
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_partition_placement");
if (exists($request->{opt}->{vios})) {
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x04);
} else {
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x02);
}
if (@$values[2] ne 0) {
return ([$name, @$values[1], @$values[2]]);
}
return ([$name, "Done", 0]);
}
sub mkspeclpar {
my $request = shift;
my $hash = shift;
my $values;
my @result = ();
my $vmtab = xCAT::Table->new( 'vm');
unless($vmtab) {
return([["Error","Cannot open vm table", 1]]);
}
while (my ($mtms, $h) = each (%$hash)) {
my $memhash;
my @nodes = keys(%$h);
my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings']);
while (my ($name, $d) = each (%$h)) {
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"]);
$memhash->{run} = 1;
}
my $tmp_ent = $ent->{$name}->[0];
if (!defined($tmp_ent) ) {
return ([[$name, "Not find params", 1]]);
} elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) {
return ([[$name, "The attribute 'vmcpus', 'vmmemory' and 'vmphyslots' are all needed to be specified.", 1]]);
}
if ($tmp_ent->{memory} =~ /(\d+)(G|M)\/(\d+)(G|M)\/(\d+)(G|M)/i) {
my $memsize = $memhash->{mem_region_size};
my $min = $1;
if ($2 == "G") {
$min = $min * 1024;
}
$min = $min/$memsize;
my $cur = $3;
if ($4 == "G") {
$cur = $cur * 1024;
}
$cur = $cur/$memsize;
my $max = $5;
if ($6 == "G") {
$max = $max * 1024;
}
$max = $max/$memsize;
$tmp_ent->{memory} = "$min/$cur/$max";
}
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
$tmp_ent->{huge_page} = "0/0/0";
$tmp_ent->{bsr_num} = "0";
if (exists($tmp_ent->{othersettings})) {
my $setting = $tmp_ent->{othersettings};
if ($setting =~ /hugepage:(\d+)/) {
my $tmp = $1;
$tmp_ent->{huge_page} = "1/".$tmp."/".$tmp;
}
if ($setting =~ /bsr:(\d+)/) {
$tmp_ent->{bsr_num} = $1;
}
}
$tmp_ent->{phy_hea} = $memhash->{phy_drc_group_port};
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
$values = &create_lpar($request, $name, $d, $tmp_ent);
push @result, $values;
$name = undef;
$d = undef;
}
}
return \@result;
}
sub mkfulllpar {
my $request = shift;
my $hash = shift;
my $values;
my @result = ();
while (my ($mtms, $h) = each (%$hash)) {
my $rethash;
while (my ($name, $d) = each (%$h)) {
if (!exists($rethash->{run})) {
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]]);
}
$rethash->{run} = 1;
#print Dumper($rethash);
}
my %lpar_param = ();
$lpar_param{cpus} = "1/".$rethash->{process_units_avail}."/".$rethash->{process_units_config};
$lpar_param{memory} = "1/".$rethash->{hyp_avail_mem}."/".$rethash->{hyp_config_mem};
$lpar_param{hyp_config_mem} = $rethash->{hyp_config_mem};
$lpar_param{hyp_avail_mem} = $rethash->{hyp_avail_mem};
my @phy_io_array = keys(%{$rethash->{bus}});
$lpar_param{physlots} = join(",", @phy_io_array);
$lpar_param{huge_page} = "1/".$rethash->{huge_page_avail}."/".$rethash->{huge_page_avail};
$lpar_param{bsr_num} = $rethash->{cec_bsr_avail};
$lpar_param{phy_hea} = $rethash->{phy_drc_group_port};
$lpar_param{logic_drc_phydrc} = $rethash->{logic_drc_phydrc};
$values = &create_lpar($request, $name, $d, \%lpar_param);
$rethash->{logic_drc_phydrc} = $lpar_param{logic_drc_phydrc};
push @result, $values;
$name = undef;
$d = undef;
}
}
return \@result;
}
##########################################################################
# Creates logical partitions
@ -1437,6 +1868,10 @@ sub mkvm {
# create a full system partition for each CECs managed by the HMC.
if ( exists($opt->{full})) {
return( mkfulllpar(@_) );
} elsif (exists($opt->{part})){
return (mkspeclpar(@_));
} elsif (exists($opt->{vios})) {
return (mkspeclpar(@_));
}
else {
# if no, it will execute the original function.
@ -1455,15 +1890,29 @@ sub chvm {
##########################################################################
# No rmvm for Power 775
##########################################################################
#sub rmvm {
sub rmvm {
my $request = $_[0];
my $opt = $request->{opt};
if (exists($opt->{p})) {
return( remove(@_) );
} else {
return ([["lpar","rmvm only support Power Partitioning.", 1]]);
}
# return( remove(@_) );
#}
}
##########################################################################
# Lists logical partition profile
##########################################################################
sub lsvm {
return( list(@_) );
my $request = shift;
my $hash = shift;
my $args = $request->{opt};
if (exists($args->{p})) {
return (query_cec_info($request, $hash));
} else {
return( list($request, $hash) );
}
}
1;

@ -41,15 +41,16 @@ package xCAT::RemoteShellExp;
[-t node list] test ssh connection to the node
[-k] Generates the ssh keys needed , for the user on the MN.
[-s node list] copies the ssh keys to the nodes
optional $timeout = timeout value for the expect. Usually from the xdsh -t flag
default timeout is 10 seconds
exit 0 - good
exit 1 - abort
exit 2 - usage error
Examples:
$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd);
$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes);
$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes);
$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd,$nodes,$timeout);
$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes,$timeout);
$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes,$timeout);
=cut
@ -70,7 +71,7 @@ use strict;
#-----------------------------------------------------------------------------
sub remoteshellexp
{
my ($class, $flag, $callback, $remoteshell, $nodes) = @_;
my ($class, $flag, $callback, $remoteshell, $nodes, $timeout) = @_;
my $rc=0;
$::CALLBACK = $callback;
if (!($flag))
@ -90,6 +91,10 @@ sub remoteshellexp
return 2;
}
my $expecttimeout=10; # default
if (defined($timeout)) { # value supplied
$expecttimeout=$timeout;
}
# for -s flag must have nodes and a $to_userid password
my $to_user_password;
@ -180,7 +185,7 @@ sub remoteshellexp
{
# if the file size of the id_rsa key is 0, tell them to remove it
# and run the command again
$rc=xCAT::RemoteShellExp->gensshkeys;
$rc=xCAT::RemoteShellExp->gensshkeys($expecttimeout);
}
# send ssh keys to the nodes/devices, to setup passwordless ssh
if ($flag eq "s")
@ -193,15 +198,15 @@ sub remoteshellexp
return 1;
}
if ($ssh_setup_cmd) { # setup ssh on devices
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes);
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes, $expecttimeout);
} else { #setup ssh on nodes
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes);
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes, $expecttimeout);
}
}
# test ssh setup on the node
if ($flag eq "t")
{
$rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes);
$rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes,$expecttimeout);
}
return $rc;
}
@ -220,9 +225,9 @@ sub remoteshellexp
sub gensshkeys
{
my ($class) = @_;
my ($class, $expecttimeout) = @_;
my $keygen;
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
my $keygen_sent = 0;
my $prompt1 = 'Generating public/private rsa';
my $prompt2 = 'Enter file.*:';
@ -347,9 +352,9 @@ sub gensshkeys
sub testkeys
{
my ($class,$remoteshell,$to_userid,$nodes) = @_;
my ($class,$remoteshell,$to_userid,$nodes, $expecttimeout) = @_;
my $testkeys;
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $timeout = $expecttimeout; # sets Expect default timeout
my $testkeys_sent = 0;
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
my $prompt2 = 'ssword:';
@ -469,9 +474,9 @@ sub testkeys
sub sendnodeskeys
{
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes) = @_;
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes, $expecttimeout) = @_;
my $sendkeys;
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
my $sendkeys_sent = 0;
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
my $prompt2 = 'ssword:';
@ -759,7 +764,7 @@ sub sendnodeskeys
=head3 senddeviceskeys
Setup the ssh keys on the nodes
Setup the ssh keys on the switches
=cut
@ -768,9 +773,9 @@ sub sendnodeskeys
sub senddeviceskeys
{
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes) = @_;
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes, $expecttimeout) = @_;
my $sendkeys;
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately
my $sendkeys_sent = 0;
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
my $prompt2 = 'ssword:';

@ -228,6 +228,7 @@ vm => {
'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)",
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.",
'physlots' => "Specify the physical slots drc index that will assigned to the partition, the delimiter is ',', and the drc index must started with '0x'.",
'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM",
'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access",
'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'",
@ -2234,6 +2235,14 @@ my @nodeattrs = (
tabentry => 'vm.storage',
access_tabentry => 'vm.node=attr:node',
},
{attr_name => 'vmphyslots',
tabentry => 'vm.physlots',
access_tabentry => 'vm.node=attr:node',
},
{attr_name => 'vmothersetting',
tabentry => 'vm.othersettings',
access_tabentry => 'vm.node=attr:node',
},
{attr_name => 'vmstoragemodel',
tabentry => 'vm.storagemodel',
access_tabentry => 'vm.node=attr:node',

@ -257,6 +257,7 @@ sub bldnonrootSSHFiles
Arguments:
Array of nodes
Timeout for expect call (optional)
Returns:
Env Variables: $DSH_FROM_USERID, $DSH_TO_USERID, $DSH_REMOTE_PASSWORD
@ -281,7 +282,7 @@ sub bldnonrootSSHFiles
#--------------------------------------------------------------------------------
sub setupSSH
{
my ($class, $ref_nodes) = @_;
my ($class, $ref_nodes,$expecttimeout) = @_;
my @nodes = $ref_nodes;
my @badnodes = ();
my $n_str = $nodes[0];
@ -349,8 +350,9 @@ sub setupSSH
}
# generates new keys for root, if they do not already exist
# nodes not used on this option but in there to preserve the interface
my $rc=
xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL);
xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$n_str,$expecttimeout);
if ($rc != 0) {
$rsp->{data}->[0] = "remoteshellexp failed generating keys.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
@ -442,7 +444,7 @@ rmdir \"/tmp/$to_userid\" \n";
if ($enablenodes) { # node on list to setup nodetonodessh
chop $enablenodes; # remove last comma
$ENV{'DSH_ENABLE_SSH'} = "YES";
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes);
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to enablenodes.";
@ -452,7 +454,7 @@ rmdir \"/tmp/$to_userid\" \n";
}
if ($disablenodes) { # node on list to setup nodetonodessh
chop $disablenodes; # remove last comma
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes);
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys to disablenodes.";
@ -462,7 +464,7 @@ rmdir \"/tmp/$to_userid\" \n";
}
} else { # from user is not root or it is a device , always send private key
$ENV{'DSH_ENABLE_SSH'} = "YES";
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str);
my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str,$expecttimeout);
if ($rc != 0)
{
$rsp->{data}->[0] = "remoteshellexp failed sending keys.";
@ -476,7 +478,7 @@ rmdir \"/tmp/$to_userid\" \n";
foreach my $n (@testnodes)
{
my $rc=
xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n);
xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n,$expecttimeout);
if ($rc != 0)
{
push @badnodes, $n;

@ -199,10 +199,12 @@ my %usage = (
"Usage:
Common:
mkvm [-h|--help|-v|--version]
For PPC(with HMC):
For PPC(with HMC) specific:
mkvm noderange -i id -l singlenode [-V|--verbose]
mkvm noderange -c destcec -p profile [-V|--verbose]
mkvm noderange --full [-V|--verbose]
PPC (using Direct FSP Management) specific:
mkvm noderange <--full|--part>
For KVM
mkvm noderange -m|--master mastername -s|--size disksize -f|--force
For zVM
@ -216,7 +218,7 @@ my %usage = (
PPC (with HMC) specific:
lsvm <noderange> [-a|--all]
PPC (using Direct FSP Management) specific:
lsvm <noderange> [-l|--long]
lsvm <noderange> [-l|--long] [-p|--part]
zVM specific:
lsvm noderange
lsvm noderange --getnetworknames
@ -264,7 +266,9 @@ my %usage = (
"rmvm" =>
"Usage: rmvm <noderange> [--service][-V|--verbose]
rmvm [-h|--help|-v|--version],
rmvm [-p] [-f]",
rmvm [-p] [-f]
PPC (using Direct FSP Management) specific:
rmvm <noderange> [-p|--part]",
"lsslp" =>
"Usage: lsslp [-h|--help|-v|--version]
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP]
@ -345,9 +349,9 @@ my %usage = (
"Usage:
updatenode [-h|--help|-v|--version | -g|--genmypost]
or
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn]
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn] [-t <timeout>]
or
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw]
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t <timeout>]
[-P|--scripts [script1,script2,...]] [-s|--sn]
[-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir]
[attr=val [attr=val...]]
@ -384,6 +388,9 @@ Options:
[-s|--sn] Set the server information stored on the nodes.
[-t|--timeout] Time out in seconds to allow the command to run. Default is no timeout,
except for updatenode -k which has a 10 second default timeout.
[-A|--updateallsw] Install or update all software contained in the source
directory. (AIX only)

1
perl-xCAT/xCAT/data/discinfo.pm Normal file → Executable file

@ -64,6 +64,7 @@ require Exporter;
"1305067719.718814" => "rhelhpc6.1",#x86_64
"1321545261.599847" => "rhelhpc6.2",#x86_64
"1339640148.070971" => "rhelhpc6.3",#x86_64
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
"1194015916.783841" => "fedora8",
"1194015385.299901" => "fedora8",
"1210112435.291709" => "fedora9",

@ -892,6 +892,7 @@ sub kit_cleanrepo
}
if ( !$got_one ) {
print "Kit repository $repoid does not exist.\n";
return 1;
}
}
if ( -d "$::workdir/rpmbuild" ) {
@ -3080,11 +3081,12 @@ sub kit_addpkgs
my $kitbfname = basename($kittarfile);
$kitbfname =~ s/.tar.bz2$//;
$kitbfname =~ s/.NEED_PRODUCT_PKGS$//;
my $tmpdir_base = "/tmp/buildkit_workdir/$kitbfname";
my $tmpdir_base = "/tmp/$kitbfname";
# Cleanup - should have been removed when last command ran
# - but just in case
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
# the tar file may not be in the current dir
$kittarfile = "$::workdir/$kittarfile";
@ -3109,7 +3111,7 @@ sub kit_addpkgs
if ( system("cd $tmpdir_base; tar -jxf $kittarfile ") ) {
print "Error extracting tarfile $kittarfile \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
my $tmp_kit_conf = `find $tmpdir_base -name kit.conf`;
@ -3121,7 +3123,7 @@ sub kit_addpkgs
unless ( open( $CKF, "<", $tmp_kit_conf ) ) {
print "The Kit configuration file $tmp_kit_conf could not be read or was not included in the kit tar file. \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
my @lines = <$CKF>;
@ -3231,7 +3233,7 @@ sub kit_addpkgs
if ( system("ls $fromfile > /dev/null") ){
print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
foreach my $repo (split(/,/, $ext_reponames)) {
@ -3239,13 +3241,13 @@ sub kit_addpkgs
if ( ! -d ($repodir) && (! mkpath($repodir)) ) {
print "Error creating repository directory $repodir\n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
if (system("cp -fp $fromfile $repodir")) {
print "Error copying package file $fromfile to $repodir \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
$create_repodata_list{$repodir}=1;
@ -3277,7 +3279,7 @@ sub kit_addpkgs
if (!-d "$tdir" or !-d "$source_dir") {
print "Error open kitcomponent rpm build direcotry $tdir or $tdir/$non_native_kitcompname \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
@ -3287,13 +3289,13 @@ sub kit_addpkgs
my $fromfile = $rpmdir."/".$tepmfilename;
if ( system("ls $fromfile > /dev/null") ){
print "The product package file $non_native_filename could not be read from the package directory $rpmdir. \n";
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
if (system("cp -fp $fromfile $tdir/$non_native_kitcompname")) {
print "Error copying package file $fromfile to $tdir/$non_native_kitcompname \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
}
@ -3318,7 +3320,7 @@ sub kit_addpkgs
if (!-r "$spec") {
print "Error open kitcomponent rpm build spec $tdir/$non_native_kitcompname.spec \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
my $rpmbuild_dir = $tmpdir."/rpmbuild";
@ -3401,7 +3403,7 @@ sub kit_addpkgs
if (system( $createrepocmd )) {
print "Error running $createrepocmd. \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
}
@ -3411,13 +3413,13 @@ sub kit_addpkgs
if ( system("cd $tmpdir; cd ..; tar -cjhf $new_tarfile $kitname/*") ) {
print "Error building tarfile $new_tarfile \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
print "Kit tar file $new_tarfile successfully built \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 0;
}
@ -3486,7 +3488,7 @@ sub NEW_kit_addpkgs
if ( system("ls $fromfile > /dev/null") ){
print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
foreach my $repo (split(/,/, $ext_reponames)) {
@ -3494,13 +3496,13 @@ sub NEW_kit_addpkgs
if ( ! -d ($repodir) && (! mkpath($repodir)) ) {
print "Error creating repository directory $repodir\n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
if (system("cp -fp $fromfile $repodir")) {
print "Error copying package file $fromfile to $repodir \n";
# Cleanup
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
return 1;
}
}
@ -3580,7 +3582,7 @@ sub NEW_kit_addpkgs
my $buildtar_rc = &kit_buildtar;
# clean out the tmp dir
system ("rm -Rf /tmp/buildkit_workdir");
system ("rm -Rf $tmpdir_base");
if ($buildtar_rc) {
print "Error building full kit tarfile \n";

@ -29,8 +29,8 @@ if ( -f "/etc/debian_version" ) {
else {
$sha1support = eval {
require Digest::SHA1;
1;
require Digest::SHA1;
1;
};
}
use IPC::Open3;
@ -51,6 +51,158 @@ This program module file, is a set of utilities used by xCAT buildkit command
#-------------------------------------------------------------
#--------------------------------------------------------------------------
=head3 get_latest_version
Find the latest version in a list of rpms with the same basename
Arguments:
- the repo location
- a list of rpms with the same basename
Returns:
- name of rpm
- undef
Example:
my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist);
Comments:
=cut
#--------------------------------------------------------------------------
sub get_latest_version
{
my ($class, $repodir, $rpms) = @_;
my @rpmlist = @$rpms;
my %localversions_hash = ();
my %file_name_hash = ();
my $i = 0;
foreach my $rpm (@rpmlist)
{
# include path
my $fullrpmpath = "$repodir/$rpm*";
# get the basename, version, and release for this rpm
my $rcmd = "rpm -qp --queryformat '%{N} %{V} %{R}\n' $repodir/$rpm*";
my $out = `$rcmd`;
my ($rpkg, $VERSION, $RELEASE) = split(' ', $out);
chomp $VERSION;
chomp $RELEASE;
$localversions_hash{$i}{'VERSION'} = $VERSION;
$localversions_hash{$i}{'RELEASE'} = $RELEASE;
$file_name_hash{$VERSION}{$RELEASE} = $rpm;
$i++;
}
if ($i == 0)
{
print "error\n";
return undef;
}
my $versionout = "";
my $releaseout = "";
$i = 0;
foreach my $k (keys %localversions_hash)
{
if ($i == 0)
{
$versionout = $localversions_hash{$k}{'VERSION'};
$releaseout = $localversions_hash{$k}{'RELEASE'};
}
# if this is a newer version/release then set them
if ( xCAT::BuildKitUtils->testVersion($localversions_hash{$k}{'VERSION'}, ">", $versionout, $localversions_hash{$k}{'RELEASE'}, $releaseout) ) {
$versionout = $localversions_hash{$k}{'VERSION'};
$releaseout = $localversions_hash{$k}{'RELEASE'};
}
$i++;
}
return ($file_name_hash{$versionout}{$releaseout});
}
#------------------------------------------------------------------------------
=head3 testVersion
Compare version1 and version2 according to the operator and
return True or False.
Arguments:
$version1
$operator
$version2
$release1
$release2
Returns:
True or False
Example:
Comments:
The return value is generated with the Require query of the
rpm command.
=cut
#-----------------------------------------------------------------------------
sub testVersion
{
my ($class, $version1, $operator, $version2, $release1, $release2) = @_;
my @a1 = split(/\./, $version1);
my @a2 = split(/\./, $version2);
my $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2));
$#a1 = $len - 1; # make the arrays the same length before appending release
$#a2 = $len - 1;
push @a1, split(/\./, $release1);
push @a2, split(/\./, $release2);
$len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2));
my $num1 = '';
my $num2 = '';
for (my $i = 0 ; $i < $len ; $i++)
{
# remove any non-numbers on the end
my ($d1) = $a1[$i] =~ /^(\d*)/;
my ($d2) = $a2[$i] =~ /^(\d*)/;
my $diff = length($d1) - length($d2);
if ($diff > 0) # pad d2
{
$num1 .= $d1;
$num2 .= ('0' x $diff) . $d2;
}
elsif ($diff < 0) # pad d1
{
$num1 .= ('0' x abs($diff)) . $d1;
$num2 .= $d2;
}
else # they are the same length
{
$num1 .= $d1;
$num2 .= $d2;
}
}
# Remove the leading 0s or perl will interpret the numbers as octal
$num1 =~ s/^0+//;
$num2 =~ s/^0+//;
# be sure that $num1 is not a "".
if (length($num1) == 0) { $num1 = 0; }
if (length($num2) == 0) { $num2 = 0; }
if ($operator eq '=') { $operator = '=='; }
my $bool = eval "$num1 $operator $num2";
return $bool;
}
#-------------------------------------------------------------------------------
@ -112,95 +264,6 @@ sub get_OS_VRMF
return (length($version) ? $version : undef);
}
#----------------------------------------------------------------------------
=head3 testversion
Compare version1 and version2 according to the operator and
return True or False.
Arguments:
$version1
$operator
$version2
$release1
$release2
Returns:
True or False
Example:
if (BuildKitUtils->testversion ( $ins_ver,
"<",
$req_ver,
$ins_rel,
$req_rel)){ blah; }
Comments:
=cut
#-------------------------------------------------------------------------------
sub testversion
{
my ($class, $version1, $operator, $version2, $release1, $release2) = @_;
my @a1 = split(/\./, $version1);
my @a2 = split(/\./, $version2);
my $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2));
$#a1 = $len - 1; # make the arrays the same length before appending release
$#a2 = $len - 1;
push @a1, split(/\./, $release1);
push @a2, split(/\./, $release2);
$len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2));
my $num1 = '';
my $num2 = '';
for (my $i = 0 ; $i < $len ; $i++)
{
my ($d1) = $a1[$i] =~ /^(\d*)/; # remove any non-numbers on the end
my ($d2) = $a2[$i] =~ /^(\d*)/;
my $diff = length($d1) - length($d2);
if ($diff > 0) # pad d2
{
$num1 .= $d1;
$num2 .= ('0' x $diff) . $d2;
}
elsif ($diff < 0) # pad d1
{
$num1 .= ('0' x abs($diff)) . $d1;
$num2 .= $d2;
}
else # they are the same length
{
$num1 .= $d1;
$num2 .= $d2;
}
}
# Remove the leading 0s or perl will interpret the numbers as octal
$num1 =~ s/^0+//;
$num2 =~ s/^0+//;
#SLES Changes ??
# if $num1="", the "eval '$num1 $operator $num2'" will fail.
# So MUST BE be sure that $num1 is not a "".
if (length($num1) == 0) { $num1 = 0; }
if (length($num2) == 0) { $num2 = 0; }
#End of SLES Changes
if ($operator eq '=') { $operator = '=='; }
my $bool = eval "$num1 $operator $num2";
if (length($@))
{
# error msg ?
}
return $bool;
}
#-------------------------------------------------------------------------------
=head3 isLinux

@ -88,7 +88,7 @@ if (
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
'F|sync' => \$::FILESYNC,
'g|genmypost' => \$::GENMYPOST,
'g|genmypost' => \$::GENMYPOST,
'f|snsync' => \$::SNFILESYNC,
'l|user:s' => \$::USER,
'S|sw' => \$::SWMAINTENANCE,
@ -97,6 +97,7 @@ if (
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
) {
&updatenode_usage();

@ -16,6 +16,8 @@ B<lsvm> [B<-a>| B<--all>] I<noderange>
B<lsvm> [B<-l>| B<--long>] I<noderange>
B<lsvm> [B<-p>| B<--part>] I<noderange>
=head2 For zVM:
B<lsvm> I<noderange>
@ -73,6 +75,9 @@ B<-l>
Show lparnames for lpars.
B<-p|--part>
Show detailed information for lpars, such as processor, memory, physical IO slot, hugepage, BSR, etc.
=head1 RETURN VALUE
@ -190,7 +195,6 @@ Output is similar to:
Page Size(in GB): 16
Maximum huge page memory(in pages): 24
Requested huge page memory(in pages): 15
=======
Number of BSR arrays: 256,Bytes per BSR array: 4096,Available BSR array: 0;
Available huge page memory(in pages): 0
Configurable huge page memory(in pages): 12
@ -208,6 +212,59 @@ Output is similar to:
gpok3: INCLUDE LNXDFLT
gpok3: COMMAND SET VSWITCH VSW2 GRANT LNX3
6. For normal power machine, list out the detailed resource information:
lsvm cec -p
Output is similar to:
cec: HYP Configurable Processors: 16, Avail Processors: 16.
HYP Configurable Memory:32.00 GB(128 regions).
HYP Available Memory: 31.25 GB(125 regions).
HYP Memory Region Size: 0.25 GB(256 MB).
cec: All Physical I/O info:
65535,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot)
65535,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot)
65535,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot)
65535,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot)
65535,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot)
65535,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller)
65535,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller)
cec: Huge Page Memory
Available huge page memory(in pages): 2
Configurable huge page memory(in pages): 2
Page Size(in GB): 16
Maximum huge page memory(in pages): 4
Requested huge page memory(in pages): 2
cec: Barrier Synchronization Register(BSR)
Number of BSR arrays: 256
Bytes per BSR array: 4096
Available BSR array: 256
For partition on normal power machine, list out the detailed information:
lsvm lpar1 -p
Output is similar to:
lpar1: Lpar Processor Info:
Curr Processor Min: 1.
Curr Processor Req: 16.
Curr Processor Max: 16.
lpar1: Lpar Memory Info:
Curr Memory Min: 0.25 GB(1 regions).
Curr Memory Req: 30.75 GB(123 regions).
Curr Memory Max: 32.00 GB(128 regions).
lpar1: 1,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot)
lpar1: 1,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot)
lpar1: 1,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot)
lpar1: 1,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot)
lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot)
lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller)
lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller)
lpar1: 1/2/2
lpar1: 256.
=head1 FILES
/opt/xcat/bin/lsvm

@ -10,7 +10,7 @@ B<mkvm> [B<-h>| B<--help>]
B<mkvm> [B<-v>| B<--version>]
=head2 For PPC (with HMC):
=head2 For PPC (with HMC) specific:
B<mkvm> [B<-V>| B<--verbose>] I<noderange> B<-i> I<id> B<-l> I<singlenode>
@ -18,6 +18,11 @@ B<mkvm> [B<-V>| B<--verbose>] I<noderange> B<-c> I<destcec> B<-p> I<profile>
B<mkvm> [B<-V>| B<--verbose>] I<noderange> B<--full>
=head2 For PPC (using Direct FSP Management) specific:
B<mkvm> [I<noderange> B<--full> B<--part>]
=head2 For KVM:
B<mkvm> I<noderange> [B<-m|--master> I<mastername>] [B<-s|--size> I<disksize>] [B<--mem> I<memsize>] [B<--cpus> I<cpucount>] [B<-f|--force>]
@ -34,9 +39,7 @@ B<mkvm> I<noderange> [I<source_virtual_machine>] [B<pool=> I<disk_pool>]
=head1 DESCRIPTION
=head2 For PPC:
For PPC (with HMC) specific:
=head2 For PPC (with HMC) specific:
The first form of mkvm command creates new partition(s) with the same profile/resources as the partition specified by I<singlenode>. The -i and I<noderange> specify the starting numeric partition number and the I<noderange> for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition.
@ -46,6 +49,12 @@ Please make sure the nodes in the I<noderange> is defined in the I<nodelist> tab
Please note that the mkvm command currently only supports creating standard LPARs, not virtual LPARs working with VIOS server.
=head2 For PPC (using Direct FSP Management) specific:
With option I<full>, a partition using all the resources on a normal power machine will be created.
With option I<part>, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmory', 'vmphyslots', 'vmothersetting' will be created.
=head2 For KVM and Vmware:
The mkvm command creates new virtual machine(s) with the I<disksize> size of hard disk, I<memsize> size of memory and I<cpucount> number of cpu.
@ -78,6 +87,10 @@ The cpu count which will be created for the kvm/vmware virtual machine.
Request to create a new full system partition for each CEC.
=item B<--part>
Request to create a partition with the specified parameters.
=item B<-f|--force>
If B<-f|--force> is specified, the storage will be destroyed first if it existed.
@ -221,6 +234,42 @@ Output is similar to:
mkvm vm1 -s 10G --mem 2048 --cpus 2
8. To create a full partition on normal power machine.
First, define a node object:
mkdef -t node -o lpar1 mgt=fsp cons=fsp nodetype=ppc,osi id=1 hcp=cec parent=cec hwtype=lpar groups=lpar,all
Then, create the partion on the specified cec.
mkvm lpar1 --full
The output is similar to:
lpar1: Done
To query the resources allocated to node 'lpar1', please reference L<lsvm(1)|lsvm.1>.
Note: The 'parent' attribute for node 'lpar1' is the object name of physical power machine that the full partition will be created on.
9. To create a partition using some of the resources on normal power machine.
After a node object is defined, the resources that will be used for the partition shall be specified like this:
chdef lpar1 vmcpus=1/4/16 vmmemory=1G/4G/32G vmphyslots=0x21010201,0x21010200 vmothersetting=bsr:128,hugepage:2
Then, create the partion on the specified cec.
mkvm lpar1 --part
The outout is similar to:
lpar1: Done
To query the resources allocated to node 'lpar1', please reference L<lsvm(1)|lsvm.1>.
Note: The 'vmplyslots' specify the drc index of the physical slot device. Every drc index shall be delimited with ','. The 'vmothersetting' specify two kinds of resource, bsr(Barrier Synchronization Register) specified the num of BSR arrays, hugepage(Huge Page Memory) specified the num of pages.
=head1 FILES
/opt/xcat/bin/mkvm

@ -11,6 +11,10 @@ B<rbootseq> [B<-h>|B<--help>|B<-v>|B<--version>]
B<rbootseq> I<noderange> {B<hd0>|B<hd1>|B<hd2>|B<hd3>|B<net>|B<iscsi>|B<iscsicrit>|B<cdrom>|B<usbflash>|B<floppy>|B<none>|B<list>|B<stat>}B<,>I<...>
=head2 HP Blade specific:
B<rbootseq> I<noderange> {B<hd>|B<net1>|B<net2>|B<net3>|B<net4>|B<cdrom>|B<usbflash>|B<floppy>|B<none>}B<,>I<...>
=head2 PPC (using Direct FSP Management) specific:
B<rbootseq> I<noderange> B<[hfi|net]>
@ -52,6 +56,22 @@ The fourth hard disk.
Boot over the ethernet network, using a PXE or BOOTP broadcast.
=item B<n>|B<net>|B<network>|B<net1>|B<nic1> (HP Blade Only)
Boot over the first ethernet network, using a PXE or BOOTP broadcast.
=item B<net2>|B<nic2> (HP Blade Only)
Boot over the second ethernet network, using a PXE or BOOTP broadcast.
=item B<net3>|B<nic3> (HP Blade Only)
Boot over the third ethernet network, using a PXE or BOOTP broadcast.
=item B<net3>|B<nic3> (HP Blade Only)
Boot over the fourth ethernet network, using a PXE or BOOTP broadcast.
=item B<hfi>
Boot p775 nodes over the HFI network, using BOOTP broadcast.
@ -68,7 +88,7 @@ Boot to an iSCSI disk over the network.
The CD or DVD drive.
=item B<usbflas>|B<usb>|B<flash>
=item B<usbflash>|B<usb>|B<flash>
A USB flash drive.

@ -15,6 +15,10 @@ I<rmvm [-V| --verbose] noderange [-r] [--service]>
I<rmvm [-p] [-f]>
=head2 PPC (using Direct FSP Management) specific:
I<rmvm noderange> I<-p|--part>
=head1 DESCRIPTION
The rmvm command removes the partitions specified in noderange. If noderange is an CEC, all the partitions associated with that CEC will be removed. Note that removed partitions are automatically removed from the xCAT database. For IVM-managed systems, care must be taken to not remove the VIOS partition, or all the associated partitions will be removed as well.
@ -34,6 +38,8 @@ B<--service> Remove the service partitions of the specified CECs.
B<-p> Purge the existence of the VM from persistant storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration.
B<-p|--part> Remove the specified partiton on normal power machine.
B<-f> Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested.
=head1 RETURN VALUE
@ -87,6 +93,15 @@ Output is similar to:
gpok4: Deleting virtual server LNX4... Done
6. To remove a partition on normal power machine.
I<rmvm lpar1 -p>
Output is similar to:
lpar1: Done
=head1 FILES
/opt/xcat/bin/rmvm

@ -4,11 +4,11 @@ B<updatenode> - Update nodes in an xCAT cluster environment.
=head1 SYNOPSIS
B<updatenode> B<noderange> [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-S>|B<--sw>] [B<-l> I<userID>] [B<-P>|B<--scripts> [B<script1,script2...>]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d alt_source_dir>] [B<--fanout>] [B<attr=val> [B<attr=val...>]]
B<updatenode> B<noderange> [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-S>|B<--sw>] [B<-l> I<userID>] [B<-P>|B<--scripts> [B<script1,script2...>]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d alt_source_dir>] [B<--fanout>] [B<-t timeout>} [B<attr=val> [B<attr=val...>]]
B<updatenode> B<noderange> [B<-k>|B<--security>]
B<updatenode> B<noderange> [B<-k>|B<--security>] [B<-t timeout>]
B<updatenode> B<noderange> [B<-V>|B<--verbose>] [B<script1,script2...>]
B<updatenode> B<noderange> [B<-V>|B<--verbose>] [B<-t timeout>] [B<script1,script2...>]
B<updatenode> B<noderange> [B<-V>|B<--verbose>] [B<-f>|B<--snsync>]
@ -363,6 +363,11 @@ Specifies that node software should be updated.
Set the server information stored on the nodes.
=item B<-t timeout>
Specifies a timeout in seconds the command will wait for the remote targets to complete. If timeout is not specified
it will wait indefinitely. The exception is the updatenode -k option whose default timeout is 10 seconds.
=item B<-v|--version>
Command Version.

@ -565,7 +565,7 @@ To define a BNT Ethernet switch as a node and run a command to create a new vlan
B<chdef> I<myswitch groups=all>
B<tabch> I<switch=myswitch switches.sshusername=admin switches.sshpassword=passw0rd>
B<tabch> I<switch=myswitch switches.sshusername=admin switches.sshpassword=passw0rd switches.protocol=[ssh|telnet]>
where I<admin> and I<passw0rd> are the SSH user name and password for the switch. If it is for Telnet, add I<tn:> in front of the user name: I<tn:admin>.
<xdsh> I<myswitch --devicetype EthSwitch::BNT 'enable;configure terminal;vlan 3;end;show vlan'>

@ -57,6 +57,7 @@ my %modules = (
cec => "xCAT::FSPvm",
},
rmvm => { hmc => "xCAT::PPCvm",
hmc => "xCAT::FSPvm",
},
lsvm => { hmc => "xCAT::PPCvm",
fsp => "xCAT::FSPvm",

@ -182,6 +182,8 @@ sub mknetboot
my $xcatdport = "3001";
my $xcatiport = "3002";
my $nodestatus = "y";
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
#if ($sitetab)
#{
@ -446,7 +448,7 @@ sub mknetboot
if ($statelite) {
unless ( -r "$rootimgdir/kernel") {
$callback->({
error=>[qq{Did you run "genimage" before running "liteimg"? kernel cannot be found...}],
error=>[qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode=>[1]
});
next;
@ -454,7 +456,7 @@ sub mknetboot
if (!-r "$rootimgdir/initrd-statelite.gz") {
if (! -r "$rootimgdir/initrd.gz") {
$callback->({
error=>[qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}],
error=>[qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found at $rootimgdir/initrd.gz on $myname}],
errorcode=>[1]
});
next;
@ -473,7 +475,7 @@ sub mknetboot
} else {
unless ( -r "$rootimgdir/kernel") {
$callback->({
error=>[qq{Did you run "genimage" before running "packimage"? kernel cannot be found}],
error=>[qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode=>[1]
});
next;
@ -481,7 +483,7 @@ sub mknetboot
if (!-r "$rootimgdir/initrd-stateless.gz") {
if (! -r "$rootimgdir/initrd.gz") {
$callback->({
error=>[qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found}],
error=>[qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found at $rootimgdir/initrd.gz on $myname}],
errorcode=>[1]
});
next;
@ -491,7 +493,7 @@ sub mknetboot
}
unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.sfs" ) {
$callback->({
error=>["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
error=>["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1]});
next;
}
@ -1860,7 +1862,7 @@ sub mksysclone
$kcmdline .= "n8r";
}
}
$kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
#$kcmdline .= " noipv6";
# add the addkcmdline attribute to the end
# of the command, if it exists

@ -621,9 +621,11 @@ sub process_request {
$ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']);
}
add_or_delete_records($ctx);
my $ret = add_or_delete_records($ctx);
unless($ret) {
xCAT::SvrUtils::sendmsg("DNS setup is completed", $callback);
}
xCAT::SvrUtils::sendmsg("DNS setup is completed", $callback);
umask($oldmask);
}
@ -1077,7 +1079,11 @@ sub add_or_delete_records {
}
my $zone;
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
if( !defined $ip) {
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
return 1;
}
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]);
my $entry;

@ -28,6 +28,7 @@ sub handled_commands {
mkvm => 'nodehm:mgt',
lsvm => 'nodehm:mgt',
chvm => 'nodehm:mgt',
rmvm => 'nodehm:mgt',
rscan => 'nodehm:mgt',
getfspcon => 'nodehm:cons',
getmulcon => 'fsp',

@ -90,21 +90,30 @@ my %bootnumbers = (
'f' => 2,
'floppy' => 2,
'usb' => 3,
'usbflash' => 3,
'flash' => 3,
'h' => 4,
'hd' => 4,
'hdd' => 4,
'hd0' => 4,
'harddisk' => 4,
'eth0' => 5,
'nic1' => 5,
'net1' => 5,
'net' => 5,
'n' => 5,
'pxe_nic1' => 5,
'eth1' => 6,
'nic2' => 6,
'net2' => 6,
'pxe_nic2' => 6,
'eth2' => 7,
'nic3' => 7,
'net3' => 7,
'pxe_nic3' => 7,
'eth3' => 8,
'nic4' => 8,
'net4' => 8,
'pxe_nic4' => 8
);

@ -10,6 +10,7 @@ use File::Path;
use Getopt::Long;
require xCAT::Utils;
require xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
@ -279,6 +280,7 @@ sub preprocess_request {
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my $nodes = $req->{node};
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
@ -286,6 +288,7 @@ sub preprocess_request {
@args=($req->{arg});
}
@ARGV = @args;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
@ -323,10 +326,22 @@ sub preprocess_request {
return;
}
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
@ -335,58 +350,6 @@ sub preprocess_request {
}
return [$req];
}
#sub preprocess_request {
# my $req = shift;
# $callback = shift;
# if ($req->{_xcatdest}) { return [$req]; } #Exit if the packet has been preprocessed in its history
# my @requests = ({%$req}); #Start with a straight copy to reflect local instance
# my $sitetab = xCAT::Table->new('site');
# (my $ent) = $sitetab->getAttribs({key=>'xcatservers'},'value');
# $sitetab->close;
# if ($ent and $ent->{value}) {
# foreach (split /,/,$ent->{value}) {
# if (xCAT::NetworkUtils->thishostisnot($_)) {
# my $reqcopy = {%$req};
# $reqcopy->{'_xcatdest'} = $_;
# push @requests,$reqcopy;
# }
# }
# }
# return \@requests;
#}
#sub preprocess_request {
# my $req = shift;
# my $callback = shift;
# my %localnodehash;
# my %dispatchhash;
# my $nrtab = xCAT::Table->new('noderes');
# foreach my $node (@{$req->{node}}) {
# my $nodeserver;
# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']);
# if ($tent) { $nodeserver = $tent->{tftpserver} }
# unless ($tent and $tent->{tftpserver}) {
# $tent = $nrtab->getNodeAttribs($node,['servicenode']);
# if ($tent) { $nodeserver = $tent->{servicenode} }
# }
# if ($nodeserver) {
# $dispatchhash{$nodeserver}->{$node} = 1;
# } else {
# $localnodehash{$node} = 1;
# }
# }
# my @requests;
# my $reqc = {%$req};
# $reqc->{node} = [ keys %localnodehash ];
# if (scalar(@{$reqc->{node}})) { push @requests,$reqc }
#
# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets
# my $reqcopy = {%$req}; #deep copy
# $reqcopy->{'_xcatdest'} = $dtarg;
# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}];
# push @requests,$reqcopy;
# }
# return \@requests;
#}
sub process_request {
$request = shift;

@ -37,7 +37,8 @@ sub handled_commands
copycd => "sles",
mknetboot => "nodetype:os=(sles.*)|(suse.*)",
mkinstall => "nodetype:os=(sles.*)|(suse.*)",
mkstatelite => "nodetype:os=(sles.*)"
mkstatelite => "nodetype:os=(sles.*)",
mksysclone => "nodetype:os=(sles.*)|(suse.*)"
};
}
@ -690,6 +691,10 @@ sub process_request
{
return mknetboot($request, $callback, $doreq);
}
elsif ($request->{command}->[0] eq 'mksysclone')
{
return mksysclone($request, $callback, $doreq);
}
}
sub mkinstall
@ -1204,6 +1209,259 @@ sub mkinstall
#}
}
sub mksysclone
{
my $request = shift;
my $callback = shift;
my $doreq = shift;
my @nodes = @{$request->{node}};
my $osimagetab;
my %img_hash=();
my $installroot;
my $globaltftpdir;
$installroot = "/install";
$globaltftpdir = "/tftpboot";
my @ents = xCAT::TableUtils->get_site_attribute("installdir");
my $site_ent = $ents[0];
if( defined($site_ent) )
{
$installroot = $site_ent;
}
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
$site_ent = $ents[0];
if( defined($site_ent) )
{
$globaltftpdir = $site_ent;
}
my $node;
my $ostab = xCAT::Table->new('nodetype');
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my $xcatdport="3001";
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
if ( defined($entries[0])) {
$xcatdport = $entries[0];
}
my @entries = xCAT::TableUtils->get_site_attribute("master");
my $master_entry = $entries[0];
require xCAT::Template;
my $flag_return = 0;
# Warning message for nodeset <noderange> install/netboot/statelite
foreach my $knode (keys %osents)
{
my $ent = $osents{$knode}->[0];
if ($ent && $ent->{provmethod} && ($ent->{provmethod} eq 'sysclone')){
$callback->( { error => ["$knode: The provmethod \"sysclone\" have been deprecated. use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
errorcode => [1]});
# Do not print this warning message multiple times
$flag_return = 1;
}
}
if ( $flag_return == 1 ){
return;
}
# copy postscripts
my $pspath = "$installroot/sysclone/scripts/post-install/";
my $clusterfile = "$installroot/sysclone/scripts/cluster.txt";
mkpath("$pspath");
copy("$installroot/postscripts/configefi","$pspath/15all.configefi");
copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork");
copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost");
copy("$installroot/postscripts/killsyslog","$pspath/99all.killsyslog");
unless (-r "$pspath/10all.fix_swap_uuids")
{
mkpath("$pspath");
copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath");
}
unless (-r "$pspath/11all.replace_byid_device")
{
mkpath("$pspath");
copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath");
}
unless (-r "$pspath/95all.monitord_rebooted")
{
mkpath("$pspath");
copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath");
}
# copy hosts
copy("/etc/hosts","$installroot/sysclone/scripts/");
foreach $node (@nodes)
{
my $os;
my $tftpdir;
my $arch;
my $imagename; # set it if running of 'nodeset osimage=xxx'
my $xcatmaster;
my $instserver;
my $ient = $rents{$node}->[0];
if ($ient and $ient->{xcatmaster})
{
$xcatmaster = $ient->{xcatmaster};
} else {
$xcatmaster = $master_entry;
}
my $osinst;
if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) {
$tftpdir = $rents{$node}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
my $ent = $osents{$node}->[0];
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite') and ($ent->{provmethod} ne 'sysclone')) {
$imagename=$ent->{provmethod};
#print "imagename=$imagename\n";
if (!exists($img_hash{$imagename})) {
if (!$osimagetab) {
$osimagetab=xCAT::Table->new('osimage', -create=>1);
}
(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod');
if ($ref) {
$img_hash{$imagename}->{osarch}=$ref->{'osarch'};
} else {
$callback->(
{error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1]});
next;
}
}
my $ph=$img_hash{$imagename};
$arch = $ph->{osarch};
}
# copy kernel and initrd from image dir to /tftpboot
my $ramdisk_size = 200000;
if ( -r "$tftpdir/xcat/genesis.kernel.$arch"
and ( -r "$tftpdir/xcat/genesis.fs.$arch.gz"
or -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ))
{
#We have a shot...
my $ent = $rents{$node}->[0];
my $sent = $hents{$node}->[0];
my $kcmdline = "ramdisk_size=$ramdisk_size";
my $ksdev = "";
if ($ent->{installnic})
{
$ksdev = $ent->{installnic};
}
elsif ($ent->{primarynic})
{
$ksdev = $ent->{primarynic};
}
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
}
if ($ksdev eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = $macref->{mac};
}
unless ( $ksdev eq "bootif" ) {
$kcmdline .= " netdevice=" . $ksdev;
}
if ($arch =~ /ppc/) {
$kcmdline .= " dhcptimeout=150";
}
if (defined($sent->{serialport}))
{
unless ($sent->{serialspeed})
{
$callback->( { error => [ "serialport defined, but no serialspeed for $node in nodehm table" ],
errorcode => [1] } );
}
else {
#go cmdline if serial console is requested, the shiny ansi is just impractical
$kcmdline .= " cmdline console=tty0 console=ttyS"
. $sent->{serialport} . ","
. $sent->{serialspeed};
if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/) {
$kcmdline .= "n8r";
}
}
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $i = "xcat/genesis.fs.$arch.gz";
if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){
$i = "xcat/genesis.fs.$arch.lzma";
}
$bptab->setNodeAttribs(
$node,
{
kernel => "xcat/genesis.kernel.$arch",
initrd => $i,
kcmdline => $kcmdline
}
);
}
else
{
$callback->( { error => ["Kernel and initrd not found in $tftpdir/xcat"],
errorcode => [1] } );
}
# assign nodes to an image
if (-r "$clusterfile")
{
my $cmd = qq{cat $clusterfile | grep "$node"};
my $out = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC == 0)
{
my $out = `sed -i /$node./d $clusterfile`;
}
}
my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile};
my $out = xCAT::Utils->runcmd($cmd, -1);
unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
{
mkpath("$installroot/sysclone/images/$imagename/opt/xcat/");
copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/");
}
}
# check systemimager-server-rsyncd to make sure it's running.
my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rc = xCAT::Utils->startService("systemimager-server-rsyncd");
if ($rc != 0) {
return 1;
}
}
}
sub copycd
{
my $request = shift;

@ -227,6 +227,7 @@ sub preprocess_updatenode
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
)
@ -832,13 +833,18 @@ sub security_update_sshkeys
# call the xdsh -K to set up the ssh keys
my @envs = @{$request->{environment}};
my @args = ("-K");
my $args;
push @$args,"-K";
if (defined($::timeout)) { # timeout
push @$args,"-t" ;
push @$args,$::timeout;
}
my $res =
xCAT::Utils->runxcmd(
{
command => ['xdsh'],
node => \@$nodes,
arg => \@args,
arg => $args,
env => \@envs,
},
$subreq, 0, 1
@ -849,7 +855,7 @@ sub security_update_sshkeys
my $rsp = {};
# not display password in verbose mode.
$rsp->{data}->[0] =
" $localhostname: Internal call command: xdsh -K. nodes = @$nodes, arguments = @args, env = xxxxxx";
" $localhostname: Internal call command: xdsh @$nodes " . join(' ', @$args);
$rsp->{data}->[1] =
" $localhostname: return messages of last command: @$res";
$callback->($rsp);
@ -1006,6 +1012,7 @@ sub updatenode
'k|security' => \$::SECURITY,
'o|os:s' => \$::OS,
'fanout=i' => \$::fanout,
't|timetout=i' => \$::timeout,
)
)
{
@ -1318,6 +1325,10 @@ sub updatenoderunps
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
@ -1450,6 +1461,10 @@ sub updatenodesyncfiles
push @$args,"-f" ;
push @$args,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args,"-t" ;
push @$args,$::timeout;
}
if (defined($::USER)) { # -l must sudo
push @$args,"--sudo" ;
push @$args,"-l" ;
@ -1646,6 +1661,10 @@ sub updatenodesoftware
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
if (defined($::USER)) { # -l contains sudo user
push @$args1,"--sudo" ;
push @$args1,"-l" ;
@ -2622,6 +2641,10 @@ sub updateAIXsoftware
push @$args1,"-f" ;
push @$args1,$::fanout;
}
if (defined($::timeout)) { # timeout
push @$args1,"-t" ;
push @$args1,$::timeout;
}
push @$args1,"$installcmd";
$subreq->(

@ -10,7 +10,7 @@ use xCAT::MsgUtils;
use Getopt::Long;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
@ -294,6 +294,7 @@ sub preprocess_request {
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my $nodes = $req->{node};
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
@ -345,11 +346,22 @@ sub preprocess_request {
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#they specify no sharedtftp in site table
#my $stab = xCAT::Table->new('site');
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');i
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
@ -358,59 +370,6 @@ sub preprocess_request {
}
return [$req];
}
#sub preprocess_request {
# my $req = shift;
# $callback = shift;
# if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
# my @requests = ({%$req}); #Start with a straight copy to reflect local instance
# my $sitetab = xCAT::Table->new('site');
# (my $ent) = $sitetab->getAttribs({key=>'xcatservers'},'value');
# $sitetab->close;
# if ($ent and $ent->{value}) {
# foreach (split /,/,$ent->{value}) {
# if (xCAT::NetworkUtils->thishostisnot($_)) {
# my $reqcopy = {%$req};
# $reqcopy->{'_xcatdest'} = $_;
# $reqcopy->{_xcatpreprocessed}->[0] = 1;
# push @requests,$reqcopy;
# }
# }
# }
# return \@requests;
#}
#sub preprocess_request {
# my $req = shift;
# my $callback = shift;
# my %localnodehash;
# my %dispatchhash;
# my $nrtab = xCAT::Table->new('noderes');
# foreach my $node (@{$req->{node}}) {
# my $nodeserver;
# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']);
# if ($tent) { $nodeserver = $tent->{tftpserver} }
# unless ($tent and $tent->{tftpserver}) {
# $tent = $nrtab->getNodeAttribs($node,['servicenode']);
# if ($tent) { $nodeserver = $tent->{servicenode} }
# }
# if ($nodeserver) {
# $dispatchhash{$nodeserver}->{$node} = 1;
# } else {
# $localnodehash{$node} = 1;
# }
# }
# my @requests;
# my $reqc = {%$req};
# $reqc->{node} = [ keys %localnodehash ];
# if (scalar(@{$reqc->{node}})) { push @requests,$reqc }
#
# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets
# my $reqcopy = {%$req}; #deep copy
# $reqcopy->{'_xcatdest'} = $dtarg;
# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}];
# push @requests,$reqcopy;
# }
# return \@requests;
#}
sub process_request {
$request = shift;

@ -5,6 +5,7 @@ use Sys::Syslog;
use xCAT::Scope;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use File::Path;
@ -334,7 +335,7 @@ sub preprocess_request {
@args=($req->{arg});
}
@ARGV = @args;
my $nodes = $req->{node};
#use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
@ -375,13 +376,23 @@ sub preprocess_request {
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#they specify no sharedtftp in site table
#my $stab = xCAT::Table->new('site');
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');
#if they specify no sharedtftp in site table
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
@ -390,40 +401,6 @@ sub preprocess_request {
}
return [$req];
}
#sub preprocess_request {
# my $req = shift;
# my $callback = shift;
# my %localnodehash;
# my %dispatchhash;
# my $nrtab = xCAT::Table->new('noderes');
# foreach my $node (@{$req->{node}}) {
# my $nodeserver;
# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']);
# if ($tent) { $nodeserver = $tent->{tftpserver} }
# unless ($tent and $tent->{tftpserver}) {
# $tent = $nrtab->getNodeAttribs($node,['servicenode']);
# if ($tent) { $nodeserver = $tent->{servicenode} }
# }
# if ($nodeserver) {
# $dispatchhash{$nodeserver}->{$node} = 1;
# } else {
# $localnodehash{$node} = 1;
# }
# }
# my @requests;
# my $reqc = {%$req};
# $reqc->{node} = [ keys %localnodehash ];
# if (scalar(@{$reqc->{node}})) { push @requests,$reqc }
#
# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets
# my $reqcopy = {%$req}; #deep copy
# $reqcopy->{'_xcatdest'} = $dtarg;
# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}];
# push @requests,$reqcopy;
# }
# return \@requests;
#}
#
sub process_request {

@ -109,7 +109,7 @@ until ($mm and $username and $slot) {
}
release_lock(); #done with xcatd, can run with near impunity
$sleepint=10+int(rand(30)); #Stagger sleep to take it easy on AMM/hosting server
exec "ssh -t $username"."@"."$mm";
exec "ssh -t $username"."@"."$mm vsp";
my $pathtochild= dirname($scriptname). "/";
#exec $pathtochild."hpblade.expect";

@ -0,0 +1,148 @@
#
#cmdline
lang en_US
#
# Where's the source?
# nfs --server hostname.of.server or IP --dir /path/to/RH/CD/image
#
#nfs --server #XCATVAR:INSTALL_NFS# --dir #XCATVAR:INSTALL_SRC_DIR#
url --url http://#TABLE:noderes:$NODE:nfsserver#/install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#
#device ethernet e100
keyboard "us"
#
# Clear the MBR
#
zerombr
#
# Wipe out the disk
#
clearpart --all --initlabel
#clearpart --linux
key --skip
#
# Customize to fit your needs
#
#XCAT_PARTITION_START#
#No RAID
#/boot really significant for this sort of setup nowadays?
#part /boot --size 50 --fstype ext3
%include /tmp/partitioning
#part swap --size 1024
#part / --size 1 --grow --fstype ext4
#XCAT_PARTITION_END#
#RAID 0 /scr for performance
#part / --size 1024 --ondisk sda
#part swap --size 512 --ondisk sda
#part /var --size 1024 --ondisk sdb
#part swap --size 512 --ondisk sdb
#part raid.01 --size 1 --grow --ondisk sda
#part raid.02 --size 1 --grow --ondisk sdb
#raid /scr --level 0 --device md0 raid.01 raid.02
#Full RAID 1 Sample
#part raid.01 --size 50 --ondisk sda
#part raid.02 --size 50 --ondisk sdb
#raid /boot --level 1 --device md0 raid.01 raid.02
#
#part raid.11 --size 1024 --ondisk sda
#part raid.12 --size 1024 --ondisk sdb
#raid / --level 1 --device md1 raid.11 raid.12
#
#part raid.21 --size 1024 --ondisk sda
#part raid.22 --size 1024 --ondisk sdb
#raid /var --level 1 --device md2 raid.21 raid.22
#
#part raid.31 --size 1024 --ondisk sda
#part raid.32 --size 1024 --ondisk sdb
#raid swap --level 1 --device md3 raid.31 raid.32
#
#part raid.41 --size 1 --grow --ondisk sda
#part raid.42 --size 1 --grow --ondisk sdb
#raid /scr --level 1 --device md4 raid.41 raid.42
#
# bootloader config
# --append <args>
# --useLilo
# --md5pass <crypted MD5 password for GRUB>
#
bootloader
#
# install or upgrade
#
install
#
# text mode install (default is graphical)
#
#text
#
# firewall
#
firewall --disabled
#
# Select a zone
# Add the --utc switch if your hardware clock is set to GMT
#
#timezone US/Hawaii
#timezone US/Pacific
#timezone US/Mountain
#timezone US/Central
#timezone US/Eastern
timezone --utc "#TABLE:site:key=timezone:value#"
#
# Don't do X
#
skipx
#
# To generate an encrypted root password use:
#
# perl -e 'print crypt("blah","Xa") . "\n";'p
# openssl passwd -apr1 -salt xxxxxxxx password
#
# where "blah" is your root password.
#
#rootpw --iscrypted XaLGAVe1C41x2
#rootpw XaLGAVe1C41x2 --iscrypted
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
#
# NIS setup: auth --enablenis --nisdomain sensenet
# --nisserver neptune --useshadow --enablemd5
#
# OR
auth --useshadow --enablemd5
#
# SE Linux
#
selinux --disabled
#
# Reboot after installation
#
reboot
#
#end of section
#
%packages
#INCLUDE_DEFAULT_PKGLIST#
%pre
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh#
%post
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rh#

@ -0,0 +1,38 @@
#Please make sure there is a space between @ and group name
autofs
ksh
tcsh
ntp
tftp
xinetd
rsh
rsh-server
psacct
nfs-utils
net-snmp
rsync
yp-tools
ypserv
ypbind
m4
sendmail-cf
gdb
binutils
openssh-server
util-linux
compat-libstdc++-33
-kernel-xen
-kmod-cmirror-xen
-xen-devel
-kmod-gnbd-xen
-xen
-libvirt-devel
-libvirt-cim
-gnome-applet-vm
-kmod-gfs-xen
-xen-libs
-libvirt
-virt-viewer
-libvirt-python
-python-virtinst
-virt-manager

@ -0,0 +1,22 @@
bash
dracut-network
nfs-utils
openssl
dhclient
kernel
openssh-server
openssh-clients
busybox
dash
iputils
bc
irqbalance
procps
wget
vim-minimal
ntp
rpm
rsync
rsyslog
e2fsprogs
parted

@ -88,7 +88,13 @@ my $sock = IO::Socket::INET->new(Proto => 'udp',
#LocalAddr => 0,
LocalAddr => $IP,
LocalPort => '68',
PeerAddr => inet_ntoa(INADDR_BROADCAST)) or die "Create socket error: $@\n";
PeerAddr => inet_ntoa(INADDR_BROADCAST));
unless ($sock) {
print "Create socket error: $@\n";
kill_child();
exit 1;
}
my $timeout = 10;
if ($::TIMEOUT) {
@ -104,6 +110,8 @@ while ($end - $start <= $timeout) {
$end =~ s/(\d.*)\.(\d.*)/$1/;
}
kill_child();
#kill the child process
kill 15, $pid;
my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`;
@ -297,4 +305,12 @@ sub packdhcppkg{
return $package;
}
sub kill_child {
kill 15, $pid;
my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`;
foreach my $cpid (@pidoftcpdump) {
kill 15, $cpid;
#print "try to kill $cpid\n";
}
}

@ -1,2 +1,59 @@
echo "Setting Boot Manager for the next boot."
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux
if [ -d /sys/firmware/efi ]; then
echo "Setting Boot Manager for the next boot."
echo "delete all sysclone boot list"
str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'`
for str_num in $str_bootnums
do
efibootmgr -b $str_num -B -q
done
if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux
elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then
efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux
else
echo "Can not find the boot loader."
exit 1
fi
else
echo "run grub-install to configure the MBR."
if [ -e /etc/mtab ];then
mv /etc/mtab /etc/mtab.bak
fi
grep -v rootfs /proc/mounts > /etc/mtab
boot_device=''
if [ -f "/etc/systemconfig/systemconfig.conf" ];then
boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'`
else
str_temp=`mount | awk '{print $1","$3}'`
for line in $str_temp
do
mp=`echo $line | awk -F, '{print $2}'`
if [ "$mp" = "/" ];then
boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'`
break
fi
done
fi
if [ -n "$boot_device" ];then
echo "the boot device is $boot_device"
else
echo "Can not find the boot device, return error"
exit 1
fi
#for sles10, should run grub-install with parameters
echo "grub-install --no-floppy --recheck $boot_device"
grub-install --no-floppy --recheck $boot_device
if [ $? -ne 0 ];then
#sles11, run grub install directly
grub-install
fi
if [ -e /etc/mtab.bak ];then
mv -f /etc/mtab.bak /etc/mtab
else
rm -f /etc/mtab
fi
fi

@ -15,7 +15,7 @@ function v4mask2prefix(){
case $num_dec in
255) let num_bits+=8;;
254) let num_bits+=7;;
253) let num_bits+=6;;
252) let num_bits+=6;;
248) let num_bits+=5;;
240) let num_bits+=4;;
224) let num_bits+=3;;
@ -28,6 +28,72 @@ function v4mask2prefix(){
echo "$num_bits"
}
function v4prefix2mask(){
local a=$1
local b=0
local num_index=1
local str_temp=''
local str_mask=''
while [[ $num_index -le 4 ]]
do
if [ $a -ge 8 ];then
b=8
a=$((a-8))
else
b=$a
a=0
fi
case $b in
0) str_temp="0";;
1) str_temp="128";;
2) str_temp="192";;
3) str_temp="224";;
4) str_temp="240";;
5) str_temp="248";;
6) str_temp="252";;
7) str_temp="254";;
8) str_temp="255";;
esac
str_mask=$str_mask$str_temp"."
num_index=$((num_index+1))
done
str_mask=`echo $str_mask | sed 's/.$//'`
echo "$str_mask"
}
function v4calcbcase(){
local str_mask=$2
echo $str_mask | grep '\.'
if [ $? -ne 0 ];then
str_mask=$(v4prefix2mask $str_mask)
fi
local str_bcast=''
local str_temp=''
local str_ifs=$IFS
IFS=$'.'
local array_ip=($1)
local array_mask=($str_mask)
IFS=$str_ifs
if [ ${#array_ip[*]} -ne 4 -o ${#array_mask[*]} -ne 4 ];then
echo "255.255.255.255"
return
fi
for index in {0..3}
do
str_temp=`echo $[ ${array_ip[$index]}|(${array_mask[$index]} ^ 255) ]`
str_bcast=$str_bcast$str_temp"."
done
str_bcast=`echo $str_bcast | sed 's/.$//'`
echo "$str_bcast"
}
function configipv4(){
str_if_name=$1
str_v4ip=$2
@ -230,8 +296,9 @@ function add_ip_temporary(){
str_label=$str_nic_name
fi
str_bcase=$(calcbcase $str_ip $str_mask)
#the label is ready, add the ip address directly
ip addr add $str_ip/${str_mask} dev $str_nic_name scope global label $str_label
ip addr add $str_ip/${str_mask} broadcast $str_bcase dev $str_nic_name scope global label $str_label
fi
fi
}
@ -392,7 +459,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
#fetch the subnet and netmask in networks definition
str_subnet=`echo $str_line | awk -F'net=' '{print $2}' | awk -F'|' '{print $1}'`
str_netmask=`echo $str_line | awk -F'mask=' '{print $2}' | awk -F'|' '{print $1}'`
str_netmask=`echo $str_line | awk -F'mask=' '{print $2}' | awk -F'|' '{print $1}' | sed 's:^/::'`
str_gateway=`echo $str_line | awk -F'gateway=' '{print $2}' | awk -F'|' '{print $1}'`
if [ ! $str_subnet -o ! $str_netmask ];then
@ -405,7 +472,8 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do
array_nic_subnet[$num_index]=$str_subnet
array_nic_netmask[$num_index]=$str_netmask
array_nic_gateway[$num_index]=$str_gateway
if [ -n "$str_gateway" ];then
echo "$str_gateway" | grep ':'
if [ $? -eq 0 ];then
str_ipv6_gateway=$str_gateway
fi
logger -t xcat -p local4.err "configeth: $str_ip, $str_subnet, $str_netmask, $str_gateway"

@ -92,6 +92,37 @@ elif [ `echo $str_temp | grep -E "e(n|th)[0-9]+"` ];then
fi
bool_exit_flag=0
#check the required attributes
if [ -z "$NICIPS" ];then
if [ -n "$NICTYPES" ];then
logger -t xcat -p local4.info "confignics: nicips attribute is not defined. so the nictypes attribute can not be defined."
echo "confignics on $NODE: nicips attribute is not defined. so the nictypes attribute can not be defined."
bool_exit_flag=1
fi
if [ -n "$NICNETWORKS" ];then
logger -t xcat -p local4.info "confignics: nicips attribute is not defined. so the nicnetworks attribute can not be defined."
echo "confignics on $NODE: nicips attribute is not defined. so the nicnetworks attribute can not be defined."
bool_exit_flag=1
fi
else
if [ -z "$NICTYPES" ];then
logger -t xcat -p local4.info "confignics: nictypes attribute is not defined."
echo "confignics on $NODE: nictypes attribute is not defined."
bool_exit_flag=1
fi
if [ -z "$NICNETWORKS" ];then
logger -t xcat -p local4.info "confignics: nicnetworks attribute is not defined."
echo "confignics on $NODE: nicnetworks attribute is not defined."
bool_exit_flag=1
fi
fi
if [ $bool_exit_flag -eq 1 ];then
exit 0
fi
splitconfig $NICIPS
splitconfig $NICTYPES
@ -169,6 +200,11 @@ do
echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key"
${array_temp[3]}
else
if [ -n "${array_temp[2]}" ];then
logger -t xcat -p local4.info "confignics: ip address,nic type and network are required. $key: $str_value ."
echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ."
continue
fi
if [ "${array_temp[1]}" ];then
str_nic_type=`echo ${array_temp[1]} | tr "[A-Z]" "[a-z]"`
else

@ -1,7 +1,3 @@
#!/bin/bash
#only used in sysclone when the image os is sles
if [ -f "/etc/SuSE-release" ];then
str_out=`ps -ef | grep -v grep | grep syslog-ng`
if [ $? -eq 0 ];then

@ -1,4 +1,7 @@
#!/bin/bash
if [ -f "/opt/xcat/xcatinfo" ];then
rm -f "/opt/xcat/xcatinfo"
fi
/opt/xcat/xcatdsklspost
. /tmp/post-install/variables.txt

@ -0,0 +1,37 @@
#!/bin/bash
if [ "$NODESETSTATE" != "sysclone" ];then
exit 0
fi
#update the exclude configuration file
#do not sync the following files
for filename in /etc/fstab /boot/grub /etc/grub.conf /boot/efi /etc/elilo.conf /xcatpost
do
if [ ! -e $filename ];then
continue
fi
grep -E "^\s*${filename}\s*$" "/etc/systemimager/updateclient.local.exclude"
if [ $? -ne 0 ];then
echo "$filename" >> "/etc/systemimager/updateclient.local.exclude"
fi
done
#get the current image server
str_server_ip=''
. /opt/xcat/xcatinfo
if [ -n "$XCATSERVER" ];then
str_server_ip=$XCATSERVER
else
str_server_ip=$MASTER
fi
if [ -z "$str_server_ip" ];then
echo "Can not find out the image server."
exit 1
fi
str_server_ip=`echo $str_server_ip | sed "s/'//g"`
#call system imager command to update the image
echo "si_updateclient --server $str_server_ip --no-bootloader --yes"
export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_updateclient --server $str_server_ip --no-bootloader --yes

@ -7,29 +7,46 @@ if [ -n "$rule_file" ];then
rm -f $rule_file
fi
echo "Updating hostname to $HOSTNAME"
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
hostname $HOSTNAME
str_cfg_file=''
if [ -d "/etc/sysconfig/network-scripts/" ];then
#redhat
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE"
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
if [ -f $str_cfg_file ];then
echo "Old ifcfg-$DEVICE is:"
cat $str_cfg_file
HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'`
sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file
sed -i "s/UUID=.*//g" $str_cfg_file
else
echo "DEVICE=\"$DEVICE\"" > $str_cfg_file
echo "BOOTPROTO=\"dhcp\"" >> $str_cfg_file
echo "NM_CONTROLLED=\"yes\"" >> $str_cfg_file
echo "ONBOOT=\"yes\"" >> $str_cfg_file
fi
elif [ -d "/etc/sysconfig/network/" ];then
#suse
str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE"
echo "$HOSTNAME" > /etc/HOSTNAME
if [ -f $str_cfg_file ];then
echo "Old ifcfg-$DEVICE is:"
cat $str_cfg_file
HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'`
sed -i "s/HWADDR=.*/HWADDR=$HWADDR/g" $str_cfg_file
sed -i "s/UUID=.*//g" $str_cfg_file
else
echo "DEVICE=\"$DEVICE\"" > $str_cfg_file
echo "BOOTPROTO=dhcp" >> $str_cfg_file
echo "STARTMODE=onboot" >> $str_cfg_file
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file
fi
else
#ubuntu
str_cfg_file="/etc/network/interfaces.d/$DEVICE"
echo "Does not support ubuntu."
exit 1
fi
echo "Old ifcfg-$DEVICE is:"
cat $str_cfg_file
HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'`
sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file
sed -i "s/UUID=.*//g" $str_cfg_file
echo "New ifcfg-$DEVICE is:"
cat $str_cfg_file