[ovs-dev] [ovn 1/2] ovn-nbctl: Add OVSDB transaction comment.
Justin Pettit
jpettit at nicira.com
Thu Apr 9 19:36:23 UTC 2015
> On Apr 9, 2015, at 8:48 AM, Russell Bryant <rbryant at redhat.com> wrote:
>
> On 04/09/2015 03:49 AM, Justin Pettit wrote:
>> 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) {
>>
>
> It looks like there's a free(args) missing. I realize it's not a *huge*
> deal since this isn't a long running process, but I think it's still
> nice to clean up. :-)
Yeah, I was being lazy, and it was done that way in ovs-vsctl. But you're right. I just went ahead and pushed it, since it was a straight-forward fix. Thanks for the review.
--Justin
More information about the dev
mailing list