Note: this is an xCAT design document, not an xCAT user document. If you are an xCAT user, you are welcome to glean information from this design, but be aware that it may not have complete or up to date procedures.
In xCAT 2.8, site.precreatemypostscripts was added to enhance the performance. The logic is this:
1. when site.precreatemypostscripts=1, nodeset/updatenode creates mypostscritps and save it on the server as /tftpboot/mypostscripts/mypostscrtipt.$nodename. The Linux node uses "wget http" to download it and then run it. The AIX node, tftp.
2. when site.precreatemypostscripts=0,nodeset/updatenode does not create the file on the server. The node calls "getpostscritpts.awk version 2" to have it created on the server as /tftpboot/mypostscripts/mypostscrtipt.$nodename.tmp. The Linux node uses "wget http" to download it and then runs it. AIX uses tftp.
With defect 3398 fix which is related to wget part in xcatdsklspost. In xcatdsklspost, before running wget, it has to figure out the $nodename as well as site.precreatemypostscripts so that it can get the correct mypostscrtipt file on the server. Here is the logic I have used:
1) get the server name
2) figure out the node name: (we consider the situation that the hostname is not the same as the node name)
2.1)use "ip route get" to figure out which nic/ip on the node can get to the server.
2.2)use "getent hosts <ip>" to figure out the possible node name. It may give you two names, a long name and a short name.
2.3)If above fails, use "hostname -s" to get the short node name and use "hostname" to get the long node name.
3) use "wget" with the short name to get mypostscritps.$shortname
4) if failed, use "wget" with long name to get mypostscritps.$longname
5) if failed, the assume site.precreatemypostscripts=0, run "getpostscripts.awk version 2"
6) use "wget" with the short name to get mypostscritps.$shortname
7) if failed, use "wget" with long name to get mypostscritps.$longname
This logic helps the case when site.precreatemypostscripts=1, but make the performance worse when it is 0 which is used by most of customers. It has to go through 3 wgets and one getpostsctipts.awk to get the mypostscript file. In the old way, we only made one call (getpostsctipts.awk) to get it. It is because of this performance problem, we are coming up with a new design.
The new design of generating and downloading the mypostscript files will be as follows.
Understand that the call is from updatenode and will create the mypostscript.node files even if site.precreatemypostscripts=0. Two new flags input that are passed on to xCAT::Postage::makescript . $notmpfile and $nofiles are the new flags. If $notmpfile=1, then not files with the .tmp extension will be created. If $nofiles=1, then not mypostscript.<nodename> files will be created at all and the data will be returned in an array. nofiles is used by getpostscript.awk. notmpfiles is used by updatenote.
xcatdsklspost will do the following:
getpostscript.pm - Still support version2 but update the no version number path so that it can be the default for 2.8.1 and yet not break 2.7 and earlier code.
Template.pm and Postage.pm - An attempt will be made, to make the AIX and Linux processing the same. We will therefore support precreatemypostscripts for both AIX and Linux. We will also add supporting long hostnames in the xCAT database. the mypostscripts.<longhostname> file will be generated for these long hostnames.
TBD: Work with Jarrod on nodename determination and "per node certificates".
On the server, getpostscript reads the site.precreatemypostscripts setting and determine the name of the file to return.
In current xcatd code, we support long hostname in the database. We will need to add support for long hostnames in the xCAT database and in the postscripts interface.
After performance test, it was decide to go with wget first and use getpostscript.awk as a last choice. Need to check if there is room for performance improvements in getpostscript.pm, getpostscript.awk, Template.pm and Postage.pm.
Should we change AIX to use wget and ship wget in the deps package.
Another item to consider is backward compatibility. For pre-release 2.8, if the user has old stateless/statelite image, that means the 2.7 or older /opt/xcat/xcatdsklspost is in the image and is used when the node reboot, (same is true for diskful case when site.runbootscripts=yes). Will it still work? The answer is yes, because getpostscripts.pm supports calls with no version and that is how it will be called with this new design.
For release 2.8, if images are built with the xcatdsklspost from 2.8, then the version2 option will still be honored by getpostscripts. The logic will remain the same.
updatenode is not a problem because it pushed the new xcatdsklspost down to the node.
This design will try and merge the logic of building the Linux and AIX mypostscript file. Currently Linux uses logic in Template.pm and AIX uses logic in Postage.pm. An attempt will be made to use the same code for both. In doing that we will can support precreatemypostscript on AIX.
Let xcatdsklspost know the setting of site.precreatemypostscripts before hand
(Considered but will not be implemented)
This is a chicken-and-egg problem. The setting is contained in mypostscript file. But we need it to get mypostscript file using that setting. The thought is to pass this value down to xcatdsklspost through a kernel parameter in the deployment case and as a parameter in the updatenode case. Let's make sure we cover everything:
1.1) stateless and statelite deployment, use kernel parameter
1.2) stateful deployment: both node name and site.precreatemypostscripts is known by the server, so only one call is needed to put in the kick start/autoyast configuration file.
1.3) updatenode: pass it down as a parameter to xcatdsklspost
1.4) running postbootscripts for diskfull node reboot when site.runbootscripts=yes: no way to know the current site.precreatemypostscripts setting. Have to try the mypostscrtipt.$nodename and then try mypostscrtipt.$nodename.tmp