From 9a783536418c311c9988fc9b6c4e6194086fa30e Mon Sep 17 00:00:00 2001 From: Flavio Leitner Date: Fri, 17 Jul 2015 13:56:21 -0300 Subject: [PATCH] rhel: Fix ifup-ovs to delete ports first. When ifdown isn't executed (system didn't shut down properly), the interfaces remain in the openvswitch's database. For the internal ports or devices that are available when openvswitch service starts that's not an issue. However, ovs-vsctl won't do anything for devices created later (Linux vlan devices for instance) since they are already in the database. That leaves a inconsistency behind because they will be left out of the kernel's datapath. The ifup/ifdown will operate only on configured interfaces, so this patch fixes the issue by deleting the interface from the database before attempt to configure it. Signed-off-by: Flavio Leitner Acked-by: Jiri Benc Signed-off-by: Ben Pfaff --- rhel/etc_sysconfig_network-scripts_ifup-ovs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs index 05f70f6c5..478c5c393 100755 --- a/rhel/etc_sysconfig_network-scripts_ifup-ovs +++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs @@ -117,7 +117,11 @@ case "$TYPE" in OVSPort) ifup_ovs_bridge ${OTHERSCRIPT} ${CONFIG} ${2} - ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} + # The port might be already in the database but not yet + # in the datapath. So, remove the stale interface first. + ovs-vsctl -t ${TIMEOUT} \ + -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \ + -- add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE" ;; OVSIntPort) -- 2.20.1