Commit 126ef78e authored by David Johnson's avatar David Johnson

Better handle systemd-networkd chattiness in control net search.

systemd-networkd and friends have become very chatty.  This commit
is about turning down the noise.  It also removes PreferredLiftime=forever
because it is no longer valid where it used to be, and cannot be used
apparently in the DHCP case.  Seems that the default is now "forever"
anyway, so it's now irrelevant to us.  (Older systemd-networkds would
set the address lifetime to the advertised lease.)

We also only mark an iface with CriticalConnection=yes once that iface
has been chosen as the control net.  We used to just mark them all
in the udev helper so that we didn't have to modify the generated
config after successful detection, but now systemd-networkd complains
about bringing down a searched-but-not-control-net interface if
it is critical.  So, avoid that.

Finally, I added `-q` to our invocation of systemd-networkd-wait-online,
and increased the timeout with which we call it.  Timeout increase is
because we would get spurious event loop disconnect messages without it;
and q to quiet it in other ways.  Ugh.
parent fccfee60
......@@ -18,6 +18,9 @@ fi
# We have specific code in that is run from
# emulab-networkd-online@.service that checks to see if this file was
# used or not; we only handle the iface there if this file got used.
# NB: CriticalConnection=yes is added later by to
# the config file for the control net iface before systemd-networkd
# is restarted; thus, it does not appear below.
mkdir -p /run/systemd/network
cat <<EOF > /run/systemd/network/${iface}.network
......@@ -29,8 +32,6 @@ Description=Emulab control net search on $iface
......@@ -31,13 +31,20 @@ while [ ! $found -eq 1 ]; do
# means we have to check *which* interface came up; this is how we
# determine if it was our interface or not.
/lib/systemd/systemd-networkd-wait-online -i "$iface" --timeout 2 > /dev/null 2>&1
/lib/systemd/systemd-networkd-wait-online --ignore=lo -q -i "$iface" --timeout 20 > /dev/null 2>&1
#networkctl status | grep -qi 'state: *routable'
if [ $? -eq 0 ]; then
networkctl status "$iface" | grep -qi configured
if [ $? -eq 0 ]; then
echo "`date`: ${iface}: control net is us" >>$LOGFILE 2>&1
mkdir -p /run/emulab
echo "$iface" > /run/cnet
# We only add the CriticalConnection bit once we have the cnet
# iface detected, because newer systemd-networkd whines a lot
# when the other searched-but-not-found interfaces are taken down.
echo "CriticalConnection=yes" >> /run/systemd/network/${iface}.network
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment