[ovs-dev] [mointor2 5/9] ovsdb: generate update2 notification for a monitor2 session

Liran Schour LIRANS at il.ibm.com
Mon Nov 2 08:27:28 UTC 2015


"dev" <dev-bounces at openvswitch.org> wrote on 22/10/2015 07:45:27 AM:
> 
> Add functions that can generate "update2" notification for a
> "monitor2" session. "monitor2" and "update2" are RFC 7047 extensions
> deescribed by ovsdb-server(1) manpage. See the manpage changes
> for more details.
> 
> Signed-off-by: Andy Zhou <azhou at nicira.com>

...

> +    } else {
> +        diff_json = json_object_create();
> +        const char *op;
> +
> +        for (i = 0; i < mt->n_columns; i++) {
> +            const struct ovsdb_monitor_column *c = &mt->columns[i];
> +
> +            if (!(type & c->select)) {
> +                /* We don't care about this type of change for this
> +                 * particular column (but we will care about it for 
some
> +                 * other column). */
> +                continue;
> +            }
> +
> +            if (type == OJMS_MODIFY) {
> +                struct ovsdb_datum *diff;
> +
> +                if (!bitmap_is_set(changed, i)) {
> +                    continue;
> +                }
> +
> +                diff = ovsdb_datum_diff(&row->old[i], &row->new[i],
> +                                        &c->column->type);
> +                json_object_put(diff_json, c->column->name,
> +                                ovsdb_datum_to_json(diff, 
&c->column->type));
> +                ovsdb_datum_destroy(diff, &c->column->type);
> +                free(diff);
> +            } else {
> +                if (!ovsdb_datum_is_default(&row->new[i], 
> &c->column->type)) {
> +                    json_object_put(diff_json, c->column->name,
> +                                    ovsdb_datum_to_json(&row->new[i],
> + &c->column->type));
> +                }

Why to use here ovsdb_datum_is_default()? For example if a column is of 
type INTEGER and the value is 0, you will miss that value in the update 
message. Seems like a bug. 





More information about the dev mailing list