On Thu, Dec 14, 2023 at 11:41 AM Ilya Maximets <[email protected]> wrote: > > On 12/14/23 08:15, Frode Nordahl wrote: > > On Thu, Dec 14, 2023 at 2:05 AM Ilya Maximets <[email protected]> wrote: > >> > >> Store KSON-RPC options for each remote separately, so it will be > > > > s/KSON/JSON > > > >> possible to have different configurations per remote in the future. > >> > >> These are also stored to and loaded from the temporary file that > >> OVSDB is using to restore runtime configuration of the server > >> restarted by the monitor process after a crash. > >> > >> Signed-off-by: Ilya Maximets <[email protected]> > >> --- > >> ovsdb/jsonrpc-server.c | 11 ++++ > >> ovsdb/jsonrpc-server.h | 6 +- > >> ovsdb/ovsdb-server.c | 136 ++++++++++++++++++++++++++++------------- > >> 3 files changed, 110 insertions(+), 43 deletions(-) > >> > >> diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c > >> index 51b7db886..299afbb1d 100644 > >> --- a/ovsdb/jsonrpc-server.c > >> +++ b/ovsdb/jsonrpc-server.c > >> @@ -219,6 +219,17 @@ ovsdb_jsonrpc_default_options(const char *target) > >> return options; > >> } > >> > >> +struct ovsdb_jsonrpc_options * > >> +ovsdb_jsonrpc_options_clone(const struct ovsdb_jsonrpc_options *options) > >> +{ > >> + struct ovsdb_jsonrpc_options *clone; > >> + > >> + clone = xmemdup(options, sizeof *options); > >> + clone->role = nullable_xstrdup(options->role); > >> + > >> + return clone; > >> +} > >> + > >> struct json * > >> ovsdb_jsonrpc_options_to_json(const struct ovsdb_jsonrpc_options *options) > >> { > >> diff --git a/ovsdb/jsonrpc-server.h b/ovsdb/jsonrpc-server.h > >> index 9c49966c1..39366ad70 100644 > >> --- a/ovsdb/jsonrpc-server.h > >> +++ b/ovsdb/jsonrpc-server.h > >> @@ -39,8 +39,10 @@ struct ovsdb_jsonrpc_options { > >> int dscp; /* Dscp value for manager connections */ > >> char *role; /* Role, for role-based access controls */ > >> }; > >> -struct ovsdb_jsonrpc_options * > >> -ovsdb_jsonrpc_default_options(const char *target); > >> +struct ovsdb_jsonrpc_options *ovsdb_jsonrpc_default_options( > >> + const char *target); > >> +struct ovsdb_jsonrpc_options *ovsdb_jsonrpc_options_clone( > >> + const struct ovsdb_jsonrpc_options *); > >> > >> struct json *ovsdb_jsonrpc_options_to_json( > >> const struct ovsdb_jsonrpc_options *) > >> diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c > >> index c294ebe67..7f65cadfe 100644 > >> --- a/ovsdb/ovsdb-server.c > >> +++ b/ovsdb/ovsdb-server.c > >> @@ -101,7 +101,7 @@ static unixctl_cb_func ovsdb_server_get_sync_status; > >> static unixctl_cb_func ovsdb_server_get_db_storage_status; > >> > >> struct server_config { > >> - struct sset *remotes; > >> + struct shash *remotes; > > > > When reading this patch I was looking for the reason for making the > > change from sset to shash. I am sure you do have a good reason, would > > it make sense to state it in the commit message? > > > > Hi, Frode. Thanks for looking at the patches! > > We need to track JSON-RPC options per remote. The sset is a set > of strings, i.e. just a set of remotes themselves, but we need a > way to map options to these remotes, i.e. have a structure where > a string (remote) is stored together with an options structure > (struct ovsdb_jsonrpc_options). This is achieved by using shash, > i.e. a map from a string to a structure. Does that make sense?
It does, I guess I had a momentary lapse of reason thinking sets could contain things. The other question I had was whether we were losing any uniqueness checks by changing this but I see there is a check before adding new ones, so I guess that's covered. Thanks for entertaining my question. -- Frode Nordahl > I agree though that all the options will kind of be the same for > every remote at this point in the patch set, but it is a preparation > for having different options per remote once we have a config file > at the end of a patch set. > > I could add some more words to the commit message in the next > version, sure. > > Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
