ovs: avoid asking nm-sudo if ovsdb socket does not exist

Starting with OVS plugin installed but OVS service stopped, would lead to

   <trace> [1631531732.8896] ovsdb: connect: opening /run/openvswitch/db.sock failed ("error connecting socket (No such file or directory)"). Retry with nm-sudo
   ...
   <trace> [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.
This commit is contained in:
Thomas Haller 2021-09-13 22:43:10 +02:00
parent d7c0dcc7b4
commit 3a3613b561
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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,