Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
dd90516371
File diff suppressed because it is too large
Load Diff
@ -38,8 +38,6 @@ if (scalar(@ARGV)>1) { $usage->(1); }
|
||||
my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
|
||||
#my $api_username = 'SL276540';
|
||||
#my $api_key = '799d5d9267a927a330ec016f00bfe17e6fc532d203cf68b3b0d997b2d27a3ce1';
|
||||
|
||||
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
|
||||
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
|
||||
@ -64,12 +62,23 @@ foreach my $server (@$servers) {
|
||||
print "\tbmc=".$server->{remoteManagementComponent}->{ipmiIpAddress}."\n";
|
||||
print "\tbmcusername=".$server->{remoteManagementAccounts}->[0]->{username}."\n";
|
||||
print "\tbmcpassword=".$server->{remoteManagementAccounts}->[0]->{password}."\n";
|
||||
print "\tmac=".$server->{backendNetworkComponents}->[0]->{macAddress}."\n";
|
||||
print "\tip=".$server->{privateIpAddress}."\n";
|
||||
|
||||
# find the 1st active private nic that is not the bmc
|
||||
foreach my $nic (@{$server->{backendNetworkComponents}}) {
|
||||
#print "nic:\n"; foreach my $key (keys(%$nic)) { print " $key = ", $nic->{$key}, "\n"; }
|
||||
if ($nic->{status} eq 'ACTIVE' && $nic->{name} eq 'eth' && $nic->{macAddress} && $nic->{primaryIpAddress}) {
|
||||
# found it
|
||||
print "\tmac=".$nic->{macAddress}."\n";
|
||||
print "\tip=".$nic->{primaryIpAddress}."\n";
|
||||
}
|
||||
}
|
||||
#print "\tip=".$server->{privateIpAddress}."\n"; # getting this from the backendNetworkComponents instead
|
||||
print "\tserial=".$server->{manufacturerSerialNumber}."\n";
|
||||
print "\tnetboot=xnba\n";
|
||||
print "\tarch=x86_64\n";
|
||||
print "\tusercomment=hostname:".$server->{fullyQualifiedDomainName}.", user:".$server->{operatingSystem}->{passwords}->[0]->{username}.", pw:".$server->{operatingSystem}->{passwords}->[0]->{password}."\n";
|
||||
|
||||
verbose('SoftLayer API bare metal server entry: ' . Dumper($server));
|
||||
#print Dumper($server->{remoteManagementAccounts});
|
||||
#print "#Softlayer_account_info_for ".$server->{fullyQualifiedDomainName} . " Username: ";
|
||||
#print $server->{operatingSystem}->{passwords}->[0]->{username} . " Password: ";
|
||||
|
@ -60,13 +60,20 @@ sub addKernelParms {
|
||||
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
|
||||
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $gateway) = getNodeIpInfo($args);
|
||||
my ($nic, $ip, $netmask, $gateway, $mac) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
$args->{kernelparms} .= " hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
# if we are booting genesis, need to add the BOOTIF parm
|
||||
my $bootif;
|
||||
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
|
||||
$bootif = $mac;
|
||||
$bootif =~ s/:/-/g;
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
}
|
||||
|
||||
|
||||
# get this nodes nic, ip, netmask, and gateway. Returns them in a 4 element array.
|
||||
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
|
||||
sub getNodeIpInfo {
|
||||
my $args = shift @_;
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
|
||||
@ -74,10 +81,11 @@ sub getNodeIpInfo {
|
||||
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic and ip
|
||||
my @output = runcmd("ip addr show");
|
||||
my ($nic, $ipandmask);
|
||||
my ($nic, $mac, $ipandmask);
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $iptmp);
|
||||
my ($nictmp, $mactmp, $iptmp);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): /) { $nic = $nictmp; } # new stanza, remember it
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
|
||||
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
|
||||
}
|
||||
my ($ip, $netmask) = convertIpAndMask($ipandmask);
|
||||
@ -88,6 +96,12 @@ sub getNodeIpInfo {
|
||||
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
|
||||
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
|
||||
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
|
||||
# go back thru the ip add show output and find the mac of this nic
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $foundnic);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
|
||||
}
|
||||
}
|
||||
|
||||
# finally, find the gateway
|
||||
@ -102,8 +116,8 @@ sub getNodeIpInfo {
|
||||
verbose("using xCAT mgmt node IP as the fall back gateway.");
|
||||
}
|
||||
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway");
|
||||
return ($realnic, $ip, $netmask, $gateway);
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway, mac=$mac");
|
||||
return ($realnic, $ip, $netmask, $gateway, $mac);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ copyFilesToNodes($noderange, \%bootparms);
|
||||
|
||||
updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
exit(0);
|
||||
|
||||
@ -54,23 +54,28 @@ exit(0);
|
||||
sub getBootParms {
|
||||
my $nr = shift @_;
|
||||
my %bootparms;
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline");
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod");
|
||||
|
||||
# the attributes can be displayed in a different order than requested, so need to grep for them
|
||||
my @gresults;
|
||||
foreach my $a (qw(kernel initrd kcmdline)) {
|
||||
my $attr = "bootparams.$a";
|
||||
@gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
foreach my $attr (qw(bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod)) {
|
||||
my ($a) = $attr =~ m/\.(.*)$/;
|
||||
my @gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
if (!scalar(@gresults)) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
|
||||
chomp($gresults[0]);
|
||||
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
|
||||
$bootparms{$a} = $gresults[0];
|
||||
if ($a eq 'kcmdline') { $bootparms{$a} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|; }
|
||||
}
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
|
||||
# get the mgmt node cluster-facing ip addr
|
||||
@output = runcmd('lsdef -t site -i master -c');
|
||||
@output = runcmd('lsdef -t site -ci master');
|
||||
chomp($output[0]);
|
||||
my ($junk, $ip) = split(/=/, $output[0]);
|
||||
$bootparms{mnip} = $ip;
|
||||
@ -99,7 +104,7 @@ sub copyFilesToNodes {
|
||||
# Form the remote file name, using the last 2 parts of the path, separated by "-"
|
||||
sub remoteFilename {
|
||||
my $f = shift @_;
|
||||
$f =~ s|^.*/([^/]+)/([^/]+)$|$1-$2|;
|
||||
$f =~ s|^.*?([^/]+)/([^/]+)$|$1-$2|;
|
||||
return $f;
|
||||
}
|
||||
|
||||
|
@ -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};
|
||||
|
@ -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}))
|
||||
|
35
xCAT-server/lib/xcat/plugins/sles.pm
Normal file → Executable file
35
xCAT-server/lib/xcat/plugins/sles.pm
Normal file → Executable 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})
|
||||
|
@ -14,6 +14,7 @@ use xCAT::Schema;
|
||||
use Data::Dumper;
|
||||
use xCAT::Utils;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::Scope;
|
||||
use xCAT::Usage;
|
||||
use Storable qw(dclone);
|
||||
use xCAT::TableUtils;
|
||||
@ -188,6 +189,7 @@ sub preprocess_updatenode
|
||||
my @requests = ();
|
||||
|
||||
my $installdir = xCAT::TableUtils->getInstallDir();
|
||||
my $localhost = hostname();
|
||||
|
||||
# subroutine to display the usage
|
||||
sub updatenode_usage
|
||||
@ -252,6 +254,59 @@ sub preprocess_updatenode
|
||||
return;
|
||||
}
|
||||
|
||||
# preprocess generate mypostscripts files (-g) for hierarchy
|
||||
# if no sharedtftp then we need to broadcast this updatenode -g to all service nodes inorder
|
||||
# to be able to support service node pools
|
||||
#
|
||||
if ($::GENMYPOST)
|
||||
{
|
||||
# precreatemypostscript has to be yes/1 or do nothing
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
|
||||
if ($entries[0] ) {
|
||||
$entries[0] =~ tr/a-z/A-Z/;
|
||||
if ($entries[0] =~ /^(1|YES)$/ ) {
|
||||
# now check if sharedtftp = 0, if it is we need to broadcast to all the servicenode
|
||||
# if there are service nodes
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
|
||||
# see if there are any servicenodes. If so then run updatenode -g on all of them
|
||||
my @SN;
|
||||
my @CN;
|
||||
my $nodes = $request->{node};
|
||||
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
|
||||
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
|
||||
return xCAT::Scope->get_broadcast_scope($request,@_);
|
||||
}
|
||||
} else { # sharedtftp=yes, just run on MN
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files on $localhost";
|
||||
$callback->($rsp);
|
||||
return 0;
|
||||
}
|
||||
} else { # not valid unless precreatemypostscripts enabled
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
|
||||
$rsp->{errorcode}->[0] =1;
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
} else { # precreatemypostscripts not in the site table
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
|
||||
$rsp->{errorcode}->[0] =1;
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
} # end GENMYPOST
|
||||
|
||||
|
||||
|
||||
# -c must work with -S for AIX node
|
||||
if ($::CMDLINE && !$::SWMAINTENANCE)
|
||||
{
|
||||
@ -1045,7 +1100,7 @@ sub updatenode
|
||||
my $nofiles=0;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files";
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files on $localhostname";
|
||||
$callback->($rsp);
|
||||
} else { # not valid unless precreatemypostscripts enabled
|
||||
my $rsp = {};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,8 @@
|
||||
#
|
||||
|
||||
lang en_US
|
||||
network --bootproto dhcp
|
||||
#network --bootproto dhcp
|
||||
#KICKSTARTNET#
|
||||
|
||||
#
|
||||
# Where's the source?
|
||||
|
@ -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
|
||||
|
||||
|
@ -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#
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user