+ return controllers;
+}
+
+static void
+cmd_set_controller(struct vsctl_context *ctx)
+{
+ struct ovsrec_controller **controllers;
+ struct ovsrec_bridge *br;
+ size_t n;
+
+ vsctl_context_populate_cache(ctx);
+
+ br = find_real_bridge(ctx, ctx->argv[1], true)->br_cfg;
+ verify_controllers(br);
+
+ delete_controllers(br->controller, br->n_controller);
+
+ n = ctx->argc - 2;
+ controllers = insert_controllers(ctx->txn, &ctx->argv[2], n);
+ ovsrec_bridge_set_controller(br, controllers, n);
+ free(controllers);
+}
+
+static void
+cmd_get_fail_mode(struct vsctl_context *ctx)
+{
+ struct vsctl_bridge *br;
+ const char *fail_mode;
+
+ vsctl_context_populate_cache(ctx);
+ br = find_bridge(ctx, ctx->argv[1], true);
+
+ if (br->parent) {
+ br = br->parent;
+ }
+ ovsrec_bridge_verify_fail_mode(br->br_cfg);
+
+ fail_mode = br->br_cfg->fail_mode;
+ if (fail_mode && strlen(fail_mode)) {
+ ds_put_format(&ctx->output, "%s\n", fail_mode);
+ }
+}
+
+static void
+cmd_del_fail_mode(struct vsctl_context *ctx)
+{
+ struct vsctl_bridge *br;
+
+ vsctl_context_populate_cache(ctx);
+
+ br = find_real_bridge(ctx, ctx->argv[1], true);
+
+ ovsrec_bridge_set_fail_mode(br->br_cfg, NULL);
+}
+
+static void
+cmd_set_fail_mode(struct vsctl_context *ctx)
+{
+ struct vsctl_bridge *br;
+ const char *fail_mode = ctx->argv[2];
+
+ vsctl_context_populate_cache(ctx);
+
+ br = find_real_bridge(ctx, ctx->argv[1], true);
+
+ if (strcmp(fail_mode, "standalone") && strcmp(fail_mode, "secure")) {
+ vsctl_fatal("fail-mode must be \"standalone\" or \"secure\"");
+ }
+
+ ovsrec_bridge_set_fail_mode(br->br_cfg, fail_mode);
+}
+
+static void
+verify_managers(const struct ovsrec_open_vswitch *ovs)
+{
+ size_t i;
+
+ ovsrec_open_vswitch_verify_manager_options(ovs);
+
+ for (i = 0; i < ovs->n_manager_options; ++i) {
+ const struct ovsrec_manager *mgr = ovs->manager_options[i];
+
+ ovsrec_manager_verify_target(mgr);
+ }
+}
+
+static void
+pre_manager(struct vsctl_context *ctx)
+{
+ ovsdb_idl_add_column(ctx->idl, &ovsrec_open_vswitch_col_manager_options);
+ ovsdb_idl_add_column(ctx->idl, &ovsrec_manager_col_target);