[ovs-dev] [ovn 1/2] ovn-nbctl: Add OVSDB transaction comment.

Justin Pettit jpettit at nicira.com
Thu Apr 9 07:49:36 UTC 2015


Add a comment to the transaction that contains the command that was
executed to aid looking at the transaction log.

Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ovn/ovn-nbctl.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/ovn/ovn-nbctl.c b/ovn/ovn-nbctl.c
index 3178105..17e5259 100644
--- a/ovn/ovn-nbctl.c
+++ b/ovn/ovn-nbctl.c
@@ -23,6 +23,7 @@
 #include "fatal-signal.h"
 #include "ovn/ovn-nb-idl.h"
 #include "poll-loop.h"
+#include "process.h"
 #include "stream.h"
 #include "stream-ssl.h"
 #include "util.h"
@@ -607,6 +608,7 @@ main(int argc, char *argv[])
     enum ovsdb_idl_txn_status txn_status;
     unsigned int seqno;
     int res = 0;
+    char *args;
 
     fatal_ignore_sigpipe();
     set_program_name(argv[0]);
@@ -615,6 +617,8 @@ main(int argc, char *argv[])
     parse_options(argc, argv);
     nbrec_init();
 
+    args = process_escape_args(argv);
+
     nb_ctx.idl = ovsdb_idl_create(db, &nbrec_idl_class, true, false);
     ctx.pvt = &nb_ctx;
     ctx.argc = argc - optind;
@@ -634,6 +638,7 @@ main(int argc, char *argv[])
 
         if (seqno != ovsdb_idl_get_seqno(nb_ctx.idl)) {
             nb_ctx.txn = ovsdb_idl_txn_create(nb_ctx.idl);
+            ovsdb_idl_txn_add_comment(nb_ctx.txn, "ovn-nbctl: %s", args);
             ovs_cmdl_run_command(&ctx, get_all_commands());
             txn_status = ovsdb_idl_txn_commit_block(nb_ctx.txn);
             if (txn_status == TXN_TRY_AGAIN) {
-- 
1.7.5.4




More information about the dev mailing list