ovs-vsctl: Check for uncreated symbols earlier.
authorBen Pfaff <blp@nicira.com>
Mon, 28 Feb 2011 20:45:16 +0000 (12:45 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 10 Mar 2011 19:23:59 +0000 (11:23 -0800)
The check for uncreated symbols does not rely on anything that happens
during transaction commit, so there is no point in allowing the transaction
to be sent to the database server, only to fail there, before reporting
the problem locally.

utilities/ovs-vsctl.c

index 4435f41..5de5f92 100644 (file)
@@ -3395,6 +3395,12 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
         }
     }
 
+    unused = ovsdb_symbol_table_find_unused(symtab);
+    if (unused) {
+        vsctl_fatal("row id \"%s\" is referenced but never created (e.g. "
+                    "with \"-- --id=%s create ...\")", unused, unused);
+    }
+
     status = ovsdb_idl_txn_commit_block(txn);
     if (wait_for_reload && status == TXN_SUCCESS) {
         next_cfg = ovsdb_idl_txn_get_increment_new_value(txn);
@@ -3414,12 +3420,6 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
     ovsdb_idl_txn_destroy(txn);
     txn = the_idl_txn = NULL;
 
-    unused = ovsdb_symbol_table_find_unused(symtab);
-    if (unused) {
-        vsctl_fatal("row id \"%s\" is referenced but never created (e.g. "
-                    "with \"-- --id=%s create ...\")", unused, unused);
-    }
-
     switch (status) {
     case TXN_INCOMPLETE:
         NOT_REACHED();