VLOG_WARN("addbr %s: bridge %s exists", br_name, br_name);
return EEXIST;
} else if (netdev_exists(br_name)) {
- VLOG_WARN("addbr %s: cannot create bridge %s because a network device "
- "named %s already exists", br_name, br_name, br_name);
- return EEXIST;
+ if (cfg_get_bool(0, "iface.%s.fake-bridge", br_name)) {
+ VLOG_WARN("addbr %s: %s exists as a fake bridge",
+ br_name, br_name);
+ return 0;
+ } else {
+ VLOG_WARN("addbr %s: cannot create bridge %s because a network "
+ "device named %s already exists",
+ br_name, br_name, br_name);
+ return EEXIST;
+ }
}
cfg_add_entry("bridge.%s.port=%s", br_name, br_name);
char *short_options = long_options_to_short_options(long_options);
int error;
- reload_command = xasprintf("ovs-appctl "
+ reload_command = xasprintf("%s/ovs-appctl "
"-t %s/vswitchd.`cat %s/vswitchd.pid`.ctl "
"-e vswitchd/reload 2>&1 "
"| /usr/bin/logger -t brcompatd-reload",
- ovs_rundir, ovs_rundir);
+ ovs_bindir, ovs_rundir, ovs_rundir);
for (;;) {
int c;
valgrind_opt="valgrind --log-file=$BRCOMPATD_VALGRIND_LOG $BRCOMPATD_VALGRIND_OPT"
daemonize="n"
fi
+ reload_cmd='/root/vswitch/bin/ovs-appctl -t /var/run/vswitchd.`cat /var/run/vswitchd.pid`.ctl -e vswitchd/reload 2>&1 | /usr/bin/logger -t brcompatd-reload'
if [ "$daemonize" != "y" ]; then
# Start in background and force a "success" message
action "Starting brcompatd ($strace_opt$valgrind_opt)" true
- (nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" -P$BRCOMPATD_PIDFILE --vswitchd-pidfile=$VSWITCHD_PIDFILE -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_CONF") &
+ (nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" --reload-command="$reload_cmd" -P$BRCOMPATD_PIDFILE -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_CONF") &
else
- action "Starting brcompatd" nice -n "$BRCOMPATD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" -P$BRCOMPATD_PIDFILE -D -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_CONF"
+ action "Starting brcompatd" nice -n "$BRCOMPATD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" --reload-command="$reload_cmd" -P$BRCOMPATD_PIDFILE -D -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_CONF"
fi
}
def ipdev_name(pif):
"""Return the the name of the network device that carries the
IP configuration (if any) associated with pif.
-For a non-VLAN PIF, the ipdev name is the bridge name.
-For a VLAN PIF, the ipdev name is the interface name.
+The ipdev name is the same as the bridge name.
"""
pifrec = db.get_pif_record(pif)
-
- if pifrec['VLAN'] == '-1':
- return bridge_name(pif)
- else:
- return interface_name(pif)
+ return bridge_name(pif)
def physdev_names(pif):
"""Return the name(s) of the physical network device(s) associated with pif.
def run_command(command):
log("Running command: " + ' '.join(command))
- #return
if os.spawnl(os.P_WAIT, command[0], *command) != 0:
log("Command failed: " + ' '.join(command))
return False
if vlan_slave:
argv += ['--add=vlan.%s.tag=%s' % (ipdev, pifrec['VLAN'])]
argv += ['--add=iface.%s.internal=true' % (ipdev)]
+
+ # xapi creates a bridge by the name of the ipdev and requires
+ # that the IP address will be on it. We need to delete this
+ # bridge because we need that device to be a member of our
+ # datapath.
+ argv += ['--del-match=bridge.%s.[!0-9]*' % ipdev]
+
+ # xapi insists that its attempts to create the bridge succeed,
+ # so force that to happen.
+ argv += ['--add=iface.%s.fake-bridge=true' % (ipdev)]
if bond_master:
argv += configure_bond(bond_master)
modify_config(argv)