diff options
author | Ilya Maximets <i.maximets@samsung.com> | 2019-03-22 15:58:39 +0300 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2019-03-26 13:56:53 -0700 |
commit | 723b6ab2df688b8bfe2fd5e3e2275749040a616c (patch) | |
tree | 9a90a8676d7f6d58e53f56a15ab85a427b56eedc /ofproto/ofproto-dpif.c | |
parent | b80675c6b3f4c27952446b6dc681a50d4c92a64a (diff) | |
download | openvswitch-723b6ab2df688b8bfe2fd5e3e2275749040a616c.tar.gz |
bridge: Propagate patch port pairing errors to db.
Virtual ports like 'patch' ports that almost fully implemented on
'ofproto' layer could have internal to 'ofproto' statuses that
could not be retrieved from 'netdev' or other layers. For example,
in current implementation there is no way to get the patch port
pairing status (i.e. if it has usable peer?).
New 'ofproto-provider' API function 'vport_get_status' introduced to
cover this gap. It allowes 'bridge' layer to retrive current status
of ofproto virtual ports and propagate it to DB.
For now we're only interested in pairing errors of 'patch' ports.
That are propagated to the 'error' column of the 'Interface' table.
Ex.:
$ ovs-vsctl show
...
Bridge "br1"
...
Port "patch1"
Interface "patch1"
type: patch
options: {peer="patch0"}
error: "No usable peer 'patch0' exists in 'system' datapath."
Bridge "br0"
datapath_type: netdev
...
Port "patch0"
Interface "patch0"
type: patch
options: {peer="patch1"}
error: "No usable peer 'patch1' exists in 'netdev' datapath."
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif.c')
-rw-r--r-- | ofproto/ofproto-dpif.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 21dd54bab..f0d387ccd 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3768,6 +3768,26 @@ port_get_stats(const struct ofport *ofport_, struct netdev_stats *stats) } static int +vport_get_status(const struct ofport *ofport_, char **errp) +{ + struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); + char *peer_name; + + if (!netdev_vport_is_patch(ofport->up.netdev) || ofport->peer) { + return 0; + } + + peer_name = netdev_vport_patch_peer(ofport->up.netdev); + if (!peer_name) { + return 0; + } + *errp = xasprintf("No usable peer '%s' exists in '%s' datapath.", + peer_name, ofport->up.ofproto->type); + free(peer_name); + return EINVAL; +} + +static int port_get_lacp_stats(const struct ofport *ofport_, struct lacp_slave_stats *stats) { struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); @@ -6045,6 +6065,7 @@ const struct ofproto_class ofproto_dpif_class = { port_del, port_set_config, port_get_stats, + vport_get_status, port_dump_start, port_dump_next, port_dump_done, |