Skip to content

Commit

Permalink
Merge pull request #1 from garlick/master
Browse files Browse the repository at this point in the history
RHEL 7 support
  • Loading branch information
garlick committed Nov 4, 2015
2 parents 360cd2c + 2035eed commit 330e4da
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 135 deletions.
2 changes: 1 addition & 1 deletion META
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
##
Meta: 1
Name: nodediag
Version: 1.2.16
Version: 1.2.18
Release: 1
14 changes: 14 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
=========================================================================
Release Notes for nodediag version 1.2.18 04 Nov 2015
=========================================================================

* Drop ethernet.t and update network.t to handle RHEL 7 arbitrary
network device names.

=========================================================================
Release Notes for nodediag version 1.2.17 10 Jul 2015
=========================================================================

* Add really simple systemd.service file.
Output goes to the systemd journal.

=========================================================================
Release Notes for nodediag version 1.2.16 29 Jan 2015
=========================================================================
Expand Down
115 changes: 0 additions & 115 deletions diags/ethernet.t

This file was deleted.

58 changes: 39 additions & 19 deletions diags/network.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ declare -r description="Check network config"

source ${NODEDIAGDIR:-/etc/nodediag.d}/functions-tap || exit 1

getmode()
{
getmode() {
cat /sys/class/net/$1/mode 2>/dev/null
}
getmtu()
{
getmtu() {
cat /sys/class/net/$1/mtu 2>/dev/null
}

getduplex() {
cat /sys/class/net/$1/duplex 2>/dev/null
}
getspeed() {
cat /sys/class/net/$1/speed 2>/dev/null
}

diagconfig ()
{
Expand All @@ -48,20 +51,19 @@ diagconfig ()

shopt -s nullglob
for file in /sys/class/net/*; do
dev=${file##*/}
case $dev in
eth*)
echo "DIAG_NETWORK_DEV[$i]=\"$dev\""
echo "DIAG_NETWORK_MTU[$i]=\"$(getmtu $dev)\""
i=$(($i+1))
;;
ib*)
echo "DIAG_NETWORK_DEV[$i]=\"$dev\""
echo "DIAG_NETWORK_MTU[$i]=\"$(getmtu $dev)\""
echo "DIAG_NETWORK_MODE[$i]=\"$(getmode $dev)\""
i=$(($i+1))
;;
esac
if test -h $file/device; then
dev=${file##*/}
echo "DIAG_NETWORK_DEV[$i]=\"$dev\""
test -n "$(getmtu $dev)" \
&& echo "DIAG_NETWORK_MTU[$i]=\"$(getmtu $dev)\""
test -n "$(getmode $dev)" \
&& echo "DIAG_NETWORK_MODE[$i]=\"$(getmode $dev)\""
test -n "$(getduplex $dev)" \
&& echo "DIAG_NETWORK_DUPLEX[$i]=\"$(getduplex $dev)\""
test -n "$(getspeed $dev)" \
&& echo "DIAG_NETWORK_SPEED[$i]=\"$(getspeed $dev)\""
i=$(($i+1))
fi
done
shopt -u nullglob
}
Expand All @@ -81,6 +83,8 @@ for i in $(seq 0 $(($numdev - 1))); do
dev=${DIAG_NETWORK_DEV[$i]}
mtu=${DIAG_NETWORK_MTU[$i]}
mode=${DIAG_NETWORK_MODE[$i]}
duplex=${DIAG_NETWORK_DUPLEX[$i]}
speed=${DIAG_NETWORK_SPEED[$i]}
if [ -d /sys/class/net/$dev ]; then
diag_ok "$dev exists"
else
Expand All @@ -102,6 +106,22 @@ for i in $(seq 0 $(($numdev - 1))); do
diag_ok "$dev mode '$gotmode'"
fi
fi
if [ -n "$duplex" ]; then
gotduplex="$(getmode $dev)"
if [ "$duplex" != "$gotduplex" ]; then
diag_fail "$dev duplex '$gotduplex', expected '$duplex'"
else
diag_ok "$dev duplex '$gotduplex'"
fi
fi
if [ -n "$speed" ]; then
gotspeed="$(getmode $dev)"
if [ "$speed" != "$gotspeed" ]; then
diag_fail "$dev speed '$gotspeed', expected '$speed'"
else
diag_ok "$dev speed '$gotspeed'"
fi
fi
done

# vi: expandtab sw=4 ts=4
Expand Down
9 changes: 9 additions & 0 deletions nodediag.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Nodediag
After=syslog.target network.target

[Service]
ExecStart=/usr/bin/nodediag -s -v

[Install]
WantedBy=multi-user.target

0 comments on commit 330e4da

Please sign in to comment.