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 diff --git a/lbnl-nhc.spec.in b/lbnl-nhc.spec.in index c65cf31..6844acb 100644 --- a/lbnl-nhc.spec.in +++ b/lbnl-nhc.spec.in @@ -1,12 +1,39 @@ %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 +# info that's calculated for {spec_rel} below. This allows us to +# build out-of-tree with the same Git info. %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}} -%{!?rel:%{expand:%%global rel %(if test -z "%{spec_rel}" ; then echo "%{gitrelease}" ; else echo "%{spec_rel}" ; fi)}} +# {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} 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} 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 #######################################################################