technical:perceus:per-node-initd

PERCEUS Per-Node init.d Augmentation

Normally, one would create additional VNFS capsules for any compute node that has additional services relative to the default VNFS image. The alternate VNFS capsule would include the software associated with the services and any /etc/init.d scripts that are necessary to start the service at boot. However, as time goes by any changes we introduce to /etc/profile.d or any YUM updates we must make would need to be replicated across all of the VNFS capsules.

The passwdfile and groupfile PERCEUS modules that are used to propagate accounting data to the compute nodes can add information on a per-node basis to forego the need for additional per-node VNFS images. A similar approach has been adopted to allow for the startup at node boot of additional /etc/init.d-like services.

The absolute last /etc/init.d script that is run as the compute node boots is pernode-services. This script first searches for executable files in the /opt/perceus/state/lib/perceus/init.d/global directory; any executable files therein as run with a single argument: start. This mimics the behavior of scripts in the /etc/init.d directory.

Scripts can be named with sorting prefixes a'la the /etc/rc.# directories to provide ordered startup.

Next, the script looks for a directory with a name matching the hostname of the compute node. If n059 is booting, then the script would look for /opt/perceus/state/lib/perceus/init.d/n059. If the directory exists, it is scanned for executable files and each is run with the start argument. Again, ordered startup can be promoted using name prefixes, etc.

All executable files found will be executed; a non-zero return code from one will not prevent the execution of subsequent files. However, a single non-zero return code will cause the pernode-services script to itself return non-zero on exit.

Just as /etc/init.d scripts have some common shell functions that are defined in /etc/init.d/functions, the pernode-services scripts can source /opt/perceus/state/lib/perceus/init.d/functions to incorporate both /etc/init.d/functions and some functions provided by the pernode-services “package”.

At this time, this includes adding /opt/perceus/state/lib/perceus/init.d/bin to the PATH to enable the waitOnFileUpdates command.

This program takes a threshold (in seconds) and a list of one or more files/directories. It checks the modification date on each against the threshold, marking any that are newer than the threshold time. If all files/directories are marked, the program exits; otherwise, it sleeps for a certain amount of time before re-checking the remaining unmarked files/directories.

The waitOnFileUpdates program was written primarily for the sake of watching the /etc/passwd and /etc/group files so that any per-node services that depend on accounting information derived from the passwdfile or groupfile PERCEUS modules can wait for provisiond to fetch the files from the PERCEUS master node.

The process is straight-forward. For any services that should apply to all compute nodes, add an init script (executable bit set, of course) to /opt/perceus/state/lib/perceus/init.d/global. To add a service to a particular node, make sure a directory with the node's hostname exists in /opt/perceus/state/lib/perceus/init.d and add the init script to it.

For init scripts that will apply to multiple nodes (but not all of them), you will likely want to add the init script to one of the nodes and supply symlinks in the directories for the other nodes. Or, akin to init.d itself, create a generic scripts directory in /opt/perceus/state/lib/perceus/init.d and add symlinks to the init script in scripts in each node's directory.

Compute nodes will need to either be restarted after changes are made to the global/per-node init.d directory, or the applicable init scripts will need to be run manually via remote login as root.
  • technical/perceus/per-node-initd.txt
  • Last modified: 2012-08-08 10:02
  • by 127.0.0.1