Skip to content

Commit

Permalink
Fixes for generating recipe.sh for Warewulf 4
Browse files Browse the repository at this point in the history
* Contains a bugfix for HEREDOC handling

Signed-off-by: Timothy Middelkoop <[email protected]>
  • Loading branch information
MiddelkoopT committed Oct 23, 2024
1 parent 88fb0bc commit a714518
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 43 deletions.
4 changes: 2 additions & 2 deletions docs/recipes/install/common/add_ww4_hosts_intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
\begin{lstlisting}[language=bash,keywords={},upquote=true,basicstyle=\footnotesize\ttfamily,literate={BOSVER}{\baseos{}}1]
# add the nodes with --discoverable so warewulf will identify new mac addresses
[sms](*\#*) for ((i=0; i<$num_computes; i++)) ; do
wwctl node add --discoverable=yes --container=BOSVER \
--ipaddr=${c_ip[$i]} --netmask=${internal_netmask} ${compute_prefix}$i
wwctl node add --discoverable=yes --container=rocky9.4 \
--ipaddr=${c_ip[$i]} --netmask=${internal_netmask} ${compute_prefix}$i
done
\end{lstlisting}
% end_ohpc_run
5 changes: 5 additions & 0 deletions docs/recipes/install/common/add_ww4_hosts_slurm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
[sms](*\#*) systemctl enable --now slurmctld
\end{lstlisting}
% end_ohpc_run

% begin_ohpc_run
% ohpc_comment_header Allow for optional sleep to wait for provisioning to complete
% ohpc_command sleep ${provision_wait}
% end_ohpc_run
5 changes: 3 additions & 2 deletions docs/recipes/install/common/import_ww4_files_ib_centos.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
% ohpc_command if [[ ${enable_ipoib} -eq 1 ]];then
% ohpc_indent 5
\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
[sms](*\#*) wwsh file import /opt/ohpc/pub/examples/network/centos/ifcfg-ib0.ww
[sms](*\#*) wwsh -y file set ifcfg-ib0.ww --path=/etc/sysconfig/network-scripts/ifcfg-ib0
[sms](*\#*) wwctl overlay mkdir generic /etc/sysconfig/network-scripts/
[sms](*\#*) wwctl overlay import generic /opt/ohpc/pub/examples/network/centos/ifcfg-ib0.ww \
/etc/sysconfig/network-scripts/ifcfg-ib0.ww
\end{lstlisting}
% ohpc_indent 0
% ohpc_command fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
% ohpc_comment_header Add OpenHPC base components to compute image \ref{sec:add_components}
\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true,literate={BOSVER}{\baseos{}}1]
# Install compute node base meta-package
[sms](*\#*) (*\containerinstall*)
(*\install*) ohpc-base-compute
[sms](*\#*) wwctl container exec rocky-9.4 /bin/bash <<- EOF
dnf -y install ohpc-base-compute
/bin/false
EOF
\end{lstlisting}
Expand Down
6 changes: 3 additions & 3 deletions docs/recipes/install/common/warewulf4_mkchroot_rocky.tex
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ \subsubsection{Build initial BOS image} \label{sec:assemble_bos}
[sms](*\#*) wwctl container import docker://ghcr.io/warewulf/warewulf-rockylinux:BOSTAG BOSVER --syncuser

# Enable OpenHPC inside image and update container
[sms](*\#*) (*\containerinstall*)
(*\install*) http://repos.openhpc.community/OpenHPC/3/EL_9/x86_64/ohpc-release-3-1.el9.x86_64.rpm
(*\pkgmgr*) -y update
[sms](*\#*) wwctl container exec rocky-9.4 /bin/bash <<- EOF
dnf -y install http://repos.openhpc.community/OpenHPC/3/EL_9/x86_64/ohpc-release-3-1.el9.x86_64.rpm
dnf -y update
/bin/false
EOF

Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/install/common/warewulf4_setup_centos.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[sms](*\#*) perl -pi -e "s/netmask:.*/netmask: ${internal_netmask}/" /etc/warewulf/warewulf.conf
[sms](*\#*) perl -pi -e "s/network:.*/network: ${internal_network}/" /etc/warewulf/warewulf.conf
[sms](*\#*) perl -pi -e "s/range start:.*/range start: ${c_ip[0]}/" /etc/warewulf/warewulf.conf
[sms](*\#*) perl -pi -e "s/range start:.*/range start: ${c_ip[$((num_computes-1))]}/" /etc/warewulf/warewulf.conf
[sms](*\#*) perl -pi -e "s/range end:.*/range end: ${c_ip[$((num_computes-1))]}/" /etc/warewulf/warewulf.conf
[sms](*\#*) perl -pi -e "s/mount: false/mount: true/" /etc/warewulf/warewulf.conf

# Configure /etc/hostname on master and compute nodes
Expand Down
25 changes: 5 additions & 20 deletions docs/recipes/install/common/warewulf4_slurm_test_job.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,22 @@
% end_ohpc_run

\Warewulf{} installs a utility on the compute nodes to automatically
synchronize known files from the provisioning server at five minute intervals. In this
recipe, recall that we previously registered credential files with Warewulf (e.g. passwd,
group, and shadow) so that these files would be propagated during compute node
imaging. However, with the addition of a new ``test'' user above, the files
have been outdated and we need to update the Warewulf database to incorporate
the additions. This re-sync process can be accomplished as follows:
synchronize overlay files from the provisioning server at one minute intervals.
To rebuild the overlay, run the following:

% begin_ohpc_run
\begin{lstlisting}[language=bash,keywords={}]
[sms](*\#*) wwsh file resync passwd shadow group
[sms](*\#*) wwctl overlay build
\end{lstlisting}
% end_ohpc_run

% begin_ohpc_run
% ohpc_command sleep 2
% end_ohpc_run

\begin{center}
\begin{tcolorbox}[]
\small
After re-syncing to notify Warewulf of file modifications made on the {\em
master} host, it should take approximately 5 minutes for the changes to
propagate. However, you can also manually pull the changes from compute nodes
via the following:
% begin_ohpc_run
\begin{lstlisting}[language=bash,keywords={}]
[sms](*\#*) pdsh -w ${compute_prefix}[1-${num_computes}] /warewulf/bin/wwgetfiles
\end{lstlisting}
% end_ohpc_run
\end{tcolorbox}
\end{center}
master} host, it should take approximately one minute for the changes to
propagate.

\input{common/prun}

Expand Down
18 changes: 12 additions & 6 deletions docs/recipes/install/parse_doc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

# Determine BaseOS, arch, and define package manager commands
my $BaseOS = "";
my $BaseOSTag = "";
my $BaseOSshort = "";
my $OSimage = "";
my $arch = "";
Expand Down Expand Up @@ -81,6 +82,8 @@
$groupChrootInstall = $1;
} elsif( $line =~ /\\newcommand\{\\baseos\}\{(.+)\}/ ) {
$BaseOS = $1;
} elsif( $line =~ /\\newcommand\{\\baseostag\}\{(.+)\}/ ) {
$BaseOSTag = $1;
} elsif( $line =~ /\\newcommand\{\\baseosshort\}\{(.+)\}/ ) {
$BaseOSshort = $1;
} elsif( $line =~ /\\newcommand\{\\osimage\}\{(.+)\}/ ) {
Expand All @@ -105,6 +108,7 @@
# print "groupInstall = $groupInstall\n";
# print "groupChrootInstall = $groupChrootInstall\n";
# print "BaseOS = $BaseOS\n";
# print "BaseOSTa = $BaseOSTag\n";
# print "VERLONG = $verlong\n";
# print "OSTree = $OSTree\n";
# print "IMAGE = $image\n";
Expand Down Expand Up @@ -169,20 +173,22 @@
# <<- indicates the HERE document will ignore leadings tabs (not spaces)
} elsif( $_ =~ /$prompt (.+ <<-[ ]*([^ ]+).*)$/ ) {
my $cmd = update_cmd($1);
chomp $cmd;
my $here = $2;
chomp $here;

# commands that begin with a % are for CI only
next if( $_ =~ /^%/ && !$ci_run );

print $fh ' ' x $indent . "$cmd\n";
my $next_line;
do {
$next_line = <IN>;
# trim leading and trailing space
$next_line =~ s/^\s+|\s+$//g;
do {
$next_line = <IN>;
# trim leading and trailing space
$next_line =~ s/^\s+|\s+$//g;

print $fh "$next_line\n";
} while( $next_line !~ /^$here/ );
print $fh "$next_line\n";
} while( $next_line !~ /^$here/ );

# handle commands line line continuation: prompt$ command \
} elsif( $_ =~ /$prompt (.+) \\$/ ) {
Expand Down
13 changes: 6 additions & 7 deletions docs/recipes/install/rocky9/x86_64/warewulf4/slurm/steps.tex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
\newcommand{\chrootclean}{dnf --installroot=\$CHROOT clean expire-cache}
\newcommand{\install}{dnf -y install}
\newcommand{\chrootinstall}{dnf -y --installroot=\$CHROOT install}
\newcommand{\containerinstall}{wwctl container exec \baseos{} /bin/bash <<EOF}
\newcommand{\groupinstall}{dnf -y groupinstall}
\newcommand{\groupchrootinstall}{dnf -y --installroot=\$CHROOT groupinstall}
\newcommand{\remove}{dnf -y remove}
Expand Down Expand Up @@ -136,17 +135,17 @@ \subsubsection{Add \OHPC{} components} \label{sec:add_components}
% begin_ohpc_run
% ohpc_validation_comment Add SLURM and other components to compute instance
\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true,literate={BOSVER}{\baseos{}}1]
[sms](*\#*) (*\containerinstall*)
[sms](*\#*) wwctl container exec rocky-9.4 /bin/bash <<- EOF
# Add Slurm client support meta-package and enable munge and slurmd
(*\install*) ohpc-slurm-client
dnf -y install ohpc-slurm-client
systemctl enable munge
systemctl enable slurmd

# Add Network Time Protocol (NTP) support
(*\install*) chrony
dnf -y intall chrony

# Include modules user environment
(*\install*) lmod-ohpc
dnf -y intall lmod-ohpc

# defer image rebuild
/bin/false
Expand Down Expand Up @@ -224,7 +223,7 @@ \subsubsection{Import files} \label{sec:file_import}
\input{common/import_ww4_files}
%\vspace*{0.3cm}
\input{common/import_ww4_files_slurm}
\input{common/import_ww_files_ib_centos}
\input{common/import_ww4_files_ib_centos}
%\vspace*{0.3cm}
\input{common/finalize_warewulf4_provisioning}
%\vspace*{0.2cm}
Expand Down Expand Up @@ -277,7 +276,7 @@ \section{Post-boot compute node configuration} \label{sec:post_boot}
\input{common/post_boot}

\section{Run a Test Job} \label{sec:test_job}
\input{common/slurm_test_job}
\input{common/warewulf4_slurm_test_job}

\clearpage
\appendix
Expand Down

0 comments on commit a714518

Please sign in to comment.