diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 623987a88..4cba7141d 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -418,7 +418,15 @@ sub mknetboot } if($ient->{nfsdir} ne ''){ $nfsdir = $ient->{nfsdir} . "/netboot/$osver/$arch/$profile"; - + #this code sez, "if nfsdir starts with //, then + #use a absolute path, i.e. do not append xCATisms" + #this is required for some statelite envs. + #still open for debate. + + if($ient->{nfsdir} =~ m!^//!) { + $nfsdir = $ient->{nfsdir}; + $nfsdir =~ s!^/!!; + } } $kcmdline = diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 15b661a2c..0b53da38c 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -68,9 +68,53 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); - if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for - #most generic, least code duplication - $kern->{kcmdline} .= " ".$kern->{addkcmdline}; + if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { + +#Implement the kcmdline append here for +#most generic, least code duplication + +###hack start +# This is my comment. There are many others like it, but this one is mine. +# My comment is my best friend. It is my life. I must master it as I must master my life. +# Without me, my comment is useless. Without my comment, I am useless. + +# Jarrod to clean up. It really should be in Table.pm and support +# the new statelite $table notation. + +#I dislike spaces, tabs are cleaner, I'm too tired to change all the xCAT code. +#I give in. + + my $kcmdlinehack = $kern->{addkcmdline}; + + while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) { + my $natab = xCAT::Table->new($1); + my $naent = $natab->getNodeAttribs($node,[$2]); + my $naval = $naent->{$2}; + $kcmdlinehack =~ s/#NODEATTRIB:([^:#]+):([^:#]+)#/$naval/; + } + while ($kcmdlinehack =~ /#TABLE:([^:#]+):([^:#]+):([^:#]+)#/) { + my $tabname = $1; + my $keyname = $2; + my $colname = $3; + if ($2 =~ /THISNODE/ or $2 =~ /\$NODE/) { + my $natab = xCAT::Table->new($tabname); + my $naent = $natab->getNodeAttribs($node,[$colname]); + my $naval = $naent->{$colname}; + $kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/; + } else { + my $msg = "Table key of $2 not yet supported by boottarget mini-template"; + $callback->({ + error => ["$msg"], + errorcode => [1] + }); + } + } + + #$kern->{kcmdline} .= " ".$kern->{addkcmdline}; + $kern->{kcmdline} .= " ".$kcmdlinehack; + +###hack end + } if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn = xCAT::Utils->my_ip_facing($node); diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 5c96f8dd3..cf6e047fe 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -10,7 +10,8 @@ my $addkcmdlinehandled; my $request; my $callback; my $dhcpconf = "/etc/dhcpd.conf"; -my $tftpdir = "/tftpboot"; +#my $tftpdir = "/tftpboot"; +my $tftpdir = xCAT::Utils->getTftpDir(); #my $dhcpver = 3; my %usage = ( @@ -79,9 +80,53 @@ sub setstate { my %iscsihash = %{shift()}; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); unless ($addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline - if ($kern->{addkcmdline}) { #Implement the kcmdline append here for - #most generic, least code duplication - $kern->{kcmdline} .= " ".$kern->{addkcmdline}; + if ($kern->{addkcmdline}) { + +#Implement the kcmdline append here for +#most generic, least code duplication + +###hack start +# This is my comment. There are many others like it, but this one is mine. +# My comment is my best friend. It is my life. I must master it as I must master my life. +# Without me, my comment is useless. Without my comment, I am useless. + +# Jarrod to clean up. It really should be in Table.pm and support +# the new statelite $table notation. + +#I dislike spaces, tabs are cleaner, I'm too tired to change all the xCAT code. +#I give in. + + my $kcmdlinehack = $kern->{addkcmdline}; + + while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) { + my $natab = xCAT::Table->new($1); + my $naent = $natab->getNodeAttribs($node,[$2]); + my $naval = $naent->{$2}; + $kcmdlinehack =~ s/#NODEATTRIB:([^:#]+):([^:#]+)#/$naval/; + } + while ($kcmdlinehack =~ /#TABLE:([^:#]+):([^:#]+):([^:#]+)#/) { + my $tabname = $1; + my $keyname = $2; + my $colname = $3; + if ($2 =~ /THISNODE/ or $2 =~ /\$NODE/) { + my $natab = xCAT::Table->new($tabname); + my $naent = $natab->getNodeAttribs($node,[$colname]); + my $naval = $naent->{$colname}; + $kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/; + } else { + my $msg = "Table key of $2 not yet supported by boottarget mini-template"; + $callback->({ + error => ["$msg"], + errorcode => [1] + }); + } + } + + #$kern->{kcmdline} .= " ".$kern->{addkcmdline}; + $kern->{kcmdline} .= " ".$kcmdlinehack; + +###hack end + } } if ($kern->{kcmdline} =~ /!myipfn!/) { diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 5f27fec95..481b1fefe 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -633,7 +633,7 @@ if [ "\$NFSROOT" = "1" ]; then MAXTRIES=5 ITER=0 ME=`hostname` - while ! mount.nfs \${SERVER}:\${ROOTDIR}/rootimg \$NEWROOT -r -n -o nolock,rsize=32768,udp,nfsvers=3,timeo=14 + while ! mount.nfs \${SERVER}:\${ROOTDIR}/rootimg \$NEWROOT -r -n -o nolock,rsize=32768,tcp,nfsvers=3,timeo=14 do ITER=\$(expr \$ITER + 1) if [ "\$ITER" == "\$MAXTRIES" ] @@ -682,7 +682,7 @@ if [ "\$NFSROOT" = "1" ]; then mkdir -p \$NEWROOT/\$RWDIR/persistent MAXTRIES=5 ITER=0 - while ! mount \$SNAPSHOTSERVER:\$SNAPSHOTROOT \$NEWROOT/\$RWDIR/persistent + while ! mount \$SNAPSHOTSERVER:\$SNAPSHOTROOT \$NEWROOT/\$RWDIR/persistent -o nolock,rsize=32768,tcp,nfsvers=3,timeo=14 do ITER=\$(expr \$ITER + 1) if [ "\$ITER" == "\$MAXTRIES" ] @@ -785,7 +785,7 @@ if [ "\$NFS" = "1" ]; then #NOTE: should prob have max count while [ ! -d /ro/bin ]; do echo mounting \$SERVER:\$ROOTDIR on /ro - mount.nfs \$SERVER:\$ROOTDIR /ro -r -n -o nolock,rsize=32768,udp,nfsvers=3,timeo=14 + mount.nfs \$SERVER:\$ROOTDIR /ro -r -n -o nolock,rsize=32768,tcp,nfsvers=3,timeo=14 ST=`expr \$RANDOM % 5` sleep \$ST done