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

modified doxcat to optionally use static ip
This commit is contained in:
Bruce Potter 2014-04-14 15:56:56 -04:00
commit abab2914af
20 changed files with 2019 additions and 4273 deletions

View File

@ -598,7 +598,7 @@ sub _execute_dsh
}
else
{
# LKV: This is where the output shows up
# HERE: This is where the output shows up
#print STDOUT @{$output_buffers{$user_target}};
#print STDERR @{$error_buffers{$user_target}};
chomp(@{$output_buffers{$user_target}});
@ -5310,7 +5310,8 @@ sub build_merge_rsync
if ($syncmergescript == 0) { # don't add the xdcpmerge.sh line
push @::mergelines,$line;
}
my $src_file = $1; # merge file left of arror
my $src_file = $1; # merge file left of arrow
my $orig_src_file = $1;
# it will be sync'd to $nodesyncfiledir/$merge_file
my $dest_file = $nodesyncfiledir;
$dest_file .= $src_file;
@ -5339,7 +5340,7 @@ sub build_merge_rsync
# to pick up files from /var/xcat/syncfiles...
if ($onServiceNode == 1) {
my $newsrcfile = $syncdir; # add SN syndir on front
$newsrcfile .= $src_file;
$newsrcfile .= $orig_src_file;
$src_file=$newsrcfile;
}
# destination file name

View File

@ -48,6 +48,15 @@ sub parse_args {
##########################################################################
# Parse the chvm command line for options and operands
##########################################################################
my @query_array = ();
my %param_list_map = (
'vmcpus' => 'part_get_lpar_processing',
'vmmemory' => 'part_get_lpar_memory',
'vmphyslots' => 'part_get_all_io_bus_info',
'vmnics' => 'part_get_all_vio_info',
'vmstorage' => 'part_get_all_vio_info',
'del_vadapter' => 'part_get_all_vio_info'
);
sub chvm_parse_extra_options {
my $args = shift;
@ -57,6 +66,7 @@ sub chvm_parse_extra_options {
if (ref($args) ne 'ARRAY') {
return "$args";
}
my %tmp_hash = ();
foreach (@$args) {
my ($cmd, $value) = split (/\=/, $_);
if (!defined($value)) {
@ -75,14 +85,24 @@ sub chvm_parse_extra_options {
# return "'$value' invalid";
# }
} elsif (grep(/^$cmd$/, @support_ops)) {
if (exists($param_list_map{$cmd})) {
$tmp_hash{$param_list_map{$cmd}} = 1;
}
if (exists($opt->{p775})) {
return "'$cmd' doesn't work for Power 775 machines.";
} elsif ($cmd eq "del_vadapter") {
if ($value !~ /^\d+$/) {
return "Invalid param '$value', only one slot id can be specified";
}
} elsif ($cmd eq "vmothersetting") {
if ($value =~ /hugepage:\s*(\d+)/i) {
$opt->{huge_page} = $1;
$tmp_hash{'get_huge_page'} = 1;
}
if ($value =~ /bsr:\s*(\d+)/i) {
$opt->{bsr} = $1;
$tmp_hash{'get_cec_bsr'} = 1;
}
next;
} elsif ($cmd eq "vmstorage") {
@ -157,6 +177,7 @@ sub chvm_parse_extra_options {
}
$opt->{$cmd} = $value;
}
@query_array = keys(%tmp_hash);
return undef;
}
@ -763,7 +784,7 @@ sub do_op_extra_cmds {
my $request = shift;
my $hash = shift;
my @values = ();
my %lpar_hash = ();
while (my ($mtms, $h) = each(%$hash)) {
my $memhash;
while (my($name, $d) = each(%$h)) {
@ -871,8 +892,15 @@ sub do_op_extra_cmds {
push @values, [$name, "Success", '0'];
}
}
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
# need to add update db here
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[4];
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@values;
}
sub check_node_info {
@ -1839,11 +1867,16 @@ sub update_vm_db {
my $lpar_hash = shift;
my $vm_hd = xCAT::Table->new('vm');
my %name_id_map = ();
my $commit = 0;
foreach (keys (%$lpar_hash)) {
my %db_update = ();
my $node_hash = $lpar_hash->{$_};
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
if (exists($node_hash->{lpar_cpu_min})) {
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
}
if (exists($node_hash->{lpar_mem_nim})) {
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
}
if (exists($node_hash->{lpar_vmstorage_server})) {
$db_update{storage} = $node_hash->{lpar_vmstorage_server};
} elsif (exists($node_hash->{lpar_vmstorage_client})) {
@ -1863,14 +1896,23 @@ sub update_vm_db {
}
$db_update{storage} = join(",",@tmp_array);
}
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
if (exists($node_hash->{lpar_vmnics})) {
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
}
if (exists($node_hash->{lpar_phy_bus})) {
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
}
if (exists($node_hash->{lpar_othersetting})) {
$db_update{othersettings} = join(",",@{$node_hash->{lpar_othersetting}});
}
$vm_hd->setNodeAttribs($_,\%db_update);
if (%db_update) {
$vm_hd->setNodeAttribs($_,\%db_update);
$commit = 1;
}
}
if ($commit) {
$vm_hd->commit;
}
$vm_hd->commit;
}
#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);
@ -2162,6 +2204,7 @@ sub mkspeclpar {
my $opt = $request->{opt};
my $values;
my @result = ();
my %lpar_hash = ();
my $vmtab = xCAT::Table->new( 'vm');
unless($vmtab) {
return([["Error","Cannot open vm table", 1]]);
@ -2327,10 +2370,18 @@ sub mkspeclpar {
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
$values = &create_lpar($request, $name, $d, $tmp_ent);
push @result, $values;
#need to add update db here
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
$lpar_hash{$name} = $rethash;
$lpar_hash{$name}->{parent} = @$d[4];
$name = undef;
$d = undef;
}
}
if (%lpar_hash) {
update_vm_db($request, \%lpar_hash);
}
return \@result;
}

View File

@ -1981,6 +1981,53 @@ sub isIpaddr
}
}
#-------------------------------------------------------------------------------
=head3 getSubnetGateway
Description:
Get gateway from the networks table of the specified net.
Arguments:
net: the net, ie. the "net" field of the networks table
Returns:
Return a string, of the gateway
undef - Failed to get the gateway
Globals:
none
Error:
none
Example:
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getSubnetGateway
{
my $netname=shift;
if( $netname =~ /xCAT::NetworkUtils/)
{
$netname=shift;
}
my $gateway=undef;
my $nettab = xCAT::Table->new("networks");
unless($nettab) { die "No entry defined in networks"; }
my @nets = $nettab->getAllAttribs('net','gateway');
foreach(@nets)
{
if("$_->{net}" eq "$netname")
{
$gateway = $_->{gateway};
last;
}
}
return $gateway;
}
#-------------------------------------------------------------------------------
=head3 getNodeNetworkCfg
@ -2007,17 +2054,23 @@ sub isIpaddr
sub getNodeNetworkCfg
{
my $node = shift;
if( $node =~ /xCAT::NetworkUtils/)
{
$node =shift;
}
my $nets = xCAT::NetworkUtils::my_nets();
my $ip = xCAT::NetworkUtils->getipaddr($node);
my $mask = undef;
my $gateway = undef;
for my $net (keys %$nets)
{
my $netname;
($netname,$mask) = split /\//, $net;
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
}
#-------------------------------------------------------------------------------

4
perl-xCAT/xCAT/TableUtils.pm Normal file → Executable file
View File

@ -1177,7 +1177,9 @@ sub getAppStatus
my ($class, $nodes_ref, $application) = @_;
my @nodes = @$nodes_ref;
my $nltab = xCAT::Table->new('nodelist');
# FIXME: why autocommit matters for a read-only subroutine getNodesAttribs?
# but could not get the appstatus without the autocommit=0
my $nltab = xCAT::Table->new('nodelist', -autocommit => 0);
my $nodeappstat = $nltab->getNodesAttribs(\@nodes,['appstatus']);
my $ret_nodeappstat;

View File

@ -222,7 +222,7 @@ my %usage = (
lsvm <noderange> [-a|--all]
PPC (using Direct FSP Management) specific:
lsvm <noderange> [-l|--long] --p775
lsvm <noderange> [--updatedb]
lsvm <noderange>
zVM specific:
lsvm noderange
lsvm noderange --getnetworknames

File diff suppressed because it is too large Load Diff

View File

@ -122,6 +122,7 @@ sub new {
unless ($ipmi2support) {
$self->{ipmi15only} = 1;
}
$self->{privlevel} = 4;
unless ($args{'bmc'} and defined $args{'userid'} and defined $args{'password'}) {
$self->{error}="bmc, userid, and password must be specified";
return $self;
@ -309,7 +310,7 @@ sub session_activated {
sub set_admin_level {
my $self= shift;
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[4],callback=>\&admin_level_set,callback_args=>$self);
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[$self->{privlevel}],callback=>\&admin_level_set,callback_args=>$self);
}
sub admin_level_set {
my $rsp = shift;
@ -687,7 +688,7 @@ sub send_rakp3 {
$self->{rmcptag}+=1;
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
my @user = unpack("C*",$self->{userid});
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},$self->{privlevel},scalar @user,@user),$self->{password}));
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
}
@ -701,7 +702,7 @@ sub send_rakp1 {
push @{$self->{randomnumber}},$randomnumber;
}
push @payload, @{$self->{randomnumber}};
push @payload,(4,0,0); # request admin
push @payload,($self->{privlevel},0,0); # request priv
my @user = unpack("C*",$self->{userid});
push @payload,scalar @user;
push @payload,@user;
@ -817,6 +818,13 @@ sub got_rakp2 {
}
$byte = shift @data;
unless ($byte == 0x00) {
if ($byte == 0x9 and $self->{privlevel} == 4) {
# this is probably an environment that wants to give us only operator
# try to connect again at 3.
$self->{privlevel} = 3;
$self->relog();
return;
}
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
#$self->relog();
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
@ -841,7 +849,7 @@ sub got_rakp2 {
#Data now represents authcode.. sha1 only..
my @user = unpack("C*",$self->{userid});
my $ulength = scalar @user;
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},$self->{privlevel},$ulength,@user));
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
foreach (0..(scalar(@expectedhash)-1)) {
if ($expectedhash[$_] != $data[$_]) {
@ -850,7 +858,7 @@ sub got_rakp2 {
return 9;
}
}
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},4,$ulength,@user),$self->{password});
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},$self->{privlevel},$ulength,@user),$self->{password});
$self->{k1} = hmac_sha1(pack("C*",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),$self->{sik});
$self->{k2} = hmac_sha1(pack("C*",2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2),$self->{sik});
my @aeskey = unpack("C*",$self->{k2});

