From 8d49c47a5ddda216dfb3998370f0375217b6d6a1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 18 May 2010 14:16:43 -0700 Subject: [PATCH] ovs-vsctl: Fix assert-fail when an error occurs and "create" command used. When the "create" command is used, post_create() calls ovsdb_idl_txn_get_insert_uuid(), which asserts that the transaction completed successfully. This makes it clear that postprocess functions should only run when the transaction completes successfully. (Currently post_create() is the only postprocess function.) --- utilities/ovs-vsctl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index ba0be3066..acc7841cb 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -2604,13 +2604,15 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands, if (wait_for_reload && status == TXN_SUCCESS) { next_cfg = ovsdb_idl_txn_get_increment_new_value(txn); } - for (c = commands; c < &commands[n_commands]; c++) { - if (c->syntax->postprocess) { - struct vsctl_context ctx; + if (status == TXN_UNCHANGED || status == TXN_SUCCESS) { + for (c = commands; c < &commands[n_commands]; c++) { + if (c->syntax->postprocess) { + struct vsctl_context ctx; - vsctl_context_init(&ctx, c, idl, txn, ovs); - (c->syntax->postprocess)(&ctx); - vsctl_context_done(&ctx, c); + vsctl_context_init(&ctx, c, idl, txn, ovs); + (c->syntax->postprocess)(&ctx); + vsctl_context_done(&ctx, c); + } } } error = xstrdup(ovsdb_idl_txn_get_error(txn)); -- 2.43.0