In the previous article that I discussed setting up Open vSwitch in, I encountered an odd issue when setting up my bridges for configuration upon startup (especially the br-ex bridge, which I had a management address on as well). Restarting the network after the initial changes worked, but upon startup, the network did not come up properly. After logging in and restarting the network again, things came up. This process was reproducible 100% of the time.
Upon startup, only the OvS bridges were up. Physical interfaces were not added. Upon initial inspection there did not seem to be anything wrong, so I started to delve into the process further and spent a morning of googling and poring thru the network init scripts, trying to figure out exactly what I did wrong, or if there was a bug with the way OvS auto-configuration was handled on RedHat-family systems.
The answer? Yes and no.
Ultimately there was an error in my configuration. In my physical interface config file (ie: ifcfg-eth0 or its equivalent in the new PCI syntax CentOS and RHEL 7 follow), I had:
HWADDR="00:11:22:AA:BB:CC" TYPE="Ethernet" NAME="eth0" <-- BAD ONBOOT="yes" NM_CONTROLLED="no" TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=br-ex
The correct file has:
HWADDR="00:11:22:AA:BB:CC" TYPE="Ethernet" DEVICE="eth0" <-- GOOD ONBOOT="yes" NM_CONTROLLED="no" TYPE=OVSPort DEVICETYPE=ovs OVS_BRIDGE=br-ex
Basically, the issue was the presence of the NAME directive in place of the correct DEVICE directive.
The Cause
I’m pretty sure NAME was there from installation. I performed minimal modification of the physical interface configuration file, and my bridge configuration file had the correct syntax (which I took from a tutorial, save the actual addressing information which I transplanted from the physical interface).
After poring over logs, I found the giveaway:
Feb 9 10:39:52 devhost network: Bringing up interface eth0: Error: either "dev" is duplicate, or "br-ex" is a garbage. Feb 9 10:39:52 devhost network: cat: /sys/class/net/eth0: Is a directory Feb 9 10:39:52 devhost network: cat: br-ex/ifindex: No such file or directory Feb 9 10:39:52 devhost network: /etc/sysconfig/network-scripts/ifup-eth: line 273: 1000 + : syntax error: operand expected (error token is "+ ") Feb 9 10:39:52 devhost network: ERROR : [/etc/sysconfig/network-scripts/ifup-aliases] Missing config file br-ex. Feb 9 10:39:52 devhost /etc/sysconfig/network-scripts/ifup-aliases: Missing config file br-ex. Feb 9 10:39:52 devhost ovs-vsctl: ovs|00001|vsctl|INFO|Called as ovs-vsctl -t 10 -- --may-exist add-port br-ex "eth0 Feb 9 10:39:52 devhost ovs-vsctl: br-ex" Feb 9 10:39:53 devhost network: [ OK ]
There was a line break in the ovs-vsctl command logged in syslog.
I ultimately traced this down to the get_device_by_hwaddr() function, in /etc/sysconfig/network-scripts/network-functions:
get_device_by_hwaddr () { LANG=C ip -o link | awk -F ': ' -vIGNORECASE=1 '!/link\/ieee802\.11/ && /'"$1"'/ { print $2 }' }
This will return multiple interfaces, separated by line breaks, when there is more than one interface on the system sharing a MAC address. Using DEVICE instead of NAME skips this, as the system only runs this when the former is not defined.
The MAC address got duplicated probably from a previous setup of OvS and was retained when the bridge was brought back up upon startup.
Moral of the story: if you are setting up bridging or any other kind of virtual interface infrastructure after installation, don’t overlook this, to save yourself some pain!
I posted a bug to CentOS about this as well: http://bugs.centos.org/view.php?id=8187