View File

@ -14,6 +14,7 @@ use xCAT::ADUtils; #to allow setting of one-time machine passwords
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use XML::Simple;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
@ -103,6 +104,13 @@ sub subvars {
$ENV{NODESTATUS}=$tmp;
}
my @managedaddressmode = xCAT::TableUtils->get_site_attribute("managedaddressmode");
my $tmp=$managedaddressmode[0];
if( defined($tmp) ){
$ENV{MANAGEDADDRESSMODE}=$tmp;
}
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@ -229,6 +237,7 @@ sub subvars {
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
$inc =~ s/#YAST2NET#/yast2network()/eg;
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
@ -652,8 +661,8 @@ sub esxipv6setup {
}
sub kickstartnetwork {
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $line = "network --onboot=yes --bootproto=";
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
@ -667,12 +676,241 @@ sub kickstartnetwork {
$hoststab->setNodeAttribs($node,{ip=>$ulaaddr});
$line .= $ulaaddr;
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
return "#KSNET static unsupported";
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
$line .="static --device=$suffix --ip=$ipaddr --netmask=$netmask --gateway=$gateway --hostname=$hostname ";
my $nrtab = xCAT::Table->new('noderes',-create=>0);
unless ($nrtab) { die "noderes table should always exist prior to template processing"; }
my $ent = $nrtab->getNodeAttribs($node,['nameservers'],prefetchcache=>1);
unless ($ent and $ent->{nameservers}) { die "attribute nameservers not set for $node"; }
my @nameserverARR=split (",",$ent->{nameservers});
my @nameserversIP;
foreach (@nameserverARR)
{
my ($host,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
push @nameserversIP, $ip;
}
if (scalar @nameserversIP) {
$line .=" --nameserver=". join(",",@nameserversIP);
}
#return "#KSNET static unsupported";
} else {
$line .= "dhcp --device=$suffix";
}
return $line;
}
sub yast2network {
my $line;
my $hoststab;
my $mactab = xCAT::Table->new('mac',-create=>0);
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
unless ($ent and $ent->{mac}) { die "missing mac data for $node"; }
my $suffix = $ent->{mac};
$suffix = lc($suffix);
if ($::XCATSITEVALS{managedaddressmode} eq "autoula") {
#TODO
return "#YAST2NET autoula unsupported"
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
my $nrtab = xCAT::Table->new('noderes',-create=>0);
unless ($nrtab) { die "noderes table should always exist prior to template processing"; }
my $ent = $nrtab->getNodeAttribs($node,['nameservers'],prefetchcache=>1);
unless ($ent and $ent->{nameservers}) { die "attribute nameservers not set for $node"; }
my @nameserverARR=split (",",$ent->{nameservers});
my @nameserversIP;
foreach (@nameserverARR)
{
my ($host,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
push @nameserversIP, $ip;
}
# get the domains for each node - one call for all nodes in hosts file
my $nd = xCAT::NetworkUtils->getNodeDomains([$node]);
my %nodedomains = %$nd;
my $domain=$nodedomains{$node};
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
"$domain"
],
'dhcp_hostname' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'dhcp_resolv' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'nameservers' => [
{
'config:type' => 'list',
'nameserver' => @nameserversIP
}
],
'hostname' => [
$hostname
],
'searchlist' => [
{
'search' => [
$domain
],
'config:type' => 'list'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'bootproto' => [
'static'
],
'startmode' => [
'onboot'
],
'netmask' => [
$netmask
],
'device' => [
'eth0'
],
'ipaddr' => [
$ipaddr
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'route' => [
{
'destination' => [
'default'
],
'gateway' => [
$gateway
],
'netmask' => [
'-'
],
'device' => [
'-'
]
}
],
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
#return "#KSNET static unsupported";
} else {
my $networkhash={
'networking' => [
{
'dns' => [
{
'domain' => [
'local'
],
'dhcp_hostname' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
],
'hostname' => [
'linux'
],
'dhcp_resolv' => [
{
'content' => 'true',
'config:type' => 'boolean'
}
]
}
],
'interfaces' => [
{
'interface' => [
{
'startmode' => [
'onboot'
],
'bootproto' => [
'dhcp'
],
'device' => [
'eth0'
]
}
],
'config:type' => 'list'
}
],
'routing' => [
{
'ip_forward' => [
{
'content' => 'false',
'config:type' => 'boolean'
}
],
'routes' => [
{
'config:type' => 'list'
}
]
}
]
}
]
};
my $xml = new XML::Simple(KeepRoot => 1);
$line=$xml->XMLout($networkhash);
}
return $line;
}
sub autoulaaddress {
my $suffix = shift;
my $prefix = $::XCATSITEVALS{autoulaprefix};

View File

@ -1381,18 +1381,22 @@ sub mkinstall
$instserver=$ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($instserver);
$instserver=$ip;
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline;
if ($pkvm) {
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
} else {
$kcmdline =
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
$kcmdline ="quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
. $instserver . ":". $httpport
. "/install/autoinst/"
. $node;
@ -1446,6 +1450,30 @@ sub mkinstall
unless ($ksdev eq "bootif" and $os =~ /7/) {
$kcmdline .= " ksdevice=" . $ksdev;
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
$kcmdline .=" ip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my $nrtab = xCAT::Table->new('noderes',-create=>0);
unless ($nrtab) { die "noderes table should always exist prior to template processing"; }
my $ent = $nrtab->getNodeAttribs($node,['nameservers'],prefetchcache=>1);
unless ($ent and $ent->{nameservers}) { die "attribute nameservers not set for $node"; }
my @nameserverARR=split (",",$ent->{nameservers});
my @nameserversIP;
foreach (@nameserverARR)
{
my ($host,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport}))

View File

@ -412,13 +412,13 @@ sub create_imgconf_file {
my $rootpw = undef;
my $passwdtab = xCAT::Table->new('passwd');
if ($passwdtab) {
my $et = $passwdtab->getAttribs({key => 'system', username => 'root'}, 'password');
my $et = $passwdtab->getAttribs({key => 'vios', username => 'padmin'}, 'password');
if ($et and defined ($et->{'password'})) {
$rootpw = $et->{'password'};
}
}
unless (defined($rootpw)) {
return "Unable to find requested password from passwd, with key=system,username=root";
return "Unable to find requested password from passwd, with key=vios,username=padmin";
}
unless (-e $bootimg_root."/viobootimg") {
return "Unable to find VIOS bootimg file";

35
xCAT-server/lib/xcat/plugins/sles.pm Normal file → Executable file
View File

@ -956,6 +956,8 @@ sub mkinstall
my $tmppkgdir=$pkgdir;
my @srcdirs = split(",", $pkgdir);
$pkgdir = $srcdirs[0];
# trim the "/" in /install/sles11.3/x86_64/
$pkgdir =~ s/\/$//;
if( $pkgdir =~/^($installroot\/$os\/$arch)$/) {
$srcdirs[0]="$pkgdir/1";
$tmppkgdir=join(",", @srcdirs);
@ -1072,6 +1074,13 @@ sub mkinstall
{
$netserver = $ent->{nfsserver};
}
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($netserver);
$netserver=$ip;
}
my $httpprefix = $pkgdir;
if ($installroot =~ /\/$/) { #must prepend /install/
$httpprefix =~ s/^$installroot/\/install\//;
@ -1136,6 +1145,32 @@ sub mkinstall
$kcmdline .= " dud=file:/cus_driverdisk/$_";
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
$kcmdline .=" hostip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
my $nrtab = xCAT::Table->new('noderes',-create=>0);
unless ($nrtab) { die "noderes table should always exist prior to template processing"; }
my $ent = $nrtab->getNodeAttribs($node,['nameservers'],prefetchcache=>1);
unless ($ent and $ent->{nameservers}) { die "attribute nameservers not set for $node"; }
my @nameserverARR=split (",",$ent->{nameservers});
my @nameserversIP;
foreach (@nameserverARR)
{
my ($host,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
push @nameserversIP, $ip;
}
if(scalar @nameserversIP){
$kcmdline .=" dns=".join(",",@nameserversIP);
}
}
if (defined $sent->{serialport})
{
unless ($sent->{serialspeed})

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
#
lang en_US
network --bootproto dhcp
#network --bootproto dhcp
#KICKSTARTNET#
#
# Where's the source?

View File

@ -1,6 +1,10 @@
#!/bin/sh
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
cd /etc/sysconfig/network
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
rm -f ifcfg-eth-id*
rm -f ifcfg-myri*
cat >ifcfg-eth0 <<EOF
@ -8,7 +12,7 @@ DEVICE=eth0
BOOTPROTO=dhcp
STARTMODE=onboot
EOF
fi
. /tmp/prinicsetting
rm /tmp/prinicsetting
if [ "$PRINIC" != "eth0" ]
@ -22,7 +26,12 @@ then
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
fi
if [ "$MANAGEDADDRESSMODE" != "static" ]
then
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
/etc/init.d/network restart

View File

@ -219,7 +219,10 @@ if [ `uname -m` = "ppc64" ]; then
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning
fi
if [ -d /sys/firmware/efi ]; then
echo 'bootloader --driveorder='$instdisk >> /tmp/partitioning
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype vfat' >> /tmp/partitioning
else
echo 'bootloader' >> /tmp/partitioning
fi
#TODO: ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. at least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen...

View File

@ -63,25 +63,7 @@
<surname/>
</user>
</users>
<networking>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
<domain>local</domain>
<hostname>linux</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list"/>
</routing>
</networking>
#YAST2NET#
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#

View File

@ -46,7 +46,7 @@ fi
# remove user from index
index=`grep $CNA /etc/xcat/ca/index | cut -f4 2>&1`
for id in $index; do
openssl ca -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
openssl ca -startdate 19600101010101Z -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
done
mkdir -p $USERHOME/.xcat
cd $USERHOME/.xcat
@ -60,7 +60,7 @@ cd $XCATDIR/ca
# - seems to be a problem with the use of the wildcard in the Makefile
# - calling cmds directly instead - should be safe
# make sign
openssl ca -config openssl.cnf -in root.csr -out root.cert
openssl ca -startdate 19600101010101Z -config openssl.cnf -in root.csr -out root.cert
if [ -f root.cert ]; then
rm root.csr
fi

View File

@ -33,7 +33,7 @@ cd $XCATDIR/ca
# - call cmds directly instead - seems safe
# make sign
openssl ca -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
openssl ca -startdate 19600101010101Z -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
if [ -f `hostname`.cert ]; then
rm `hostname`.csr
fi

View File

@ -30,5 +30,9 @@ sed -e "s@##XCATCADIR##@$XCATCADIR@" $XCATROOT/share/xcat/ca/openssl.cnf.tmpl >
cp $XCATROOT/share/xcat/ca/Makefile $XCATCADIR/
cd $XCATCADIR
make init
openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
#openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
openssl genrsa -out private/ca-key.pem 2048
chmod 600 private/ca-key.pem
openssl req -new -key private/ca-key.pem -config openssl.cnf -out ca-req.csr -subj /CN="$CNA" -outform PEM
openssl ca -selfsign -keyfile private/ca-key.pem -in ca-req.csr -startdate 19700101010101Z -days 7305 -extensions v3_ca -config openssl.cnf -out ca-cert.pem
cd -

View File

@ -267,7 +267,7 @@ sub init
system("xdsh $MN mkdir -p /iso/mountpoint");
print "--prepareing redhat iso file.......\n";
print "--mount NF .......";
system ("scp -r /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso $MNIP:/iso");
system ("scp -r /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso $MN:/iso");
system("xdsh $MN mount -o loop /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso /iso/mountpoint");
&runcmd("echo 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4>/etc/hosts.rhppc64");
&runcmd( " echo $HMCIP $HMC.$DOMAIN $HMC>>/etc/hosts.rhppc64");
@ -283,18 +283,22 @@ sub init
system("xdsh $MN rm -rf /etc/yum.repos.d/*");
$res = system("scp -r $nodedir/xcat-dep $MN:/");
system("scp -r /etc/yum.repos.d/rhel6.4.repo $MN:/etc/yum.repos.d/rhel6.4.repo"); ######## redhat 6.4
system("scp -r default.conf $MN:$rhppc64configfile");
# system("scp -r default.conf $MN:$rhppc64configfile");
# system("xdsh $MN perl $nodedir/xcatbuild/xcat-core/mklocalrepo.sh");
system("xdsh $MN perl $nodedir/xcatbuild/xcat-dep/rh6/ppc64/mklocalrepo.sh");
system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh");
print "--install XCAT .......\n";
system("xdsh $MN yum -y install createrepo");
system("xdsh $MN createrepo /xcat-core/build");
system("xdsh $MN cp /xcat-core/build/xCAT-core.repo /etc/yum.repos.d/");
system("xdsh $MN yum clean metadata");
system("xdsh $MN rpm --import /iso/mountpoint/RPM-GPG-KEY-redhat-release");
system("xdsh $MN yum -y install xCAT");
system("xdsh $MN yum -y install perl-xCAT xCAT-client xCAT-server xCAT");
print "--install XCATTEST .......\n";
system("xdsh $MN yum -y install xCAT-test");
print "--install createrepo .......\n";
system("xdsh $MN yum -y install createrepo");
# system("xdsh $MN yum -y install createrepo");
system("xdsh $MN yum -y install screen");
system("xdsh $MN yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc");
system("xdsh $MN mkdir -p /autotest/result");
@ -320,6 +324,9 @@ sub do_test
{
my $MN=$rhppc64config{var}{MN};
my $nodedir=$rhppc64config{var}{nodedir};
print "copy config file ";
system("scp -r default.conf $MN:$rhppc64configfile");
print "Start to run diskless installation ...\n";
send_msg("******************************");
send_msg("start diskless test");
@ -327,6 +334,8 @@ print "Start to run diskless installation ...\n";
#if($dsklsinst){
system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_diskless_installation");
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
exit 1;
#}
#if($bundlerun){
print "Start to run the automation test bucket ....\n";
@ -574,12 +583,13 @@ if ($needhelp)
#######################################
# step 1. Read configuration files
#######################################
$confile = $configfile;
my %confhash = read_conf();
unless (%confhash) {
send_msg(" returns error, exit");
exit;
}
send_msg("finish reading global variable");
#######################################
# step 2. git update
@ -590,11 +600,12 @@ my $gitup;
$gitup="/tmp/gitup";
#Do checkout in git repo
$res = system("cd $confkeys{srcdir}");
if ($res !=0) {
send_msg("no source code directory,exit");
exit;
}
#$res = system("cd $confkeys{srcdir}");
#if ($res !=0) {
# send_msg("no source code directory,exit");
#
# exit;
#}
$res = system("git checkout $branch");
if ($res != 0){
@ -627,20 +638,24 @@ if (($res == 0)&&( $updates_regression == 1)) {
#######################################
# step 4. Copy code to MNs
#######################################
##will modify to $confkeys{srcdir};
my $codedir = "/regression/code";
my $codedir = $confhash{srcdir};
send_msg("src code directory is $confhash{srcdir}");
##will modify to $rhppc64config{var}{MNIP}
my $mn="aixmn";
my $mn = $management_node;
send_msg("mn is $mn");
#install dep for buildlocal
send_msg("begin to install build required packages on mn");
$res = system("xdsh $mn yum install -y rpm-build perl-Time-HiRes perl-DBI createrepo");
#need to copy /etc/hosts to mn
send_msg("copy /etc/hosts to mn");
system("scp /etc/hosts $mn:/etc");
system("echo begin copy code");
$res = system("scp -r root\@$mn:/");
send_msg("begin to copy code");
$res = system("scp -r $codedir root\@$mn:/");
if ($res != 0){
send_msg("code copy failed");
exit 1;
@ -651,21 +666,23 @@ if ($res != 0){
# step 5. Build xcat code in MNs
#######################################
#for temp usage
system("echo began build xcat on mn");
send_msg("========= began build xcat on mn ========");
#will changed /code/xcat-core to $confkeys{srcdir}
$res = system("xdsh $mn /code/xcat-core/buildlocal.sh CURDIR=/code/xcat-core");
$res = system("xdsh $mn /xcat-core/buildlocal.sh CURDIR=/xcat-core");
if ($res != 0){
send_msg("build failed on mn");
exit 1;
}
system("echo build done");
send_msg("====================build done============================");
sleep 20;
#######################################
# step 6. Read xCAT MN's configuration
#######################################
send_msg("begin read configuration file for mn");
mkdir $resultdir unless -d $resultdir;
$timestamp = `date +"%Y%m%d%H%M%S"`;
my @osname = &runcmd("uname -a");
@ -681,17 +698,21 @@ if ($res) {
}
#}
send_msg("step 6 : reading mn configuration done=====");
#######################################
# step 7. Genrate local configuration file for xcattest
# Do test
# Write log
#######################################
# step 7.1 Install xcat and init mn
send_msg("began to install xCAT and initialize mn");
$res = &init;
if ($res != 0){
exit;
}
$res = &do_test;
if ($res) {
send_msg("DO TEST returns error, exit");