fix: stop-dev.sh must not stop OVS when br-external has WAN IP

When setup-ovn.sh migrates the host's WAN IP to br-external, stopping
openvswitch-switch destroys the bridge and the host loses all network
connectivity — unreachable via SSH, requires console reboot.

Now checks if br-external has an IP before stopping OVS. If it does,
skip the OVS stop and only stop ovn-controller + ovn-central. OVS is
infrastructure — bridges must survive service stop/start cycles.

Discovered during 3-node E2E testing: stop-dev.sh killed all 3 nodes'
WAN connectivity simultaneously.
This commit is contained in:
Ben Duncan
2026-03-20 06:55:23 +00:00
parent 0d4a70ef28
commit bb9e8db386
+11 -1
View File
@@ -150,13 +150,23 @@ has_service "predastore" && stop_service "predastore" "$PID_DIR"
has_service "nats" && stop_service "nats" "$PID_DIR"
# Stop OVN networking (prevents idle CPU burn when spinifex isn't running)
# CRITICAL: Do NOT stop openvswitch-switch if br-external has an IP.
# When setup-ovn.sh migrates the host's WAN IP to br-external, stopping OVS
# destroys the bridge and the host loses all WAN connectivity (unreachable via SSH).
# OVS is infrastructure — only stop ovn-controller and ovn-central.
if pidof systemd >/dev/null 2>&1; then
echo "🛑 Stopping OVN networking..."
sudo systemctl stop ovn-controller 2>/dev/null && echo "✅ ovn-controller stopped" || true
if systemctl is-active --quiet ovn-central 2>/dev/null; then
sudo systemctl stop ovn-central 2>/dev/null && echo "✅ ovn-central stopped" || true
fi
sudo systemctl stop openvswitch-switch 2>/dev/null && echo "✅ openvswitch-switch stopped" || true
# Only stop OVS if br-external does NOT have an IP (safe to tear down)
if sudo ovs-vsctl br-exists br-external 2>/dev/null && ip -4 addr show br-external 2>/dev/null | grep -q "inet "; then
echo "⚠️ Skipping openvswitch-switch stop (br-external has WAN IP — stopping would kill connectivity)"
else
sudo systemctl stop openvswitch-switch 2>/dev/null && echo "✅ openvswitch-switch stopped" || true
fi
fi
echo ""