Skip to content

Commit

Permalink
binding: Do not clear container lbinding->pb when parent is deleted.
Browse files Browse the repository at this point in the history
When a parent Port_Binding is deleted we shouldn't clear the children's
'pb' field.  Container port bindings have their own Port_Binding SB
record so the child_lbinding->pb field should be cleared only when
their corresponding SB record is deleted.

Whithout this fix when a parent Port_Binding "remove" followed by "add"
operations are received in the same iteration in ovn-controller,
consider_container_lport() can be called with "pb == NULL" causing a
crash.

Fixes: 354bdba ("ovn-controller: I-P for SB port binding and OVS interface in runtime_data.")
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit d3245f6)
  • Loading branch information
dceara authored and numansiddique committed Jan 6, 2021
1 parent dfaac33 commit 3f3630e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions controller/binding.c
Expand Up @@ -958,8 +958,7 @@ release_local_binding_children(const struct sbrec_chassis *chassis_rec,
}
}

/* Clear the local bindings' 'pb' and 'iface'. */
l->pb = NULL;
/* Clear the local bindings' 'iface'. */
l->iface = NULL;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/ovn.at
Expand Up @@ -8778,6 +8778,13 @@ OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up vm1)])
OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up foo1)])
OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up bar1)])

# Move VM1 to a new logical switch.
ovn-nbctl ls-add mgmt2
ovn-nbctl lsp-del vm1 -- lsp-add mgmt2 vm1
OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up vm1)])
OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up foo1)])
OVS_WAIT_UNTIL([test xup = x$(ovn-nbctl lsp-get-up bar1)])

as hv1 ovs-vsctl del-port vm1
OVS_WAIT_UNTIL([test xdown = x$(ovn-nbctl lsp-get-up vm1)])
OVS_WAIT_UNTIL([test xdown = x$(ovn-nbctl lsp-get-up foo1)])
Expand Down

0 comments on commit 3f3630e

Please sign in to comment.