Skip to content

Commit

Permalink
ovn-controller: Fix releasing wrong vif
Browse files Browse the repository at this point in the history
When binding an OVS interface to a logical port, if external_ids:iface-id is
set within the same transaction as adding the interface to a bridge,
ovn-controller is usually initially notified of ovs interface change with
ofport == 0.
If the lport was already bound to a different interface, the ofport=0
notification caused an unexpected release of the interface.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Acked-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
(cherry picked from commit a2f80ce)
  • Loading branch information
simonartxavier authored and numansiddique committed Nov 23, 2022
1 parent c8bd5ad commit 6fbdf81
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,23 @@ consider_iface_release(const struct ovsrec_interface *iface_rec,
struct shash *binding_lports = &b_ctx_out->lbinding_data->lports;

lbinding = local_binding_find(local_bindings, iface_id);

if (lbinding) {
int64_t ofport = iface_rec->n_ofport ? *iface_rec->ofport : 0;
if (lbinding->iface != iface_rec && !ofport) {
/* If external_ids:iface-id is set within the same transaction
* as adding an interface to a bridge, ovn-controller is
* usually initially notified of ovs interface changes with
* ofport == 0. If the lport was bound to a different interface
* we do not want to release it.
*/
VLOG_DBG("Not releasing lport %s as %s was claimed "
"and %s was never bound)", iface_id, lbinding->iface ?
lbinding->iface->name : "", iface_rec->name);
return true;
}
}

struct binding_lport *b_lport =
local_binding_get_primary_or_localport_lport(lbinding);
if (is_binding_lport_this_chassis(b_lport, b_ctx_in->chassis_rec)) {
Expand Down

0 comments on commit 6fbdf81

Please sign in to comment.