the code to handle ifname/netdev/BOOTIF is updated;
also, when the node is booting up, one file named "ifcfg-ethx" will be created for redhat6. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8236 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
69c166ab5d
commit
1cb5bdb0d7
@ -537,11 +537,9 @@ sub mknetboot
|
||||
# which is used for dracut
|
||||
# the redhat5.x os will ignore it
|
||||
my $useifname=0;
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}) {
|
||||
if ($reshash->{$node}->[0]->{installnic} ne "mac") {
|
||||
$useifname=1;
|
||||
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
|
||||
}
|
||||
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:";
|
||||
@ -555,7 +553,7 @@ sub mknetboot
|
||||
#}
|
||||
# append the mac address
|
||||
my $mac;
|
||||
if($useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
|
||||
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 = $machash->{$node}->[0]->{'mac'};
|
||||
if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
|
||||
@ -563,20 +561,21 @@ sub mknetboot
|
||||
if ($mac !~ /:/) {
|
||||
$mac =~s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
|
||||
}
|
||||
$kcmdline .= "$mac ";
|
||||
} else {
|
||||
die 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".};
|
||||
$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;
|
||||
}
|
||||
#} else { # it should never happen, but we don't always do it this way
|
||||
# $callback->({error=>["cannot find the mac address for $node in mac table"], errorcode=>[1]});
|
||||
}
|
||||
|
||||
# add "netdev=<eth0>" or "BOOTIF=<mac>"
|
||||
if ($useifname && $mac) {
|
||||
$kcmdline .= "$mac ";
|
||||
}
|
||||
|
||||
# add "netdev=<eth0>" or "BOOTIF=<mac>"
|
||||
# which are used for other scenarios
|
||||
my $netdev = "";
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}) {
|
||||
if ($reshash->{$node}->[0]->{installnic} ne "mac") {
|
||||
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
|
||||
}
|
||||
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}) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget cpio gzip dash modprobe
|
||||
dracut_install wget cpio gzip dash modprobe touch
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname
|
||||
inst "$moddir/xcatroot" "/sbin/xcatroot"
|
||||
inst_hook cmdline 10 "$moddir/xcat-cmdline.sh"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget cpio gzip dash modprobe wc
|
||||
dracut_install wget cpio gzip dash modprobe wc touch
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh"
|
||||
|
@ -76,6 +76,28 @@ for lf in /tmp/dhclient.*.lease; do
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
if [ ! -z "$ifname" ]; then
|
||||
MACX=${ifname#*:}
|
||||
ETHX=${ifname%:$MACX*}
|
||||
elif [ ! -z "$netdev" ]; then
|
||||
ETHX=$netdev
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
||||
touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
|
||||
cp /etc/resolv.conf "$NEWROOT/etc/"
|
||||
|
||||
if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then
|
||||
|
@ -1392,6 +1392,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
open($cfgfile,">","$rootimg_dir/etc/resolv.conf");
|
||||
print $cfgfile "#Dummy resolv.conf to make boot cleaner";
|
||||
close($cfgfile);
|
||||
# TODO
|
||||
# open($cfgfile,">","$rootimg_dir/etc/sysconfig/network-scripts/ifcfg-$prinic");
|
||||
# print $cfgfile "ONBOOT=yes\nBOOTPROTO=dhcp\nDEVICE=$prinic\n";
|
||||
# close($cfgfile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user