From 72b50bf7ed54fdbeeb96ebec1e70b211e120bd8e Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Fri, 10 Jul 2015 15:58:27 -0700 Subject: [PATCH 1/4] nodediag.service: add systemd service file --- nodediag.service | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nodediag.service diff --git a/nodediag.service b/nodediag.service new file mode 100644 index 0000000..36cedb5 --- /dev/null +++ b/nodediag.service @@ -0,0 +1,9 @@ +[Unit] +Description=Nodediag +After=syslog.target network.target + +[Service] +ExecStart=/usr/bin/nodediag -s -v + +[Install] +WantedBy=multi-user.target From 8e8343a7b9f14a99d41d7886cefcd9f04bfde726 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Fri, 10 Jul 2015 15:59:33 -0700 Subject: [PATCH 2/4] prep for 1.2.17 release --- META | 2 +- NEWS | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/META b/META index ff8c461..d352fc0 100644 --- a/META +++ b/META @@ -3,5 +3,5 @@ ## Meta: 1 Name: nodediag - Version: 1.2.16 + Version: 1.2.17 Release: 1 diff --git a/NEWS b/NEWS index fbdd37f..67d49b2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +========================================================================= +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 ========================================================================= From 9aeaab2e1bc2d54687df49aad874ac2bad7ede3b Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Tue, 6 Oct 2015 14:40:36 -0700 Subject: [PATCH 3/4] diags: handle rhel7 network device naming Modify the network.t diag to find all network devices (not just eth* ib*) that have a /sys/class/net/${device}/device (indicating a "real" device). For each device, emit MTU, MODE, DUPLEX, or SPEED values if they exist in /sys/class/net/${device}. This subsumes the functionality of ethernet.t. --- diags/ethernet.t | 115 ----------------------------------------------- diags/network.t | 58 ++++++++++++++++-------- 2 files changed, 39 insertions(+), 134 deletions(-) delete mode 100755 diags/ethernet.t diff --git a/diags/ethernet.t b/diags/ethernet.t deleted file mode 100755 index cc49255..0000000 --- a/diags/ethernet.t +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2010, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# Written by Jim Garlick . -# LLNL-CODE-461827 -# All rights reserved. -# -# This file is part of nodediag. -# For details, see http://code.google.com/p/nodediag. -# Please also read the files DISCLAIMER and COPYING supplied with nodediag. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# terms and conditions of the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## - -# FIXME: is this test redundant with network.t? Should it go away/ - -PATH=/sbin:/bin:/usr/sbin:/usr/bin - -declare -r description="Check ethernet config" - -source ${NODEDIAGDIR:-/etc/nodediag.d}/functions-tap || exit 1 - -getlink() -{ - ethtool $dev 2>/dev/null| awk '/Link detected:/ { print $3 }' -} -getspeed() -{ - ethtool $dev | awk '/Speed:/ { print $2 }' -} -getduplex() -{ - ethtool $dev | awk '/Duplex:/ { print $2 }' -} - -diagconfig () -{ - - [ $(id -u) -eq 0 ] || return 1 - which ethtool >/dev/null 2>&1 || return 1 - - local file dev link speed duplex - local i=0 - - shopt -s nullglob - for file in /sys/class/net/eth*; do - dev=${file##*/} - link=$(getlink $dev) - [ "$link" == "yes" ] || continue - speed=$(getspeed $dev) - duplex=$(getduplex $dev) - echo "DIAG_ETHERNET_DEV[$i]=\"$dev\"" - echo "DIAG_ETHERNET_SPEED[$i]=\"$speed\"" - echo "DIAG_ETHERNET_DUPLEX[$i]=\"$duplex\"" - i=$(($i+1)) - done - shopt -u nullglob -} - -diag_handle_args "$@" -numdev=${#DIAG_ETHERNET_DEV[@]} -[ $(id -u) -eq 0 ] || diag_plan_skip "test requires root" -which ethtool >/dev/null 2>&1 || diag_plan_skip "ethtool is not installed" -[ $numdev -gt 0 ] || diag_plan_skip "not configured" -diag_plan $(($numdev * 3)) - -for i in $(seq 0 $(($numdev - 1))); do - dev=${DIAG_ETHERNET_DEV[$i]} - speed=${DIAG_ETHERNET_SPEED[$i]} - duplex=${DIAG_ETHERNET_DUPLEX[$i]} - gotlink=$(getlink $dev) - if [ "$gotlink" != "yes" ]; then - diag_fail "$dev link $gotlink" - else - diag_ok "$dev link $gotlink" - fi - if [ -n "$speed" ]; then - gotspeed=$(getspeed $dev) - if [ "$speed" != "$gotspeed" ]; then - diag_fail "$dev speed $gotspeed, expected $speed" - else - diag_ok "$dev speed $gotspeed" - fi - else - diag_skip "$dev speed not configured" - fi - - if [ -n "$duplex" ]; then - gotduplex=$(getduplex $dev) - if [ "$duplex" != "$gotduplex" ]; then - diag_fail "$dev duplex $gotduplex, expected $duplex" - else - diag_ok "$dev duplex $gotduplex" - fi - else - diag_skip "$dev duplex not configured" - fi -done -exit 0 - -# vi: expandtab sw=4 ts=4 -# vi: syntax=sh diff --git a/diags/network.t b/diags/network.t index 95c384e..e33ae1f 100755 --- a/diags/network.t +++ b/diags/network.t @@ -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 () { @@ -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 } @@ -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 @@ -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 From 2035eedb4e0eea0b3a9d255a054d81d63d0de51e Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Wed, 4 Nov 2015 08:23:22 -0800 Subject: [PATCH 4/4] prep for 1.2.18 release --- META | 2 +- NEWS | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/META b/META index d352fc0..e8dad65 100644 --- a/META +++ b/META @@ -3,5 +3,5 @@ ## Meta: 1 Name: nodediag - Version: 1.2.17 + Version: 1.2.18 Release: 1 diff --git a/NEWS b/NEWS index 67d49b2..3fa50c7 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +========================================================================= +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 =========================================================================