Statelite updates.
genimage, TCP support anaconda.pm, //server for absolute path xnba.pm/pxe.pm addkcmdline #NODEATTRIB support git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5324 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -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 =  | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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!/) { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user