From: Ben Pfaff Date: Mon, 6 Jul 2009 17:17:54 +0000 (-0700) Subject: vswitch: Remove restriction on datapath names. X-Git-Tag: v0.90.3~13 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=632d136c7b108cd3d39a2e64fe6230e23977caf8;p=sliver-openvswitch.git vswitch: Remove restriction on datapath names. Commit f4b96c92c "vswitch: Disallow bridges named "dpN" or "nl:N"" disabled naming bridges "dpN" because the vswitchd code made the bad assumption that the bridge's local port has the same name as the bridge, which was not true (at the time) for bridges named dpN. Now that assumption has been eliminated, so this commit eliminates the restriction too. This change is also a cleanup in that it eliminates one form of the vswitch's dependence on specifics of the dpif implementation. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 32647eaea..00cffbc82 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -351,32 +351,19 @@ bridge_configure_ssl(void) void bridge_reconfigure(void) { - struct svec old_br, new_br, raw_new_br; + struct svec old_br, new_br; struct bridge *br, *next; size_t i, j; COVERAGE_INC(bridge_reconfigure); - /* Collect old bridges. */ + /* Collect old and new bridges. */ svec_init(&old_br); + svec_init(&new_br); LIST_FOR_EACH (br, struct bridge, node, &all_bridges) { svec_add(&old_br, br->name); } - - /* Collect new bridges. */ - svec_init(&raw_new_br); - cfg_get_subsections(&raw_new_br, "bridge"); - svec_init(&new_br); - for (i = 0; i < raw_new_br.n; i++) { - const char *name = raw_new_br.names[i]; - if (!strncmp(name, "dp", 2) && isdigit(name[2])) { - VLOG_ERR("%s is not a valid bridge name (bridges may not be " - "named \"dp\" followed by a digit)", name); - } else { - svec_add(&new_br, name); - } - } - svec_destroy(&raw_new_br); + cfg_get_subsections(&new_br, "bridge"); /* Get rid of deleted bridges and add new bridges. */ svec_sort(&old_br); @@ -793,7 +780,7 @@ bridge_create(const char *name) br = xcalloc(1, sizeof *br); error = dpif_create(name, &br->dpif); - if (error == EEXIST) { + if (error == EEXIST || error == EBUSY) { error = dpif_open(name, &br->dpif); if (error) { VLOG_ERR("datapath %s already exists but cannot be opened: %s", diff --git a/vswitchd/ovs-vswitchd.conf.5.in b/vswitchd/ovs-vswitchd.conf.5.in index 5483ad5b1..d82a08afd 100644 --- a/vswitchd/ovs-vswitchd.conf.5.in +++ b/vswitchd/ovs-vswitchd.conf.5.in @@ -50,8 +50,7 @@ configure \fBovs\-vswitchd\fR. .SS "Bridge Configuration" A bridge (switch) with a given \fIname\fR is configured by specifying the names of its network devices as values for key -\fBbridge.\fIname\fB.port\fR. (The specified \fIname\fR may not begin -with \fBdp\fR followed by a digit.) +\fBbridge.\fIname\fB.port\fR. .PP The names given on \fBbridge.\fIname\fB.port\fR must be the names of existing network devices, except for ``internal ports.'' An internal