Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NM dispatch script for DAQ interface device params #122

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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