summaryrefslogtreecommitdiff
path: root/vswitchd/bridge.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-10-26 15:53:55 -0700
committerBen Pfaff <blp@ovn.org>2019-02-05 13:44:07 -0800
commitc66be90bd9a04bc98e8ef32f684a3d7283379f66 (patch)
tree6bbc24147a6a55c55ce5cf6a8aceeaa9123ed743 /vswitchd/bridge.c
parent29718ad49d61e1ab32d23d27225ec7368f1824bb (diff)
downloadopenvswitch-c66be90bd9a04bc98e8ef32f684a3d7283379f66.tar.gz
vswitchd: Allow user to configure controllers as "primary" or "service".
Normally it makes sense for an active connection to be primary and a passive connection to be a service connection, but I've run into a corner case where it is better for a passive connection to be a primary connection. This specific case is for use with OFtest, which expects to be a primary controller. However, it also wants to reconnect frequently, which is slow for active connections because of the backoff; by configuring a passive, primary controller, OFtest can reconnect as frequently and as quickly as it wants, making the overall test much faster. Acked-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'vswitchd/bridge.c')
-rw-r--r--vswitchd/bridge.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index de5793dd0..a427b0122 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -46,6 +46,7 @@
#include "openvswitch/meta-flow.h"
#include "openvswitch/ofp-print.h"
#include "openvswitch/ofpbuf.h"
+#include "openvswitch/vconn.h"
#include "openvswitch/vlog.h"
#include "ovs-lldp.h"
#include "ovs-numa.h"
@@ -3536,6 +3537,14 @@ equal_pathnames(const char *a, const char *b, size_t b_stoplen)
}
}
+static enum ofconn_type
+get_controller_ofconn_type(const char *target, const char *type)
+{
+ return (type
+ ? (!strcmp(type, "primary") ? OFCONN_PRIMARY : OFCONN_SERVICE)
+ : (!vconn_verify_name(target) ? OFCONN_PRIMARY : OFCONN_SERVICE));
+}
+
static void
bridge_configure_remotes(struct bridge *br,
const struct sockaddr_in *managers, size_t n_managers)
@@ -3571,6 +3580,7 @@ bridge_configure_remotes(struct bridge *br,
/* Add managment controller. */
struct ofproto_controller *oc = xmalloc(sizeof *oc);
*oc = (struct ofproto_controller) {
+ .type = OFCONN_SERVICE,
.probe_interval = 60,
.band = OFPROTO_OUT_OF_BAND,
.enable_async_msgs = true,
@@ -3639,6 +3649,7 @@ bridge_configure_remotes(struct bridge *br,
oc = xmalloc(sizeof *oc);
*oc = (struct ofproto_controller) {
+ .type = get_controller_ofconn_type(c->target, c->type),
.max_backoff = c->max_backoff ? *c->max_backoff / 1000 : 8,
.probe_interval = (c->inactivity_probe
? *c->inactivity_probe / 1000 : 5),