ovs-vsctl: Fix controller command prerequisites.
authorBen Pfaff <blp@nicira.com>
Wed, 8 Dec 2010 22:24:59 +0000 (14:24 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 9 Dec 2010 01:09:29 +0000 (17:09 -0800)
The controller commands use the "target" column of the Controller table,
but they don't supply it as a prerequisite, which makes those commands
hang.  This commit fixes the problem.

utilities/ovs-vsctl.c

index 477bdb0c17ac2b4d62e3e3e10f5bfa4a8c181106..c55818bd29c201f592e3932020d754956693c0c4 100644 (file)
@@ -1699,6 +1699,14 @@ verify_controllers(struct ovsrec_bridge *bridge)
     }
 }
 
+static void
+pre_controller(struct vsctl_context *ctx)
+{
+    pre_get_info(ctx);
+
+    ovsdb_idl_add_column(ctx->idl, &ovsrec_controller_col_target);
+}
+
 static void
 cmd_get_controller(struct vsctl_context *ctx)
 {
@@ -3266,10 +3274,10 @@ static const struct vsctl_command_syntax all_commands[] = {
     {"iface-to-br", 1, 1, pre_get_info, cmd_iface_to_br, NULL, "", RO},
 
     /* Controller commands. */
-    {"get-controller", 1, 1, pre_get_info, cmd_get_controller, NULL, "", RO},
-    {"del-controller", 1, 1, pre_get_info, cmd_del_controller, NULL, "", RW},
-    {"set-controller", 1, INT_MAX, pre_get_info, cmd_set_controller, NULL, "",
-     RW},
+    {"get-controller", 1, 1, pre_controller, cmd_get_controller, NULL, "", RO},
+    {"del-controller", 1, 1, pre_controller, cmd_del_controller, NULL, "", RW},
+    {"set-controller", 1, INT_MAX, pre_controller, cmd_set_controller, NULL,
+     "", RW},
     {"get-fail-mode", 1, 1, pre_get_info, cmd_get_fail_mode, NULL, "", RO},
     {"del-fail-mode", 1, 1, pre_get_info, cmd_del_fail_mode, NULL, "", RW},
     {"set-fail-mode", 2, 2, pre_get_info, cmd_set_fail_mode, NULL, "", RW},