]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovs-brcompatd: Add comments to config db transactions
authorJustin Pettit <jpettit@nicira.com>
Wed, 3 Mar 2010 14:02:46 +0000 (06:02 -0800)
committerJustin Pettit <jpettit@nicira.com>
Wed, 3 Mar 2010 14:06:28 +0000 (06:06 -0800)
The ovsdb-tool show-log command is very useful for debugging, since it
shows changes to the database over time.  The bridge compatibility code
was not commenting on the changes it was making, so it was difficult to
determine what a system was doing when bridge ioctls were involved.
This commit adds that annotation.

vswitchd/ovs-brcompatd.c

index 0b0c31ba3005a4a8ce12bc86dcf73eda5913d760..6b6594797a0b59f699158861ecfef5a33447896e 100644 (file)
@@ -463,6 +463,7 @@ add_bridge(struct ovsdb_idl *idl, const struct ovsrec_open_vswitch *ovs,
     struct ovsrec_port *port;
     struct ovsrec_interface *iface;
     struct ovsdb_idl_txn *txn;
+    char *comment;
 
     if (find_bridge(ovs, br_name)) {
         VLOG_WARN("addbr %s: bridge %s exists", br_name, br_name);
@@ -491,6 +492,10 @@ add_bridge(struct ovsdb_idl *idl, const struct ovsrec_open_vswitch *ovs,
 
     txn = ovsdb_idl_txn_create(idl);
 
+    comment = xasprintf("ovs-brcompatd: addbr %s", br_name);
+    ovsdb_idl_txn_add_comment(txn, comment);
+    free(comment);
+
     iface = ovsrec_interface_insert(txn_from_openvswitch(ovs));
     ovsrec_interface_set_name(iface, br_name);
 
@@ -577,6 +582,7 @@ del_bridge(struct ovsdb_idl *idl,
     struct ovsrec_bridge *br = find_bridge(ovs, br_name);
     struct ovsrec_bridge **bridges;
     struct ovsdb_idl_txn *txn;
+    char *comment;
     size_t i, n;
 
     if (!br) {
@@ -586,6 +592,10 @@ del_bridge(struct ovsdb_idl *idl,
 
     txn = ovsdb_idl_txn_create(idl);
 
+    comment = xasprintf("ovs-brcompatd: delbr %s", br_name);
+    ovsdb_idl_txn_add_comment(txn, comment);
+    free(comment);
+
     del_port(br, br_name);
 
     bridges = xmalloc(sizeof *ovs->bridges * ovs->n_bridges);
@@ -728,11 +738,19 @@ handle_port_cmd(struct ovsdb_idl *idl,
         } else {
             do {
                 struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl);
+                char *comment;
+
                 if (add) {
+                    comment = xasprintf("ovs-brcompatd: add-if %s", port_name);
                     add_port(ovs, br, port_name);
                 } else {
+                    comment = xasprintf("ovs-brcompatd: del-if %s", port_name);
                     del_port(br, port_name);
                 }
+
+                ovsdb_idl_txn_add_comment(txn, comment);
+                free(comment);
+
                 error = commit_txn(txn, true);
                 VLOG_INFO_RL(&rl, "%s %s %s: %s",
                              cmd_name, br_name, port_name, strerror(error));
@@ -1182,6 +1200,7 @@ rtnl_recv_update(struct ovsdb_idl *idl,
                 /* Network device is really gone. */
                 struct ovsdb_idl_txn *txn;
                 struct ovsrec_bridge *br;
+                char *comment;
 
                 VLOG_INFO("network device %s destroyed, "
                           "removing from bridge %s", port_name, br_name);
@@ -1195,6 +1214,12 @@ rtnl_recv_update(struct ovsdb_idl *idl,
                 }
 
                 txn = ovsdb_idl_txn_create(idl);
+
+                comment = xasprintf("ovs-brcompatd: destroy port %s",
+                        port_name);
+                ovsdb_idl_txn_add_comment(txn, comment);
+                free(comment);
+
                 del_port(br, port_name);
                 commit_txn(txn, false);
             } else {