[ovs-dev] ovsdb-idl: Use modern form of <monitor-requests>.

Message ID 20180307182635.23290-1-blp@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev] ovsdb-idl: Use modern form of <monitor-requests>.
Related show

Commit Message

Ben Pfaff March 7, 2018, 6:26 p.m.
Long ago, a <monitor-requests> object in the OVSDB protocol mapped a table
name to a single <monitor-request>.  Since then, it has mapped a table name
to an *array of* <monitor-request> objects, but the OVSDB IDL has never
been updated to use the modern form.  This commit makes that change.

Reported-by: Anil Jangam <anilj.mailing@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 AUTHORS.rst          | 1 +
 lib/ovsdb-idl.c      | 3 ++-
 python/ovs/db/idl.py | 5 +++--
 3 files changed, 6 insertions(+), 3 deletions(-)

Comments

Justin Pettit March 13, 2018, 12:51 a.m. | #1
> On Mar 7, 2018, at 10:26 AM, Ben Pfaff <blp@ovn.org> wrote:
> 
> Long ago, a <monitor-requests> object in the OVSDB protocol mapped a table
> name to a single <monitor-request>.  Since then, it has mapped a table name
> to an *array of* <monitor-request> objects, but the OVSDB IDL has never
> been updated to use the modern form.  This commit makes that change.
> 
> Reported-by: Anil Jangam <anilj.mailing@gmail.com>
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Acked-by: Justin Pettit <jpettit@ovn.org>

--Justin
Ben Pfaff March 14, 2018, 6:27 p.m. | #2
On Mon, Mar 12, 2018 at 05:51:23PM -0700, Justin Pettit wrote:
> 
> > On Mar 7, 2018, at 10:26 AM, Ben Pfaff <blp@ovn.org> wrote:
> > 
> > Long ago, a <monitor-requests> object in the OVSDB protocol mapped a table
> > name to a single <monitor-request>.  Since then, it has mapped a table name
> > to an *array of* <monitor-request> objects, but the OVSDB IDL has never
> > been updated to use the modern form.  This commit makes that change.
> > 
> > Reported-by: Anil Jangam <anilj.mailing@gmail.com>
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> 
> Acked-by: Justin Pettit <jpettit@ovn.org>

Thanks, applied to master.

Patch

diff --git a/AUTHORS.rst b/AUTHORS.rst
index f6bf68c91bc0..dc69ba3f3c1f 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -393,6 +393,7 @@  André Ruß                       andre.russ@hybris.com
 Andreas Beckmann                debian@abeckmann.de
 Andrei Andone                   andrei.andone@softvision.ro
 Andrey Korolyov                 andrey@xdel.ru
+Anil Jangam                     anilj.mailing@gmail.com
 Anshuman Manral                 anshuman.manral@outlook.com
 Anton Matsiuk                   anton.matsiuk@gmail.com
 Anup Khadka                     khadka.py@gmail.com
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index b027f8cad35d..642ce66f9e0f 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -1600,7 +1600,8 @@  ovsdb_idl_send_monitor_request__(struct ovsdb_idl *idl,
                 json_object_put(monitor_request, "where", where);
                 table->cond_changed = false;
             }
-            json_object_put(monitor_requests, tc->name, monitor_request);
+            json_object_put(monitor_requests, tc->name,
+                            json_array_create_1(monitor_request));
         }
     }
     free_schema(schema);
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 5a4d129c0e13..ddc9cb517352 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -425,10 +425,11 @@  class Idl(object):
                         (table.name in self.readonly) and
                         (column not in self.readonly[table.name])):
                     columns.append(column)
-            monitor_requests[table.name] = {"columns": columns}
+            monitor_request = {"columns": columns}
             if method == "monitor_cond" and table.condition != [True]:
-                monitor_requests[table.name]["where"] = table.condition
+                monitor_request["where"] = table.condition
                 table.cond_change = False
+            monitor_requests[table.name] = [monitor_request]
 
         msg = ovs.jsonrpc.Message.create_request(
             method, [self._db.name, str(self.uuid), monitor_requests])