Skip to content
Lori Jakab edited this page Oct 23, 2013 · 5 revisions

Debugging OVS internals

The ovs-appctl utility is a great way to peek into the internals of the OVS user space programs. If no application is mentioned on the command line, it defaults to ovs-vswitchd, which is mostly what I'm interested in.

The simplest command to use is coverage/show. It will print how many times select functions have been called:

$ sudo ovs-appctl coverage/show
Event coverage, hash=d051916f:
bridge_reconfigure               5
ofproto_update_port              5
ofproto_recv_openflow           16
ofproto_flush                    1
rev_mac_learning                18
rev_flow_table                   7
rev_reconfigure                  4
facet_revalidate                12
xlate_actions                  587
dpif_flow_del                    2
dpif_flow_put                    1
dpif_flow_flush                  1
dpif_port_add                    4
miniflow_malloc                 89
flow_extract                     2
hmap_expand                 182599
hmap_pathological               24
mac_learning_expired             9
netdev_get_stats              5621
poll_zero_timeout               29
poll_fd_wait                231104
rconn_sent                       9
rconn_queued                     9
stream_open                      1
pstream_open                     3
unixctl_replied                 73
unixctl_received                73
util_xalloc                1196355
vconn_sent                      13
vconn_received                  20
netdev_set_ethtool               2
netdev_get_ethtool               8
netdev_set_hwaddr                2
netdev_get_hwaddr                3
netdev_get_ifindex               4
netdev_set_policing              4
netlink_sent                 14204
netlink_recv_jumbo            2811
netlink_received             14559
nln_changed                      8
57 events never hit

Another command, very useful for debugging, is vlog. I allows altering the default logging configuration of individual "logging modules" during runtime. To obtain the list of the modules, and their current state, use vlog/list:

$ sudo ovs-appctl vlog/list
                 console    syslog    file
                 -------    ------    ------
bfd                OFF       INFO       INFO
bond               OFF       INFO       INFO
bridge             OFF       INFO       INFO
bundle             OFF       INFO       INFO
cfm                OFF       INFO       INFO
collectors         OFF       INFO       INFO
command_line       OFF       INFO       INFO
connmgr            OFF       INFO       INFO
coverage           OFF       INFO       INFO
daemon             OFF       INFO       INFO
dpif               OFF       INFO       INFO
dpif_linux         OFF       INFO       INFO
dpif_netdev        OFF       INFO       INFO
entropy            OFF       INFO       INFO
fail_open          OFF       INFO       INFO
fatal_signal       OFF       INFO       INFO
flow               OFF       INFO       INFO
in_band            OFF       INFO       INFO
ipfix              OFF       INFO       INFO
jsonrpc            OFF       INFO       INFO
lacp               OFF       INFO       INFO
lockfile           OFF       INFO       INFO
mac_learning       OFF       INFO       INFO
match              OFF       INFO       INFO
memory             OFF       INFO       INFO
meta_flow          OFF       INFO       INFO
multipath          OFF       INFO       INFO
netdev             OFF       INFO       INFO
netdev_dummy       OFF       INFO       INFO
netdev_linux       OFF       INFO       INFO
netdev_vport       OFF       INFO       INFO
netflow            OFF       INFO       INFO
netlink            OFF       INFO       INFO
netlink_notifier   OFF       INFO       INFO
netlink_socket     OFF       INFO       INFO
nx_match           OFF       INFO       INFO
odp_util           DBG        DBG        DBG
ofp_actions        OFF       INFO       INFO
ofp_errors         OFF       INFO       INFO
ofp_msgs           OFF       INFO       INFO
ofp_parse          OFF       INFO       INFO
ofp_util           OFF       INFO       INFO
ofproto            DBG        DBG        DBG
ofproto_dpif       DBG        DBG        DBG
ofproto_dpif_governor   OFF       INFO       INFO
ofproto_dpif_mirror   OFF       INFO       INFO
ofproto_dpif_upcall   DBG        DBG        DBG
ofproto_dpif_xlate   DBG        DBG        DBG
ovs_thread         OFF       INFO       INFO
ovsdb_error        OFF       INFO       INFO
ovsdb_idl          OFF       INFO       INFO
pktbuf             OFF       INFO       INFO
poll_loop          OFF       INFO       INFO
process            OFF       INFO       INFO
rconn              OFF       INFO       INFO
reconnect          OFF       INFO       INFO
route_table        OFF       INFO       INFO
sflow              OFF       INFO       INFO
signals            OFF       INFO       INFO
socket_util        OFF       INFO       INFO
stp                OFF       INFO       INFO
stream             OFF       INFO       INFO
stream_fd          OFF       INFO       INFO
stream_ssl         OFF       INFO       INFO
stream_tcp         OFF       INFO       INFO
stream_unix        OFF       INFO       INFO
svec               OFF       INFO       INFO
system_stats       OFF       INFO       INFO
timeval            OFF       INFO       INFO
tunnel             OFF       INFO       INFO
unixctl            OFF       INFO       INFO
util               OFF       INFO       INFO
vconn              OFF       INFO       INFO
vconn_stream       OFF       INFO       INFO
vlandev            OFF       INFO       INFO
vlog               OFF       INFO       INFO
vswitchd           OFF       INFO       INFO
xenserver          OFF       INFO       INFO

There are three possible log destinations, console, syslog, and file. The debug level of each can be controlled individually, or it can be changed globally for all modules. To change the syslog debug level for the util module to DBG, you would use:

sudo ovs-appctl vlog/set syslog,util,dbg

To see the internal MAC address learning table, issue sudo ovs-appctl fdb/show br0. The output is like this:

 port  VLAN  MAC                Age
    2     0  00:00:0c:15:c0:01    0
LOCAL     0  00:00:0c:15:c0:02    0

Clone this wiki locally