diff mbox

[ovs-dev] rhel: Fix ifup-ovs to delete bonds first.

Message ID 1469462881-7460-1-git-send-email-fbl@redhat.com
State Superseded
Headers show

Commit Message

Flavio Leitner July 25, 2016, 4:08 p.m. UTC
When ifdown isn't executed (system didn't shut down properly),
bond interfaces remain in the openvswitch's database.  In that
case, an inconsitency is left behind when the ifcfg was modified
because ovs-vsctl won't do anything to update existing bond's
configuration in the database.

The ifup/ifdown will operate only on configured interfaces, so
this patch fixes the issue by deleting the bond from the database
before attempt to configure it with fresh configuration.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 rhel/etc_sysconfig_network-scripts_ifup-ovs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Flavio Leitner July 25, 2016, 4:29 p.m. UTC | #1
On Mon, Jul 25, 2016 at 01:08:01PM -0300, Flavio Leitner wrote:
> When ifdown isn't executed (system didn't shut down properly),
> bond interfaces remain in the openvswitch's database.  In that
> case, an inconsitency is left behind when the ifcfg was modified
> because ovs-vsctl won't do anything to update existing bond's
> configuration in the database.
> 
> The ifup/ifdown will operate only on configured interfaces, so
> this patch fixes the issue by deleting the bond from the database
> before attempt to configure it with fresh configuration.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>

Please drop this one.  I am working on a v2 fixing other interface
types as well.

fbl
diff mbox

Patch

diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs
index f3fc05e..150b264 100755
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
@@ -143,7 +143,9 @@  case "$TYPE" in
 		for _iface in $BOND_IFACES; do
 			/sbin/ifup ${_iface}
 		done
-		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
+		ovs-vsctl -t ${TIMEOUT} \
+			-- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \
+			-- add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
 		OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE"
 		;;
 	OVSTunnel)