From 7c80bc891f83fe56410b238d8909092c191fa97a Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Mon, 31 May 2021 19:16:59 -0600 Subject: [PATCH 1/6] lbnl-nhc.spec.in: Fix rebuild release handling While the initial builds directly from the Git repository were working correctly, rebuilds of the resulting artifacts were not. These changes remove the erroneous outside-repo output so that out-of-tree RPM builds use the recorded metadata (i.e., `%{gitrelease}`) as intended. This should be the final tweak prior to the 1.4.3 release. (Hopefully I didn't just jinx myself by saying that.) --- lbnl-nhc.spec.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lbnl-nhc.spec.in b/lbnl-nhc.spec.in index 31fd0ed..f5f86c7 100644 --- a/lbnl-nhc.spec.in +++ b/lbnl-nhc.spec.in @@ -3,9 +3,9 @@ %global release %{rel}%{?dist} %global gitrelease @GITRELEASE@ -%{expand:%%global gd_rel_delta %(git describe --abbrev=4 --always --tags --long --match '[[:digit:]][[:alnum:].]*[[:alnum:]]' --dirty=.1 | cut -d- -f 2- | tr '-' '.')} -%{expand:%%global rel_pre_post %(git describe --tags HEAD | grep -Eq '^%{version}' >&/dev/null && echo 1. || echo 0.)} -%{expand:%%global spec_rel %{rel_pre_post}%{gd_rel_delta}} +%{expand:%%global gd_rel_delta %(GD1=`git describe --abbrev=4 --always --tags --long --match '[[:digit:]][[:alnum:].]*[[:alnum:]]' --dirty=.1 2>/dev/null` ; test -n "${GD1}" && echo "${GD1}" | cut -d- -f 2- | tr '-' '.')%%{nil}} +%{expand:%%global rel_pre_post %(GD2=`git describe --tags HEAD 2>/dev/null` ; if test -n "${GD2}" ; then echo "${GD2}" | grep -Eq '^%{version}' >&/dev/null && echo 1. || echo 0. ; fi)%%{nil}} +%{expand:%%global spec_rel %{?rel_pre_post}%{?gd_rel_delta}%%{nil}} %{!?rel:%{expand:%%global rel %(if test -z "%{spec_rel}" ; then echo "%{gitrelease}" ; else echo "%{spec_rel}" ; fi)}} %{!?sname:%global sname nhc} From c29cfb80f1434d3a362fb4418b036375763cf2c9 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Thu, 3 Jun 2021 00:26:40 -0600 Subject: [PATCH 2/6] lbnl-nhc.spec.in: Special-case tagged release If the current version being built (as specified in `configure.ac` and assigned to `%{version}`) exactly matches the tag for that same version in the Git repository, swap out the normal Git-based `%{rel}` string for simply "1" if the working directory is clean or "1.1" if it's dirty. (The disttag is, of course, appended in all cases.) Additionally, since the Git-fu that generates all this stuff isn't exactly obvious, I added several detailed comments to describe what each macro is doing and why. --- lbnl-nhc.spec.in | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lbnl-nhc.spec.in b/lbnl-nhc.spec.in index f5f86c7..6efbded 100644 --- a/lbnl-nhc.spec.in +++ b/lbnl-nhc.spec.in @@ -2,11 +2,38 @@ %global version @VERSION@ %global release %{rel}%{?dist} +### Macros to populate RPM %{RELEASE} field with useful info +# {gitrelease} holds the ./configure-generated version of the same +# info that's calculated for {spec_rel} below. This allows us to +# build out-of-tree with the same Git info. %global gitrelease @GITRELEASE@ +# {gd_rel_delta} uses "git describe" to return a string in the form +# ".g[.1]?" to be used in {spec_rel} below. %{expand:%%global gd_rel_delta %(GD1=`git describe --abbrev=4 --always --tags --long --match '[[:digit:]][[:alnum:].]*[[:alnum:]]' --dirty=.1 2>/dev/null` ; test -n "${GD1}" && echo "${GD1}" | cut -d- -f 2- | tr '-' '.')%%{nil}} +# {rel_pre_post} gets set to either "1." or "0." based on whether the +# source was built from a commit before ("0.") or after ("1.") the +# tagged release specified by {version} above. %{expand:%%global rel_pre_post %(GD2=`git describe --tags HEAD 2>/dev/null` ; if test -n "${GD2}" ; then echo "${GD2}" | grep -Eq '^%{version}' >&/dev/null && echo 1. || echo 0. ; fi)%%{nil}} +# {spec_rel} combines the two values above into a single string for +# use in the "Release:" field. The resulting string, when used at the +# beginning of the "Release:" header value, not only guarantees +# correct RPM NEVR ordering (i.e., newer packages will always upgrade +# older ones) but also shows how many were made since the +# last tagged release, the Git commit from which the source +# tarball ("Source:" below) was built, and whether the tarball also +# contains some uncommitted changes from a "dirty" working tree (".1" +# on the end). %{expand:%%global spec_rel %{?rel_pre_post}%{?gd_rel_delta}%%{nil}} -%{!?rel:%{expand:%%global rel %(if test -z "%{spec_rel}" ; then echo "%{gitrelease}" ; else echo "%{spec_rel}" ; fi)}} +# {rel} ultimately determines what the release string will be; only +# the disttag gets appended to it. If the user specifies their own +# value (e.g., "rpmbuild --define 'rel 1'"), that value is used +# instead. If not, the string described above is pulled either from +# {spec_rel} (if building from Git repo) or {gitrelease} (if building +# from SRPM or source tarball). +# As a special case, if the commit being built exactly matches the Git +# tag for the specified version, {rel} is set to either "1" (clean +# working directory) or "1.1" (dirty working directory). +%{!?rel:%{expand:%%global rel %(REL="%{?spec_rel}%{!?spec_rel:%{gitrelease}}" ; if (echo "${REL:-nope}" | grep -Fq "1.0.g" 2>/dev/null) ; then if (echo "${REL:-nope}" | grep -q '\.1$' 2>/dev/null) ; then echo "1.1" ; else echo 1 ; fi ; elif test -z "%{spec_rel}" ; then echo "%{gitrelease}" ; else echo "%{spec_rel}" ; fi)%{nil}}} %{!?sname:%global sname nhc} %{!?nhc_script_dir:%global nhc_script_dir %{_sysconfdir}/%{sname}/scripts} From ebb9e86651446fb8133370eb7f5dde6fdc734eec Mon Sep 17 00:00:00 2001 From: Bas van der Vlies Date: Tue, 12 Oct 2021 13:25:15 +0200 Subject: [PATCH 3/6] node-mark-offline case statement syntax error --- helpers/node-mark-offline | 1 + 1 file changed, 1 insertion(+) diff --git a/helpers/node-mark-offline b/helpers/node-mark-offline index 36219da..568ccc4 100644 --- a/helpers/node-mark-offline +++ b/helpers/node-mark-offline @@ -67,6 +67,7 @@ elif [[ "$NHC_RM" == "slurm" ]]; then # These states aren't handled yet. echo "$0: State \"$STATUS\" not yet handled; ignoring." exit 0 + ;; alloc*|comp*|drain*|drng*|fail*|idle*|maint*|mix*|resume*|resv*|undrain*) case "$STATUS" in drain*|drng*|fail*|maint*) From d534d41db4237b018f18a3063c4ceb86b91fbe42 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Tue, 21 Dec 2021 19:02:58 -0700 Subject: [PATCH 4/6] helpers: Recognize & ignore new "planned" state Slurm 21.08 has added a *very* welcome new feature called the "planned" state; this state is used to indicate nodes which would otherwise appear "idle" but are being held for a large/high-priority job. This is a frequent source of user confusion and angst (because they would look at the node counts and wonder why their job wasn't running even though enough nodes appeared to be empty), so having this is a big win for user services/consultant staff and scheduler admins everywhere! As with the handling of the `reboot` states, full recognition of this state will be available in 1.4.4 and 1.5, but for now, the helpers will just ignore this state completely. --- helpers/node-mark-offline | 2 +- helpers/node-mark-online | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/node-mark-offline b/helpers/node-mark-offline index 568ccc4..ef9b1b9 100644 --- a/helpers/node-mark-offline +++ b/helpers/node-mark-offline @@ -63,7 +63,7 @@ elif [[ "$NHC_RM" == "slurm" ]]; then OLD_NOTE_LEADER="${LINE[1]}" OLD_NOTE="${LINE[*]:2}" case "$STATUS" in - *'@'*|*'#'*|boot*) + *'@'*|*'#'*|boot*|*-*|plnd*) # These states aren't handled yet. echo "$0: State \"$STATUS\" not yet handled; ignoring." exit 0 diff --git a/helpers/node-mark-online b/helpers/node-mark-online index 407a136..4af85ad 100644 --- a/helpers/node-mark-online +++ b/helpers/node-mark-online @@ -60,7 +60,7 @@ elif [[ "$NHC_RM" == "slurm" ]]; then # Slurm does not run the HealthCheckProgram on nodes in the DOWN state, # but if someone runs NHC by hand, we want to be able to do the right thing. case "$STATUS" in - *'@'*|*'#'*|boot*) + *'@'*|*'#'*|boot*|*-*|plnd*) # These states aren't handled yet. echo "$0: State \"$STATUS\" not yet handled; ignoring." exit 0 From aa0b6a10db248443e0ff6b245b30aa44fef43ff0 Mon Sep 17 00:00:00 2001 From: Ward Poelmans Date: Mon, 18 Apr 2022 20:47:11 +0200 Subject: [PATCH 5/6] first bx release on 1.4.3 --- lbnl-nhc.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbnl-nhc.spec.in b/lbnl-nhc.spec.in index 94127e7..6844acb 100644 --- a/lbnl-nhc.spec.in +++ b/lbnl-nhc.spec.in @@ -1,6 +1,6 @@ %global name @PACKAGE@ %global version @VERSION@ -%global release %{rel}%{?dist}.bx.4 +%global release %{rel}%{?dist}.bx.1 ### Macros to populate RPM %{RELEASE} field with useful info # {gitrelease} holds the ./configure-generated version of the same From 887c276e331164947f43de1a47953d9da08a3fff Mon Sep 17 00:00:00 2001 From: Ward Poelmans Date: Mon, 18 Apr 2022 20:48:44 +0200 Subject: [PATCH 6/6] add ib speed check --- nhc.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nhc.conf b/nhc.conf index 7bddfa1..948ffae 100644 --- a/nhc.conf +++ b/nhc.conf @@ -78,6 +78,7 @@ # Check that there's an ib interface with the correvt speed * || if [ ! -z ${NHC_IB_DEV+x} ]; then check_hw_eth $NHC_IB_DEV; fi +* || if [ ! -z ${NHC_IB_SPEED+x} ]; then check_hw_ib $NHC_IB_SPEED; fi #######################################################################