Supporting full-partition and physical-partition with DFM
This commit is contained in:
parent
4cb0606746
commit
371c4c79a9
@ -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,425 @@ 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 (@$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 +1865,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 +1887,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;
|
||||
|
@ -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',
|
||||
|
@ -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]
|
||||
|
@ -57,6 +57,7 @@ my %modules = (
|
||||
cec => "xCAT::FSPvm",
|
||||
},
|
||||
rmvm => { hmc => "xCAT::PPCvm",
|
||||
hmc => "xCAT::FSPvm",
|
||||
},
|
||||
lsvm => { hmc => "xCAT::PPCvm",
|
||||
fsp => "xCAT::FSPvm",
|
||||
|
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user