[ovs-git] [openvswitch/ovs] 80c121: ovsdb-idl: Support for readonly columns that are f...

GitHub noreply at github.com
Mon Nov 23 16:37:20 UTC 2015

  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 80c12152f30b0598a36198d9ec67a85f2357e623
  Author: Shad Ansari <shad.ansari at hp.com>
  Date:   2015-11-23 (Mon, 23 Nov 2015)

  Changed paths:
    M python/ovs/db/idl.py
    M tests/ovsdb-idl.at
    M tests/test-ovsdb.py

  Log Message:
  ovsdb-idl: Support for readonly columns that are fetched on-demand

There is currently no mechanism in IDL to fetch specific column values
on-demand without having to register them for monitoring. In the case
where the column represent a frequently changing entity (e.g. counter),
and the reads are relatively infrequent (e.g. CLI client), there is a
significant overhead in replication.

This patch adds support in the Python IDL to register a subset of the
columns of a table as "readonly". Readonly columns are not replicated.
Users may "fetch" the readonly columns of a row on-demand. Once fetched,
the columns are not updated until the next fetch by the user. Writes by
the user to readonly columns does not change the value (both locally or
on the server).

The two main user visible changes in this patch are:
  - The SchemaHelper.register_columns() method now takes an optionaly
    argument to specify the subset of readonly column(s)
  - A new Row.fetch(columns) method to fetch values of readonly columns(s)


    # Schema file includes all columns, including readonly
    schema_helper = ovs.db.idl.SchemaHelper(schema_file)

    # Register interest in columns with 'r' and 's' as readonly
    schema_helper.register_columns("simple", [i, r, s], [r, s])

    # Create Idl and jsonrpc, and wait for update, as usual

    # Fetch value of column 'r' for a specific row

    print row.r
    print getattr(row, 'r')

    # Writing to readonly column has no effect (locally or on server)
    row.r = 3
    print row.r     # prints fetched value not 3

Signed-off-by: Shad Ansari <shad.ansari at hp.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>

More information about the git mailing list