Skip to content

Commit

Permalink
ovn-controller: Skip vport bindings done through OVS external_ids:ifa…
Browse files Browse the repository at this point in the history
…ce-id.

Port bindings of type "virtual" should not have an associated OVS port
in the integration bridge. If this is the case, it's a misconfig and
ovn-controller should ignore it.

If such a situation is detected, ovn-controller will also log a warning
message to inform the user about the wrong configuration.

Reported-at: https://bugzilla.redhat.com/1818844
CC: Numan Siddique <nusiddiq@redhat.com>
Fixes: 054f4c8 ("Add a new logical switch port type - 'virtual'")
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
dceara authored and ovsrobot committed Apr 2, 2020
1 parent 1d0c673 commit effcff8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controller/binding.c
Expand Up @@ -447,6 +447,18 @@ is_our_chassis(const struct sbrec_chassis *chassis_rec,
const struct ovsrec_interface *iface_rec
= shash_find_data(lport_to_iface, binding_rec->logical_port);

/* Ports of type "virtual" should never be explicitly bound to an OVS
* port in the integration bridge. If that's the case, ignore the binding
* and log a warning.
*/
if (iface_rec && !strcmp(binding_rec->type, "virtual")) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
VLOG_WARN_RL(&rl,
"Virtual port %s should not be bound to OVS port %s",
binding_rec->logical_port, iface_rec->name);
return false;
}

bool our_chassis = false;
if (iface_rec
|| (binding_rec->parent_port && binding_rec->parent_port[0] &&
Expand Down
20 changes: 20 additions & 0 deletions tests/ovn.at
Expand Up @@ -14894,6 +14894,11 @@ ovs-vsctl -- add-port br-int hv1-vif2 -- \
options:tx_pcap=hv1/vif2-tx.pcap \
options:rxq_pcap=hv1/vif2-rx.pcap \
ofport-request=2
ovs-vsctl -- add-port br-int hv1-vif3 -- \
set interface hv1-vif3 \
options:tx_pcap=hv1/vif3-tx.pcap \
options:rxq_pcap=hv1/vif3-rx.pcap \
ofport-request=3

sim_add hv2
as hv2
Expand Down Expand Up @@ -14987,6 +14992,21 @@ logical_port=sw0-vir) = x], [0], [])
AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = x])

# Try to bind sw0-vir directly to an OVS port. This should be ignored by
# ovn-controller.
as hv1
ovs-vsctl set interface hv1-vif3 external-ids:iface-id=sw0-vir

AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x], [0], [])

# Cleanup hv1-vif3.
as hv1
ovs-vsctl del-port hv1-vif3

AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x], [0], [])

# From sw0-p0 send GARP for 10.0.0.10. hv1 should claim sw0-vir
# and sw0-p1 should be its virtual_parent.
eth_src=505400000003
Expand Down

0 comments on commit effcff8

Please sign in to comment.