[ovs-dev] [PATCH 2/5] python/ovs/db/idl: counter part of ovsdb_idl_add_table() to SchemaHelper

Isaku Yamahata yamahata at valinux.co.jp
Wed Sep 12 06:17:22 UTC 2012


add register_table method to SchemaHelper as counter part of
ovsdb_idl_add_table().

Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
---
 python/ovs/db/idl.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index e4b98e8..c2278ba 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1224,6 +1224,10 @@ class SchemaHelper(object):
         columns = set(columns) | self._tables.get(table, set())
         self._tables[table] = columns
 
+    def register_table(self, table):
+        assert type(table) is str
+        self._tables[table] = set()  # empty set means all columns in the table
+
     def register_all(self):
         """Registers interest in every column of every table."""
         self._all = True
@@ -1249,6 +1253,10 @@ class SchemaHelper(object):
         assert table_name in schema.tables
         table = schema.tables[table_name]
 
+        if not columns:
+            # empty set means all columns in the table
+            return table
+
         new_columns = {}
         for column_name in columns:
             assert type(column_name) is str
-- 
1.7.1.1




More information about the dev mailing list