2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

vswitchd: Support creating fake bond device interfaces.

Citrix QA scripts expect that "brctl show" shows a bond interface for each
bond that is added to a bridge.  The only way to do that without modifying
brctl itself is to create an actual network device by that name, so this
commit adds a new bonding configuration key that causes an internal
device by the name of the bond to be created.

This feature is also necessary, but not sufficient, to allow XenCenter to
accurately show the link status and statistics of bridges (bug #1363).

This new configuration key is intentionally undocumented, because I don't
want anyone to use it.

Bug NIC-19.
This commit is contained in:
Ben Pfaff
2009-08-07 10:33:41 -07:00
parent db322751d8
commit 35c979bff4
2 changed files with 23 additions and 5 deletions

View File

@@ -461,9 +461,23 @@ bridge_reconfigure(void)
for (i = 0; i < add_ifaces.n; i++) {
const char *if_name = add_ifaces.names[i];
for (;;) {
int internal = cfg_get_bool(0, "iface.%s.internal", if_name);
int error = dpif_port_add(&br->dpif, if_name, next_port_no++,
internal ? ODP_PORT_INTERNAL : 0);
bool internal;
int error;
/* It's an internal interface if it's marked that way, or if
* it's a bonded interface for which we're faking up a network
* device. */
internal = cfg_get_bool(0, "iface.%s.internal", if_name);
if (cfg_get_bool(0, "bonding.%s.fake-iface", if_name)) {
struct port *port = port_lookup(br, if_name);
if (port && port->n_ifaces > 1) {
internal = true;
}
}
/* Add to datapath. */
error = dpif_port_add(&br->dpif, if_name, next_port_no++,
internal ? ODP_PORT_INTERNAL : 0);
if (error != EEXIST) {
if (next_port_no >= 256) {
VLOG_ERR("ran out of valid port numbers on dp%u",
@@ -1321,9 +1335,12 @@ bridge_get_all_ifaces(const struct bridge *br, struct svec *ifaces)
struct iface *iface = port->ifaces[j];
svec_add(ifaces, iface->name);
}
if (port->n_ifaces > 1
&& cfg_get_bool(0, "bonding.%s.fake-iface", port->name)) {
svec_add(ifaces, port->name);
}
}
svec_sort(ifaces);
assert(svec_is_unique(ifaces));
svec_sort_unique(ifaces);
}
/* For robustness, in case the administrator moves around datapath ports behind

View File

@@ -829,6 +829,7 @@ def configure_bond(pif):
argv = ['--del-match=bonding.%s.[!0-9]*' % interface]
argv += ["--add=bonding.%s.slave=%s" % (interface, slave)
for slave in physdevs]
argv += ['--add=bonding.%s.fake-iface=true']
if pifrec['MAC'] != "":
argv += ['--add=port.%s.mac=%s' % (interface, pifrec['MAC'])]