ovsdb: Add "comment" feature to transactions and make ovs-vsctl use them.
[cascardo/ovs.git] / utilities / ovs-vsctl.c
index d24844b..bc6e4db 100644 (file)
@@ -1214,7 +1214,7 @@ do_vsctl(int argc, char *argv[], struct ovsdb_idl *idl)
     struct ovsdb_idl_txn *txn;
     const struct ovsrec_open_vswitch *ovs;
     enum ovsdb_idl_txn_status status;
-    struct ds *output;
+    struct ds comment, *output;
     int n_output;
     int i, start;
 
@@ -1223,6 +1223,14 @@ do_vsctl(int argc, char *argv[], struct ovsdb_idl *idl)
         ovsdb_idl_txn_set_dry_run(txn);
     }
 
+    ds_init(&comment);
+    ds_put_cstr(&comment, "ovs-vsctl:");
+    for (i = 0; i < argc; i++) {
+        ds_put_format(&comment, " %s", argv[i]);
+    }
+    ovsdb_idl_txn_add_comment(txn, ds_cstr(&comment));
+    ds_destroy(&comment);
+
     ovs = ovsrec_open_vswitch_first(idl);
     if (!ovs) {
         /* XXX add verification that table is empty */