@@ -86,6 +86,7 @@ enum ovsdb_idl_state {
struct ovsdb_idl {
const struct ovsdb_idl_class *class;
struct jsonrpc_session *session;
+ struct uuid uuid;
struct shash table_by_name;
struct ovsdb_idl_table *tables; /* Contains "struct ovsdb_idl_table *"s.*/
unsigned int change_seqno;
@@ -267,6 +268,7 @@ ovsdb_idl_create(const char *remote, const struct ovsdb_idl_class *class,
idl->schema = NULL;
hmap_init(&idl->outstanding_txns);
+ uuid_generate(&idl->uuid);
return idl;
}
@@ -378,7 +380,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
&& !strcmp(msg->method, "update2")
&& msg->params->type == JSON_ARRAY
&& msg->params->u.array.n == 2
- && msg->params->u.array.elems[0]->type == JSON_NULL) {
+ && msg->params->u.array.elems[0]->type == JSON_STRING) {
/* Database contents changed. */
ovsdb_idl_parse_update(idl, msg->params->u.array.elems[1],
OVSDB_UPDATE2);
@@ -421,10 +423,10 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
OVS_NOT_REACHED();
}
} else if (msg->type == JSONRPC_NOTIFY
- && !strcmp(msg->method, "update")
- && msg->params->type == JSON_ARRAY
- && msg->params->u.array.n == 2
- && msg->params->u.array.elems[0]->type == JSON_NULL) {
+ && !strcmp(msg->method, "update")
+ && msg->params->type == JSON_ARRAY
+ && msg->params->u.array.n == 2
+ && msg->params->u.array.elems[0]->type == JSON_STRING) {
/* Database contents changed. */
ovsdb_idl_parse_update(idl, msg->params->u.array.elems[1],
OVSDB_UPDATE);
@@ -943,6 +945,7 @@ ovsdb_idl_send_monitor_request__(struct ovsdb_idl *idl,
struct shash *schema;
struct json *monitor_requests;
struct jsonrpc_msg *msg;
+ char uuid[UUID_LEN + 1];
size_t i;
schema = parse_schema(idl->schema);
@@ -994,10 +997,12 @@ ovsdb_idl_send_monitor_request__(struct ovsdb_idl *idl,
free_schema(schema);
json_destroy(idl->request_id);
+
+ snprintf(uuid, sizeof uuid, UUID_FMT, UUID_ARGS(&idl->uuid));
msg = jsonrpc_create_request(
method,
json_array_create_3(json_string_create(idl->class->database),
- json_null_create(), monitor_requests),
+ json_string_create(uuid), monitor_requests),
&idl->request_id);
jsonrpc_session_send(idl->session, msg);
}
@@ -60,6 +60,7 @@ void ovsdb_idl_set_lock(struct ovsdb_idl *, const char *lock_name);
bool ovsdb_idl_has_lock(const struct ovsdb_idl *);
bool ovsdb_idl_is_lock_contended(const struct ovsdb_idl *);
+const struct uuid * ovsdb_idl_get_monitor_id(const struct ovsdb_idl *);
unsigned int ovsdb_idl_get_seqno(const struct ovsdb_idl *);
bool ovsdb_idl_has_ever_connected(const struct ovsdb_idl *);
void ovsdb_idl_enable_reconnect(struct ovsdb_idl *);
IDL uses now a uuid to specify a monitoring session that is being sent to the server on "monitor_cond" request. This uuid will be used to issue ongoing "monitor_cond_change" requests for this monitoring session. Signed-off-by: Liran Schour <lirans@il.ibm.com> --- lib/ovsdb-idl.c | 17 +++++++++++------ lib/ovsdb-idl.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)