I needed to temporary ‘steal’ an interface from a server for other purposes. The problem is the interface was one of two interfaces used in an Open vSwitch bond.
I found a couple of ways to remove it, but my goal was to do it with either no service interruption or as little interruption as possible. One of the recommendations I found online was to delete the bond interface and recreate it but due to inexperience with OVS I didn’t want to risk this.
The method I selected was to make database commands to remove the interface instead; I found this post on the OVS discussion mailing list which was very helpful.
Interface Removal
My goal was to remove port eth5
from bond0
:
root@server:~# ovs-vsctl show 0d4a7b35-119c-4e18-88c1-dc474bd8f458 Bridge "vmbr0" Port "tap122i0" tag: 60 Interface "tap122i0" ... Port "bond0" Interface "eth5" Interface "eth9"
This was done in a single command:
ovs-vsctl --id=@eth5 get Interface eth5 -- remove Port bond0 interfaces @eth5
There was a very short interruption of traffic (2-3 seconds) after which everything continued to worked fine. If I am feeling a bit more brave one day I would do some more testing; I suspect the interruption could have been avoided completely by downing the port on the switch side first
Adding/Replacing Interface
To add either the same or a different interface back into the bond a single command can be used:
ovs-vsctl --id=@eth5 create Interface name=eth5 -- add Port bond0 interfaces @eth5
Verification
For those not familiar with checking the status of the bond interface:
root@server:~# ovs-appctl bond/show bond0 ---- bond0 ---- bond_mode: balance-tcp bond may use recirculation: yes, Recirc-ID : 1 bond-hash-basis: 0 updelay: 0 ms downdelay: 0 ms next rebalance: 7296 ms lacp_status: negotiated active slave mac: 3c:fd:fe:0b:6f:42(eth9) slave eth5: enabled may_enable: true ... slave eth9: enabled active slave may_enable: true
As the bond interface is using LACP:
root@server:~# ovs-appctl lacp/show bond0 ---- bond0 ---- status: active negotiated sys_id: 3c:fd:fe:0b:6f:40 sys_priority: 65534 aggregation key: 1 lacp_time: fast slave: eth5: current attached port_id: 1 port_priority: 65535 may_enable: true actor sys_id: 3c:fd:fe:0b:6f:40 actor sys_priority: 65534 actor port_id: 1 actor port_priority: 65535 actor key: 1 actor state: activity timeout aggregation synchronized collecting distributing partner sys_id: d4:04:ff:fc:64:80 partner sys_priority: 127 partner port_id: 55 partner port_priority: 127 partner key: 5 partner state: activity timeout aggregation synchronized collecting distributing slave: eth9: current attached port_id: 2 port_priority: 65535 may_enable: true actor sys_id: 3c:fd:fe:0b:6f:40 actor sys_priority: 65534 actor port_id: 2 actor port_priority: 65535 actor key: 1 actor state: activity timeout aggregation synchronized collecting distributing partner sys_id: d4:04:ff:fc:64:80 partner sys_priority: 127 partner port_id: 54 partner port_priority: 127 partner key: 5 partner state: activity timeout aggregation synchronized collecting distributing