2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

ovsdb: Add OVSDB server per instance UUID.

Currently, there is no way for an OVSDB server to ID itself. This patch
adds a UUID field that is populated every time OVSDB server runs.
Later patch will make use this UUID to detect and stop and OVSDB server
from replicating itself.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Andy Zhou 2017-02-06 12:43:35 -08:00
parent ac5d315cd8
commit 64fada2601
4 changed files with 15 additions and 0 deletions

View File

@ -1575,6 +1575,12 @@ ovsdb_jsonrpc_create_notify(const struct ovsdb_jsonrpc_monitor *m,
return jsonrpc_create_notify(method, params);
}
const struct uuid *
ovsdb_jsonrpc_server_get_uuid(const struct ovsdb_jsonrpc_server *s)
{
return &s->up.uuid;
}
static void
ovsdb_jsonrpc_monitor_flush_all(struct ovsdb_jsonrpc_session *s)
{

View File

@ -22,6 +22,7 @@
struct ovsdb;
struct shash;
struct simap;
struct uuid;
struct ovsdb_jsonrpc_server *ovsdb_jsonrpc_server_create(bool read_only);
bool ovsdb_jsonrpc_server_add_db(struct ovsdb_jsonrpc_server *,
@ -71,6 +72,9 @@ bool ovsdb_jsonrpc_server_is_read_only(struct ovsdb_jsonrpc_server *);
void ovsdb_jsonrpc_server_get_memory_usage(const struct ovsdb_jsonrpc_server *,
struct simap *usage);
const struct uuid *ovsdb_jsonrpc_server_get_uuid(
const struct ovsdb_jsonrpc_server *);
struct ovsdb_jsonrpc_monitor;
void ovsdb_jsonrpc_monitor_destroy(struct ovsdb_jsonrpc_monitor *);
void ovsdb_jsonrpc_disable_monitor_cond(void);

View File

@ -19,6 +19,7 @@
#include "hash.h"
#include "ovsdb.h"
#include "uuid.h"
/* Initializes 'session' as a session within 'server'. */
void
@ -121,6 +122,7 @@ ovsdb_server_init(struct ovsdb_server *server)
{
shash_init(&server->dbs);
hmap_init(&server->locks);
uuid_generate(&server->uuid);
}
/* Adds 'db' to the set of databases served out by 'server'. Returns true if

View File

@ -19,6 +19,7 @@
#include "openvswitch/hmap.h"
#include "openvswitch/list.h"
#include "openvswitch/shash.h"
#include "openvswitch/uuid.h"
struct ovsdb;
struct ovsdb_server;
@ -79,6 +80,8 @@ bool ovsdb_lock_waiter_is_owner(const struct ovsdb_lock_waiter *);
struct ovsdb_server {
struct shash dbs; /* Maps from a db name to a "struct ovsdb *". */
struct hmap locks; /* Contains "struct ovsdb_lock"s indexed by name. */
struct uuid uuid; /* Server ID. Generated every time a server is
launched. */
};
void ovsdb_server_init(struct ovsdb_server *);