From 3a3613b5619cfb4638dfe29d3dc08613ac843a2c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 13 Sep 2021 22:43:10 +0200 Subject: [PATCH] ovs: avoid asking nm-sudo if ovsdb socket does not exist Starting with OVS plugin installed but OVS service stopped, would lead to [1631531732.8896] ovsdb: connect: opening /run/openvswitch/db.sock failed ("error connecting socket (No such file or directory)"). Retry with nm-sudo ... [1631531732.9751] ovsdb: connect: failure to get FD from nm-sudo: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code1: error connecting socket (No such file or directory) If we already know that the socket file does not exist, we don't need to ask nm-sudo. That would only make sense, if nm-sudo somehow saw a different file systemd than NetworkManager, but that is (currently) not the case. --- src/core/devices/ovs/nm-ovsdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c index 963fc18988..f4fe14f1b1 100644 --- a/src/core/devices/ovs/nm-ovsdb.c +++ b/src/core/devices/ovs/nm-ovsdb.c @@ -2403,6 +2403,11 @@ _ovsdb_connect_idle(gpointer user_data, GCancellable *cancellable) priv = NM_OVSDB_GET_PRIVATE(self); fd = nm_sudo_utils_open_fd(NM_SUDO_GET_FD_TYPE_OVSDB_SOCKET, &error); + if (fd == -ENOENT) { + _LOGT("connect: opening %s failed (\"%s\")", NM_OVSDB_SOCKET, error->message); + ovsdb_disconnect(self, FALSE, FALSE); + return; + } if (fd < 0) { _LOGT("connect: opening %s failed (\"%s\"). Retry with nm-sudo", NM_OVSDB_SOCKET,