[ovs-dev] [mointor2 8/9] lib: add monitor2 support in ovsdb-idl.

Andy Zhou azhou at nicira.com
Tue Nov 24 10:27:48 UTC 2015


On Tue, Nov 10, 2015 at 9:45 AM, Ben Pfaff <blp at ovn.org> wrote:
> On Wed, Oct 21, 2015 at 09:45:30PM -0700, Andy Zhou wrote:
>> Add support for monitor2. When idl starts to run, monitor2 will be
>> attempted first. In case the server is an older version that does
>> not recognize monitor2.  IDL will then fall back to use "monitor"
>> method.
>>
>> Signed-off-by: Andy Zhou <azhou at nicira.com>
>
> One more thing, there's a bit of code that can be factored out of two
> switch cases into common code:
>
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index 1a30ad4..0a0c73a 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -358,11 +358,12 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
>          } else if (msg->type == JSONRPC_REPLY
>                     && idl->request_id
>                     && json_equal(idl->request_id, msg->id)) {
> +            json_destroy(idl->request_id);
> +            idl->request_id = NULL;
> +
>              switch (idl->state) {
>              case IDL_S_SCHEMA_REQUESTED:
>                  /* Reply to our "get_schema" request. */
> -                json_destroy(idl->request_id);
> -                idl->request_id = NULL;
>                  idl->schema = json_clone(msg->result);
>                  ovsdb_idl_send_monitor2_request(idl);
>                  idl->state = IDL_S_MONITOR2_REQUESTED;
> @@ -372,8 +373,6 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
>              case IDL_S_MONITOR2_REQUESTED:
>                  /* Reply to our "monitor" or "monitor2" request. */
>                  idl->change_seqno++;
> -                json_destroy(idl->request_id);
> -                idl->request_id = NULL;
>                  ovsdb_idl_clear(idl);
>                  if (idl->state == IDL_S_MONITOR_REQUESTED) {
>                      idl->state = IDL_S_MONITORING;

Thanks, folded in V2



More information about the dev mailing list