diff mbox series

[ovs-dev,v2,09/17] jsonrpc-server: Re-add remotes on role changes.

Message ID 20240109225142.1987981-10-i.maximets@ovn.org
State Accepted
Commit 37ab57b41c0b5e60b67e126a3114345a3da9eac2
Delegated to: Ilya Maximets
Headers show
Series ovsdb-server: Configuration via config-file. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets Jan. 9, 2024, 10:49 p.m. UTC
It is currently not possible for the role to change in runtime
(unless a manual DB transaction is crafted), but it will be with
addition of a config file.

If the role changes, listening socket will be closed, and all
the connections to this remote will be terminated.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 ovsdb/jsonrpc-server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dumitru Ceara Jan. 12, 2024, 4:31 p.m. UTC | #1
On 1/9/24 23:49, Ilya Maximets wrote:
> It is currently not possible for the role to change in runtime
> (unless a manual DB transaction is crafted), but it will be with
> addition of a config file.
> 
> If the role changes, listening socket will be closed, and all
> the connections to this remote will be terminated.
> 
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>  ovsdb/jsonrpc-server.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
> index 81e9e48a0..f3b4961f3 100644
> --- a/ovsdb/jsonrpc-server.c
> +++ b/ovsdb/jsonrpc-server.c
> @@ -330,7 +330,8 @@ ovsdb_jsonrpc_server_set_remotes(struct ovsdb_jsonrpc_server *svr,
>          if (!options) {
>              VLOG_INFO("%s: remote deconfigured", node->name);
>              ovsdb_jsonrpc_server_del_remote(node);
> -        } else if (options->dscp != remote->dscp) {
> +        } else if (options->dscp != remote->dscp
> +                   || !nullable_string_is_equal(options->role, remote->role)) {

I don't think it makes a huge difference but to make it indent a bit
better I would've added another "else if ()".

Up to you though:

Acked-by: Dumitru Ceara <dceara@redhat.com>

>              ovsdb_jsonrpc_server_del_remote(node);
>           }
>      }
diff mbox series

Patch

diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 81e9e48a0..f3b4961f3 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -330,7 +330,8 @@  ovsdb_jsonrpc_server_set_remotes(struct ovsdb_jsonrpc_server *svr,
         if (!options) {
             VLOG_INFO("%s: remote deconfigured", node->name);
             ovsdb_jsonrpc_server_del_remote(node);
-        } else if (options->dscp != remote->dscp) {
+        } else if (options->dscp != remote->dscp
+                   || !nullable_string_is_equal(options->role, remote->role)) {
             ovsdb_jsonrpc_server_del_remote(node);
          }
     }