2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-13 18:04:15 +00:00

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

This commit is contained in:
litingt
2015-02-11 19:55:52 -08:00
16 changed files with 365 additions and 409 deletions
+100
View File
@@ -2428,6 +2428,106 @@ sub get_all_nicips{
}
}
#-------------------------------------------------------------------------------
=head3 gen_net_boot_params
Description:
This subroutine is used to generate all possible kernel parameters for network boot (rh/sles/ubuntu + diskfull/diskless)
The supported network boot parameters:
ksdevice - Specify network device for Anaconda. For rh6 and earlier. Format: 'ksdevice={$mac|$nicname}'
BOOTIF - Specify network device for Anaconda. The boot device which set by pxe. xCAT also set it if the bootload is not pxe. Format 'BOOTIF={$mac}'
ifname - Specify a interfacename<->mac pair, it will set the interfacename to the interface which has the <mac>. Format 'ifname=$ifname:$mac'
# This will only be generated when linuximage.nodebootif is set.
bootdev - Specify the boot device. Mostly it's used with <ip> parameter and when there are multiple <ip> params. Format 'bootdev={$mac|$ifname}
ip - Specify the network configuration for an interface. Format: 'ip=dhcp', 'ip=$ifname:dhcp'
netdevice - Specify network device for Linuxrc (Suse bootloader). Format: 'netdevice={$mac|$nicname}'
netdev - Specify the interfacename which is used by xCAT diskless boot script to select the network interface. Format: 'netdev=$nicname'
Reference:
Redhat anaconda doc: https://github.com/rhinstaller/anaconda/blob/master/docs/boot-options.txt
Suse Linuxrc do: https://en.opensuse.org/SDB:Linuxrc
Arguments:
$installnic <- node.installnic
$primarynic <- node.primarynic
$macmac <- node.mac
$nodebootif <- linuximage.nodebootif
Returns:
$net_params - The key will be the parameter name, the value for the key will be the parameter value.
Valid Parameter Name:
ksdevice
netdev
netdevice
ip
ifname
BOOTIF
And following two keys also will be returned for reference
mac
nicname
Example:
my $netparams = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primmarynic, $macmac, $nodebootif);
=cut
#-------------------------------------------------------------------------------
sub gen_net_boot_params
{
my $class = shift;
my $installnic = shift;
my $primarynic = shift;
my $macmac = shift;
my $nodebootif = shift;
my $net_params;
# arbitrary use primarynic if installnic is not set
unless ($installnic) {
$installnic = $primarynic;
}
# just use the installnic to generate the nic related kernel parameters
my $mac;
my $nicname;
if ((! defined ($installnic)) || ($installnic eq "") || ($installnic =~ /^mac$/i)) {
$mac = $macmac;
$net_params->{mac} = $mac;
} elsif ($installnic =~ /^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/) {
$mac = $installnic;
$net_params->{mac} = $mac;
$net_params->{setmac} = $mac;
} else {
$mac = $macmac;
$nicname = $installnic;
$net_params->{nicname} = $nicname;
$net_params->{mac} = $mac;
}
if ($nicname) {
$net_params->{ksdevice} = "ksdevice=$nicname";
$net_params->{ip} = "ip=$nicname:dhcp";
$net_params->{netdev} = "netdev=$nicname";
$net_params->{netdevice} = "netdevice=$nicname";
$net_params->{ifname} = "ifname=$nodebootif:$mac";
} elsif ($mac) {
$net_params->{ksdevice} = "ksdevice=$mac";
$net_params->{BOOTIF} = "BOOTIF=$mac";
$net_params->{bootdev} = "bootdev=$mac";
$net_params->{ip} = "ip=dhcp";
if ($nodebootif) {
$net_params->{ifname} = "ifname=$nodebootif:$mac";
}
$net_params->{netdevice} = "netdevice=$mac";
}
return $net_params;
}
1;
+25 -22
View File
@@ -4468,29 +4468,32 @@ sub cleanup_for_powerLE_hardware_discovery {
#This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1").
sub parseMacTabEntry{
my $macString=shift;
if( $macString =~ /xCAT::Utils/)
{
$macString=shift;
my $macString=shift;
if( $macString =~ /xCAT::Utils/) {
$macString=shift;
}
my $HostName=shift;
my $mac_ret;
my @macEntry=split(/\|/,$macString);
foreach my $mac_t (@macEntry){
if($mac_t =~ /!/){
if($mac_t =~ /(.+)!$HostName$/){
$mac_ret=$1;
}
}else{
$mac_ret=$mac_t;
}
}
}
my $HostName=shift;
my $mac_ret;
my @macEntry=split(/\|/,$macString);
foreach my $mac_t (@macEntry){
if($mac_t =~ /!/){
if($mac_t =~ /(.+)!$HostName$/){
$mac_ret=$1;
}
}else{
$mac_ret=$mac_t;
}
}
return $mac_ret;
if ($mac_ret) {
if ($mac_ret !~ /:/) {
$mac_ret =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
}
return $mac_ret;
}
@@ -0,0 +1,2 @@
#!/bin/bash
exec /opt/xcat/share/xcat/cons/kvm $CONFLUENT_NODE
+72 -218
View File
@@ -745,81 +745,32 @@ sub mknetboot
$kcmdline .= " nonodestatus ";
}
# add one parameter: ifname=<eth0>:<mac address>
# which is used for dracut
# the redhat5.x os will ignore it
my $useifname=0;
#for rhels5.x-ppc64, if installnic="mac", BOOTIF=<mac> should be appended
my $usemac=0;
my $nicname="";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$useifname=1;
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
$nicname=$reshash->{$node}->[0]->{installnic};
} elsif ($nodebootif) {
$useifname=1;
#$kcmdline .= "ifname=$nodebootif:";
$nicname=$nodebootif;
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$useifname=1;
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
$nicname=$reshash->{$node}->[0]->{primarynic};
}else{
if($arch=~ /ppc/)
{
$usemac=1;
}
}
#else { #no, we autodetect and don't presume anything
# $kcmdline .="eth0:";
# print "eth0 is used as the default booting network devices...\n";
#}
# append the mac address
# Add kernel parameters to specify the boot network interface
my $installnic;
my $primarynic;
my $mac;
if( ($usemac || $useifname) && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
# TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used
$mac = $machash->{$node}->[0]->{'mac'};
# if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
#convert to linux format
if ($mac !~ /:/) {
$mac =~s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
$mac =~ s/!.*//; #remove multi-interface mac information
$mac =~ s/\|.*//;
# } else {
# $callback->({ error=>[ qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset <nr> netboot|statelite if installnic/primarynic is set".}], errorcode=>[1]});
# return;
# }
if (defined ($reshash->{$node}->[0]) && $reshash->{$node}->[0]->{installnic}) {
$installnic = $reshash->{$node}->[0]->{installnic};
}
if( ($nicname ne "") and (not xCAT::NetworkUtils->isValidMAC($nicname) )){
if ($useifname && $mac) {
$kcmdline .= "ifname=$nicname:$mac ";
}
$kcmdline .= "netdev=$nicname ";
}else {
if($mac){
$kcmdline .= "BOOTIF=$mac ";
}
if (defined ($reshash->{$node}->[0]) and $reshash->{$node}->[0]->{primarynic}) {
$primarynic = $reshash->{$node}->[0]->{primarynic};
}
if (defined ($machash->{$node}->[0]) && $machash->{$node}->[0]->{'mac'}) {
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{'mac'}, $node);
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
#my $netdev = "";
#if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
#} elsif ($nodebootif) {
# $kcmdline .= "netdev=" . $nodebootif . " ";
#} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
#} else {
# if ( ($usemac || $useifname) && $mac) {
# $kcmdline .= "BOOTIF=" . $mac . " ";
# }
#}
if (defined ($net_params->{ifname}) || defined ($net_params->{netdev})) {
if (defined ($net_params->{ifname})) {
$kcmdline .= "$net_params->{ifname} ";
}
if ( defined ($net_params->{netdev})) {
$kcmdline .= "$net_params->{netdev} ";
}
} elsif (defined ($net_params->{BOOTIF}) && ($net_params->{setmac} || $arch=~ /ppc/)) {
$kcmdline .= "$net_params->{BOOTIF} ";
}
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
if ( $client_nethash{$node}{mgtifname} =~ /hf/ )
@@ -998,13 +949,13 @@ sub mkinstall
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
my %rents = %{$restab->getNodesAttribs(\@nodes,
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
my %hents = %{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
#my $addkcmdhash =
# $bptab->getNodesAttribs(\@nodes, ['addkcmdline']);
require xCAT::Template;
@@ -1388,15 +1339,8 @@ sub mkinstall
#We have a shot...
my $ent = $rents{$node}->[0];
# $restab->getNodeAttribs($node,
# ['nfsserver', 'primarynic', 'installnic']);
my $sent = $hents{$node}->[0];
# $hmtab->getNodeAttribs(
# $node,
# [
# 'serialport', 'serialspeed', 'serialflow'
# ]
# );
my $macent = $macents{$node}->[0];
my $instserver = $xcatmaster;
if ($ent and $ent->{nfsserver}) {
$instserver=$ent->{nfsserver};
@@ -1408,15 +1352,15 @@ sub mkinstall
$instserver=$ip;
}
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline;
my $kversion=$os;
$kversion =~ s/^\D*([\.0-9]+)/$1/;
$kversion =~ s/\.$//;
@@ -1440,63 +1384,27 @@ sub mkinstall
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
my $ksdev = "";
if ($ent->{installnic})
{
if ($ent->{installnic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{installnic};
}
}
elsif ($ent->{primarynic})
{
if ($ent->{primarynic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{primarynic};
}
}
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
}
if ($ksdev eq "")
{
$callback->(
{
error => ["No MAC address defined for " . $node],
errorcode => [1]
}
);
}
if($esxi){
$ksdev =~ s/eth/vmnic/g;
}
my $nicname;
if(xCAT::Utils->version_cmp($kversion,"7.0")<0){
$kcmdline .= " ksdevice=" . $ksdev;
}else{
if(xCAT::NetworkUtils->isValidMAC($ksdev)){
$kcmdline .= " BOOTIF=" . $ksdev;
}elsif($ksdev ne "bootif"){
$nicname=$ksdev;
}
}
# Add kernel parameters to specify the boot network interface
if($esxi){
$ent->{installnic} =~ s/eth/vmnic/g;
$ent->{primarynic} =~ s/eth/vmnic/g;
}
my $mac;
if ($macent->{mac}) {
$mac = xCAT::Utils->parseMacTabEntry($macent->{mac}, $node);
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic}, $ent->{primarynic}, $mac);
my $nicname = $net_params->{nicname};
if(xCAT::Utils->version_cmp($kversion,"7.0") < 0){
$kcmdline .= " $net_params->{ksdevice} ";
}elsif ($arch =~ /ppc/) {
$kcmdline .= " $net_params->{BOOTIF} ";
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
@@ -1527,7 +1435,6 @@ sub mkinstall
$kcmdline .= " ifname=$nicname:$mac";
}
$kcmdline .=" ip=$ipaddr"."::"."$gateway".":"."$netmask".":"."$hostname".":"."$nicname".":"."none";
$kcmdline .=" bootdev=$nicname ";
}
@@ -1557,12 +1464,8 @@ sub mkinstall
}
}
}else{
unless(xCAT::Utils->version_cmp($kversion,"7.0")<0){
if($nicname){
$kcmdline .=" ip=$nicname:dhcp ";
}else{
$kcmdline .=" ip=dhcp ";
}
if (xCAT::Utils->version_cmp($kversion,"7.0") >= 0){
$kcmdline .= " $net_params->{ip} ";
}
}
@@ -1684,13 +1587,15 @@ sub mksysclone
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
my %rents = %{$restab->getNodesAttribs(\@nodes,
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
my %hents = %{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
my $port_entry = $entries[0];
my $xcatdport="3001";
@@ -1958,50 +1863,20 @@ sub mksysclone
#We have a shot...
my $ent = $rents{$node}->[0];
my $sent = $hents{$node}->[0];
my $macent = $macents{$node}->[0];
my $kcmdline =
"ramdisk_size=$ramdisk_size";
my $ksdev = "";
if ($ent->{installnic})
{
if ($ent->{installnic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{installnic};
}
my $kcmdline = "ramdisk_size=$ramdisk_size";
# Add kernel parameters to specify the boot network interface
my $mac;
if ($macent->{mac}) {
$mac = xCAT::Utils->parseMacTabEntry($macent->{mac}, $node);
}
elsif ($ent->{primarynic})
{
if ($ent->{primarynic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{primarynic};
}
}
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
}
if ($ksdev eq "")
{
$callback->(
{
error => ["No MAC address defined for " . $node],
errorcode => [1]
}
);
}
$kcmdline .= " ksdevice=" . $ksdev;
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic}, $ent->{primarynic}, $mac);
$kcmdline .= " $net_params->{ksdevice} ";
if ($arch =~ /ppc/) {
$kcmdline .= " $net_params->{BOOTIF} ";
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport}))
@@ -2031,27 +1906,6 @@ sub mksysclone
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $nodetab = xCAT::Table->new('nodetype');
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
if ($archref->{arch} eq "ppc64"){
my $mactab = xCAT::Table->new('mac');
my $macref = $mactab->getNodeAttribs($node, ['mac']);
my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
$formatmac =~ s/:/-/g;
$formatmac = "01-".$formatmac;
$kcmdline .= " BOOTIF=$formatmac ";
}
#$kcmdline .= " noipv6";
# add the addkcmdline attribute to the end
# of the command, if it exists
#my $addkcmd = $addkcmdhash->{$node}->[0];
# add the extra addkcmd command info, if in the table
#if ($addkcmd->{'addkcmdline'}) {
# $kcmdline .= " ";
# $kcmdline .= $addkcmd->{'addkcmdline'};
#}
my $k;
my $i;
#$k = "xcat/genesis.kernel.$arch";
+39 -63
View File
@@ -465,6 +465,7 @@ sub mkinstall
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
@@ -472,6 +473,7 @@ sub mkinstall
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
#my $addkcmdhash =
# $bptab->getNodesAttribs(\@nodes, ['addkcmdline']);
require xCAT::Template;
@@ -504,6 +506,8 @@ sub mkinstall
my $profile;
my $tmplfile;
my $pkgdir;
my $pkgdirval;
my @mirrors;
my $pkglistfile;
my $imagename; # set it if running of 'nodeset osimage=xxx'
my $platform;
@@ -578,13 +582,23 @@ sub mkinstall
$arch = $ph->{osarch};
$profile = $ph->{profile};
$platform=xCAT_plugin::debian::getplatform($os);
$tmplfile=$ph->{template};
$pkgdirval=$ph->{pkgdir};
my @pkgdirlist=split(/,/,$pkgdirval);
foreach (@pkgdirlist){
if($_ =~ /^http|ssh/){
push @mirrors,$_;
}else{
$pkgdir=$_;
}
}
$tmplfile=$ph->{template};
$pkgdir=$ph->{pkgdir};
if (!$pkgdir) {
$pkgdir="$installroot/$os/$arch";
}
$pkglistfile=$ph->{pkglist};
$pkglistfile=$ph->{pkglist};
}
else {
$os = $ent->{os};
@@ -796,6 +810,7 @@ sub mkinstall
# 'serialport', 'serialspeed', 'serialflow'
# ]
# );
my $macent = $macents{$node}->[0];
my $instserver;
if ($ent and $ent->{xcatmaster}){
$instserver = $ent->{xcatmaster};
@@ -827,32 +842,13 @@ sub mkinstall
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
my $ksdev = "";
if ($ent->{installnic}){
if ($ent->{installnic} eq "mac"){
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else{
$ksdev = $ent->{installnic};
}
}
elsif ($ent->{primarynic}){
if ($ent->{primarynic} eq "mac"){
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else{
$ksdev = $ent->{primarynic};
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic},$ent->{primarynic},$macent->{mac});
if (exists($net_params->{nicname})) {
$kcmdline .= " netcfg/choose_interface=". $net_params->{nicname};
} elsif (exists($net_params->{mac})) {
$kcmdline .= " netcfg/choose_interface=". $net_params->{mac};
}
if ($ksdev){
$kcmdline .= " netcfg/choose_interface=" . $ksdev;
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport})){
unless ($sent->{serialspeed}){
@@ -1448,17 +1444,16 @@ sub mknetboot
# add one parameter: ifname=<eth0>:<mac address>
# which is used for dracut
# the redhat5.x os will ignore it
my $useifname=0;
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
} elsif ($nodebootif) {
$useifname=1;
$kcmdline .= "ifname=$nodebootif:";
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
my $installnic = undef;
my $primarynic = undef;
my $mac = undef;
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}) {
$installnic = $reshash->{$node}->[0]->{installnic};
}
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic}) {
$primarynic= $reshash->{$node}->[0]->{primarynic};
}
#else { #no, we autodetect and don't presume anything
# $kcmdline .="eth0:";
@@ -1469,34 +1464,15 @@ sub mknetboot
if( $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
# TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{'mac'},$node);
# if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
#convert to linux format
if ($mac !~ /:/) {
$mac =~s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
# } else {
# $callback->({ error=>[ qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset <nr> netboot|statelite if installnic/primarynic is set".}], errorcode=>[1]});
# return;
# }
}
if ($useifname && $mac) {
$kcmdline .= "$mac ";
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
if (defined($net_params->{ifname})) {
$kcmdline .= "$net_params->{ifname} ";
}
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
my $netdev = "";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
} elsif ($nodebootif) {
$kcmdline .= "netdev=" . $nodebootif . " ";
} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
} else {
if ( !$useifname && $mac) {
$kcmdline .= "BOOTIF=" . $mac . " ";
}
if (defined($net_params->{netdev})) {
$kcmdline .= "$net_params->{netdev} ";
} elsif (defined($net_params->{BOOTIF}) && ($net_params->{setmac} || $arch=~ /ppc/)) {
$kcmdline .= "$net_params->{BOOTIF} ";
}
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
+1 -1
View File
@@ -2476,7 +2476,7 @@ sub clone_vms_from_master {
sub make_customization_spec {
my $node = shift;
my %args = @_;
my $password="Passw0rd";
my $password;
my $wintimezone;
#map of number to strings can be found at
#http://osman-shener-en.blogspot.com/2008/02/unattendedtxt-time-zone-index.html
+62 -94
View File
@@ -583,28 +583,30 @@ sub mknetboot
# add dhcp for ip
$kcmdline .= "ip=dhcp ";
# add the kernel-booting parameter: netdev=<eth0>, or BOOTIF=<mac>
my $netdev = "";
my $mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node);
my $mac;
my $installnic;
my $primarynic;
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and ($reshash->{$node}->[0]->{installnic} ne "mac")) {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
} elsif ($nodebootif) {
$kcmdline .= "netdev=" . $nodebootif . " ";
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and ($reshash->{$node}->[0]->{primarynic} ne "mac")) {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
} else {
if ($arch =~ /x86/) {
#do nothing, we'll let pxe/xnba work their magic
} elsif ($mac) {
$kcmdline .= "BOOTIF=" . $mac . " ";
} else {
$callback->({
error=>[qq{"cannot get the mac address for $node in mac table"}],
errorcode=>[1]
});
}
}
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}){
$installnic=$reshash->{$node}->[0]->{installnic};
}
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic}){
$primarynic=$reshash->{$node}->[0]->{primarynic};
}
if (defined ($machash->{$node}->[0]) && $machash->{$node}->[0]->{'mac'}) {
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node);
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
if (defined ($net_params->{ifname}) || defined ($net_params->{netdev})) {
$kcmdline .= " $net_params->{ifname} $net_params->{netdev} ";
} elsif (defined ($net_params->{BOOTIF}) && ($net_params->{setmac} || $arch=~ /ppc/)) {
$kcmdline .= " $net_params->{BOOTIF} ";
}
if (defined $sent->{serialport}) {
@@ -1116,49 +1118,30 @@ sub mkinstall
. $netserver . ":" . $httpport
. "$httpprefix/1";
my $netdev = "";
if ($ent->{installnic})
{
if ($ent->{installnic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$netdev = $ent->{installnic};
}
my $installnic;
my $primarynic;
my $mac;
if ($ent->{installnic}){
$installnic=$ent->{installnic};
}
if($ent->{primarynic}){
$primarynic=$ent->{primarynic};
}
elsif ($ent->{primarynic})
{
if ($ent->{primarynic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$netdev = $ent->{primarynic};
}
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
if($macref->{mac}){
$mac=xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$netdev = "bootif";
}
if ($netdev eq "") #why it is blank, no mac defined?
{
$callback->(
{
error => ["No mac.mac for $node defined"],
errorcode => [1]
}
);
}
unless ($netdev eq "bootif") { #if going by bootif, BOOTIF will suffice
$kcmdline .= " netdevice=" . $netdev;
my $net_params=xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac);
if (defined ($net_params->{netdevice})) {
$kcmdline .= " $net_params->{netdevice} ";
}
# Add the kernel paramets for driver update disk loading
foreach (@dd_drivers) {
@@ -1467,33 +1450,30 @@ sub mksysclone
my $sent = $hents{$node}->[0];
my $kcmdline = "ramdisk_size=$ramdisk_size";
my $ksdev = "";
if ($ent->{installnic})
{
$ksdev = $ent->{installnic};
my $installnic;
my $primarynic;
my $mac;
if ($ent->{installnic}){
$installnic= $ent->{installnic};
}
if ($ent->{primarynic}){
$primarynic=$ent->{primarynic};
}
elsif ($ent->{primarynic})
{
$ksdev = $ent->{primarynic};
}
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
if($macref->{mac}){
$mac=xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
if ($ksdev eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
unless ( $ksdev eq "bootif" ) {
$kcmdline .= " netdevice=" . $ksdev;
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic,$primarynic,$mac);
$kcmdline .= " $net_params->{netdevice} ";
if ($arch =~ /ppc/) {
$kcmdline .= " dhcptimeout=150";
$kcmdline .= " $net_params->{BOOTIF} ";
}
if (defined($sent->{serialport}))
@@ -1515,18 +1495,6 @@ sub mksysclone
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $nodetab = xCAT::Table->new('nodetype');
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
if ($archref->{arch} eq "ppc64"){
my $mactab = xCAT::Table->new('mac');
my $macref = $mactab->getNodeAttribs($node, ['mac']);
my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
$formatmac =~ s/:/-/g;
$formatmac = "01-".$formatmac;
$kcmdline .= " BOOTIF=$formatmac ";
}
my $i = "xcat/genesis.fs.$arch.gz";
if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){
$i = "xcat/genesis.fs.$arch.lzma";
@@ -0,0 +1,36 @@
#Please make sure there is a space between @ and group name
@ Network Infrastructure Server
@ System administration tools
@ System Management
@ X Window System
@ Development Tools
autofs
ksh
tcsh
ntp
tftp
xinetd
rsh
rsh-server
psacct
nfs-utils
net-snmp
rsync
yp-tools
ypserv
ypbind
m4
sendmail-cf
gdb
binutils
openssh-server
util-linux
perl-DBD-MySQL
perl-Socket6
unixODBC
perl-DBD-MySQL
mysql-connector-odbc
perl-DBD-Pg
wget
util-linux-ng
net-tools
@@ -0,0 +1 @@
xcat/xcat-dep/rh7/ppc64le/systemimager-client
@@ -32,7 +32,7 @@ done >>/etc/resolv.conf
ln -sf /bin/bash /bin/sh
#
#delete the useless apt repo
sed -i 's/^deb.*updates.*$/#&/g' /etc/apt/sources.list
#sed -i 's/^deb.*updates.*$/#&/g' /etc/apt/sources.list
# Run xCAT post install
#
export MASTER_IP="#XCATVAR:XCATMASTER#"
@@ -230,9 +230,9 @@ script
end script
EOF
fi
sed -i 's/\(deb.*security.*\)/#\1/' /etc/apt/sources.list
#sed -i 's/\(deb.*security.*\)/#\1/' /etc/apt/sources.list
#iso does not contains source deb packages
sed -i 's/^\(\s*deb-src.*install.*\)$/#\1/g' /etc/apt/sources.list
#sed -i 's/^\(\s*deb-src.*install.*\)$/#\1/g' /etc/apt/sources.list
#delete the 127.0.1.1 line from /etc/hosts
sed -i '/127.0.1.1/d' /etc/hosts
updateflag.awk $MASTER 3002
@@ -100,7 +100,7 @@ tasksel tasksel/first multiselect standard
d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED#
d-i debian-installer/allow_unauthenticated string true
d-i debian-installer/allow_unauthenticated boolean true
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean false
@@ -100,7 +100,7 @@ tasksel tasksel/first multiselect standard
d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED#
d-i debian-installer/allow_unauthenticated string true
d-i debian-installer/allow_unauthenticated boolean true
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean false
@@ -0,0 +1 @@
compute.rhels7.ppc64.exlist
@@ -0,0 +1 @@
compute.rhels7.ppc64.pkglist
@@ -0,0 +1 @@
compute.rhels7.ppc64.postinstall
+19 -6
View File
@@ -228,8 +228,14 @@ unless ($onlyinitrd) {
# Get the ubuntu repo path from osimage.pkgdir
my @srcdirs = split(',', $srcdir);
my $pkgdir_internet; #only support one http mirror which will be used to create bootstrap
foreach my $dir (@srcdirs) {
find(\&isaptdir, <$dir/>);
if ($dir =~ /^http.*/){
$pkgdir_internet = $dir;
} else {
$srcdir = $dir; #set $srcdir to be the one which is not http path
find(\&isaptdir, <$dir/>);
}
}
# Add the dir for kernel deb to be installed
if ($kernelver) {
@@ -251,6 +257,11 @@ unless ($onlyinitrd) {
$repnum += 1;
}
$repnum-=1;
# Add the internet mirror
if ($pkgdir_internet) {
print $aptconfig "deb $pkgdir_internet\n\n";
}
close($aptconfig);
mkpath "$rootimg_dir/etc";
@@ -282,9 +293,10 @@ unless ($onlyinitrd) {
# Check whether a local Ubuntu mirror is specified
# if linuximage.pkgdir has second mirror is set, we consider the second mirror as a full Ubuntu mirror
if ($#srcdirs > 0) {
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir file://$srcdirs[1]";
$srcdir = $srcdirs[0];
if ($pkgdir_internet) {
my $mirrorurl = $pkgdir_internet;
$mirrorurl =~ s/ .*$//g; # get the url part of mirror path
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir $mirrorurl";
} else {
if ($uarch eq 'ppc64el') {
$aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://ports.ubuntu.com/ubuntu-ports/";
@@ -437,7 +449,7 @@ unless ($onlyinitrd) {
my %extrapkgnames;
if (keys(%extra_hash) > 0) {
open ($aptconfig,">>","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list");
open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage1.apt.list");
my $index=1;
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
foreach (keys(%{$extra_hash{$pass}})) {
@@ -546,8 +558,9 @@ unless ($onlyinitrd) {
# Add the local repo from MN
my $master = xCAT::TableUtils->get_site_Master();
open($aptconfig,">","$rootimg_dir/etc/apt/sources.list");
print $aptconfig "deb http://$master$installroot/$osver/$arch/ $dist main\n";
print $aptconfig "deb http://$master$srcdir $dist main\n";
close($aptconfig);
`rm -fr $rootimg_dir/etc/apt/sources.list.d/genimage1.apt.list`;
#recover the /etc/hosts & /etc/reslov.conf
`cd $rootimg_dir/etc/;mv -f hosts.bak hosts;mv -f resolv.conf.bak resolv.conf`;