Skip to content

Commit

Permalink
Merge pull request #122 from lsst-it/IT-2204/lsst-daq-dispatch
Browse files Browse the repository at this point in the history
add NM dispatch script for DAQ interface device params
  • Loading branch information
jhoblitt committed May 1, 2020
2 parents 94d4c0c + 98e99e7 commit 51771f4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 15 deletions.
41 changes: 26 additions & 15 deletions site/profile/manifests/ccs/daq_interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
String $was,
Enum['dhcp-client', 'dhcp-server'] $mode,
) {
$interface = 'lsst-daq'

$netconf = $mode ? {
'dhcp-client' => {
Expand All @@ -20,15 +21,14 @@
},
}

network::interface { 'lsst-daq':
defroute => 'no', # this was yes on comcam-fp01
ethtool_opts => '--set-ring ${DEVICE} rx 4096 tx 4096; --pause ${DEVICE} autoneg off rx on tx on',
hwaddr => $hwaddr,
ipv6init => 'no',
onboot => true,
type => 'Ethernet',
uuid => $uuid,
* => $netconf,
network::interface { $interface:
defroute => 'no', # this was yes on comcam-fp01
hwaddr => $hwaddr,
ipv6init => false,
onboot => true,
type => 'Ethernet',
uuid => $uuid,
* => $netconf,
}

network::interface { $was:
Expand All @@ -37,18 +37,29 @@

# restarting the network service isn't sufficent to rename an existing
# interface. The host has to be rebooted.
$daq_int = $facts['networking']['interfaces']['lsst-daq']

unless ($daq_int) {
notify { 'lsst-daq network interface is missing':
unless ($facts['networking']['interfaces'][$interface]) {
notify { "${interface} network interface is missing":
notify => Reboot['lsst-daq'],
}
}

Class['network']
~> reboot { 'lsst-daq':
-> reboot { $interface:
apply => finished,
message => 'setup lsst-daq network interface',
message => "setup ${interface} network interface",
when => refreshed,
}

# NM apears to ignore ETHTOOL_OPTS and requires a dispatch script to be used
# to set device parameters
$ptitle = regsubst($title, '::', '/', 'G')
$file = '30-ethtool'

# XXX we need to have a discussion as to wether or not it is appropriate for
# a template to live in a profile.
file { "/etc/NetworkManager/dispatcher.d/${file}":
ensure => file,
content => epp("${ptitle}/${file}", {'interface' => $interface}),
mode => '0755',
}
}
24 changes: 24 additions & 0 deletions site/profile/templates/ccs/daq_interface/30-ethtool.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<%- | String $interface | -%>
#!/bin/sh

# This file is managed by Puppet; changes may be overwritten

# https://access.redhat.com/solutions/2841131

myname=${0##*/}
log() { logger -p user.info -t "${myname}" "$*"; }
IFACE=$1
ACTION=$2

log "IFACE = $1, ACTION = $2"

DAQ=<%= $interface %>

if [ "$IFACE" == "$DAQ" ] && [ "$ACTION" == "up" ]; then
log "ethool set-ring ${IFACE} rx 4096 tx 4096"
/sbin/ethtool --set-ring ${IFACE} rx 4096 tx 4096
log "ethool pause ${IFACE} autoneg off rx on tx on"
/sbin/ethtool --pause ${IFACE} autoneg off rx on tx on
fi

exit 0

0 comments on commit 51771f4

Please sign in to comment.