Skip to content

Commit 787e6af

Browse files
committed
pbench-metadata-log: do not muck around with hostnames
Fixes #725. pbench-metadata-log used to believe that there is one canonical name for the host and that is what `hostname -s` would return. That is not viable as mentioned in issue #725. It now uses the names that the user supplied when registering the remotes to ssh into those remotes. It retrieves what `hostname -s` returns and stores it as an extra hostname-s field. The indexer will have to be made a bit smarter a) to realize that this is not a tool name and b) to use its value when correlating with what the sos report contains.
1 parent 6ea0782 commit 787e6af

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

agent/util-scripts/pbench-metadata-log

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,21 @@ function metadata_log_tools {
7373
local remotes="$(/bin/ls $pbench_run/tools-$group/ 2> /dev/null | grep @ | sed 's/.*@//
7474
s/:[^:]*$//' | tr '\n' ' ')"
7575

76-
# the remotes may have different names than what the controller uses,
77-
# so go ask them - the names of the remotes in the metadata log have to
78-
# agree with the names of the remotes used when postprocessing the tool
79-
# results, otherwise the indexing will fail.
80-
local rems=""
81-
for remote in $remotes ;do
82-
# if the ssh fails, just leave the name alone
83-
rem=$(ssh $ssh_opts -n $remote hostname -s 2>/dev/null || echo $remote)
84-
rems="$rems $rem"
85-
done
86-
remotes=$rems
87-
8876
# check if the local tools-$group directory includes any local tools
89-
local=0
77+
local_tools=0
9078
if /bin/ls $pbench_run/tools-$group 2> /dev/null | grep -q -v "^remote@" ;then
91-
local=1
79+
local_tools=1
9280
fi
9381

9482
# if yes ...
95-
if [ $local == 1 ] ;then
83+
if [ $local_tools == 1 ] ;then
9684
cat >> $log <<EOF
9785
[tools]
9886
hosts: $hostname $remotes
9987
group: $group
10088
10189
[tools/$hostname]
90+
hostname-s = $hostname
10291
EOF
10392
for tool in $(/bin/ls $pbench_run/tools-$group 2> /dev/null) ;do
10493
# add the options with a space in front, effectively making them continuation
@@ -117,12 +106,21 @@ group: $group
117106
EOF
118107
fi
119108
fi
120-
109+
121110
for remote in $remotes ;do
122111
cat >> $log <<EOF
123112
[tools/$remote]
124113
EOF
125114
mkdir -p $tmpdir/$remote
115+
# the remotes may have different names than what the controller uses,
116+
# so go ask them - the names of the remotes in the metadata log have to
117+
# agree with the names of the remotes used when postprocessing the tool
118+
# results, otherwise the indexing will fail, so we add a hostname-s option
119+
# record the host's preferred name (what hostname -s returns on that
120+
# host) and use that for indexing purposes.
121+
rem=$(ssh $ssh_opts -n $remote hostname -s 2>/dev/null || echo $remote)
122+
# add explicit hostname-s - see issue #725.
123+
echo "hostname-s = $rem" >> $log
126124
scp $ssh_options -r $remote:$pbench_run/tools-$group $tmpdir/$remote > /dev/null
127125
for tool in $(/bin/ls $tmpdir/$remote/tools-$group) ;do
128126
echo $tool: $(cat $tmpdir/$remote/tools-$group/$tool | sed 's/^/ /')

0 commit comments

Comments
 (0)