[ovs-dev] [QoS v2 02/17] ovs-vsctl: Fix assert-fail when an error occurs and "create" command used.

Ben Pfaff blp at nicira.com
Tue Jun 8 13:41:22 PDT 2010


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 |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 66d3d98..6702493 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));
-- 
1.7.1





More information about the dev mailing list