Starting OVSDB and vSwitchd in OpenvSwitch with Debugging Enabled
Here are some quick notes on how I went about debugging OVSDB (ovsdb-server) and OVS vSwitchd (ovs-vsctl). There are lots of ways to debug OVS these are what I used to get debug logs generated. Those logs are helpful troubleshooting for OVSDB transactions and OpenFlow commands when using the ovs-vctl or OVSDB and OpenFlow APIs.
Dont do this unless you are ok w/ trashing the install in case there is something different about your environment then mine :) These are about a year old but I think thats all still the same.
Start processes for Debugging OVSDB Transactions
If you are having OpenFlow API or ovs-vsctl issues and wanted to debug them, you can enable vswitchd syslog debugging with this.
# Stop existing OVS processes. kill -9 works too. /usr/local/share/openvswitch/scripts/ovs-ctl stop # Start ovsdb-server w/ debugging enabled. ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ --private-key=db:Open_vSwitch,SSL,private_key \ --certificate=db:Open_vSwitch,SSL,certificate \ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ --log-file=/var/log/openvswitch/ovs-vswitchd.log \ -vsyslog:dbg -vfile:dbg --pidfile --detach ovs-vswitchd -v --pidfile --detach \ --log-file=/var/log/openvswitch/ovs-vswitchd.log \ -vconsole:err -vsyslog:info -vfile:info ovs-vsctl --no-wait init tail -f /var/log/ovsdb-*.log
Start processes for Debugging vSwitchd
If you are having OpenFlow API or ovs-ofctl issues and wanted to debug them, you can enable vswitchd syslog debugging with this:
# Stop existing OVS processes. kill -9 works too.
/usr/local/share/openvswitch/scripts/ovs-ctl stop
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--private-key=db:Open_vSwitch,SSL,private_key \
--certificate=db:Open_vSwitch,SSL,certificate \
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
--pidfile --detach
ovs-vsctl --no-wait init
# Start ovs-vswitchd w/ debugging enabled.
ovs-vswitchd -v --pidfile --detach \
--log-file=/var/log/openvswitch/ovs-vswitchd.log -vconsole:dbg -vsyslog:dbg -vfile:dbg
ovs-vswitchd -v --pidfile --detach \
--log-file=/var/log/openvswitch/ovs-vswitchd.log \
-vconsole:err -vsyslog:dbg -vfile:err
reset-ovs.sh - resets ovs to default
Its a hammer appraoch, prolly more elegant ways but this is what I used for reseting OVS to vanilla and then starting OVSDB w/ debugging enabled.These commands simply delete and reinitialize the OVS schema conf file and restarts the processes. You can always substitute the startup scripts in place of individually starting the procs.
# Stop existing OVS processes. kill -9 works too. /usr/local/share/openvswitch/scripts/ovs-ctl stop sleep 1 cd /home/brent/openvswitch rm /usr/local/etc/openvswitch/conf.db /usr/local/bin/ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \ --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ --private-key=db:Open_vSwitch,SSL,private_key \ --certificate=db:Open_vSwitch,SSL,certificate \ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \ --log-file=/var/log/openvswitch/ovs-vswitchd.log \ -vsyslog:dbg -vfile:dbg --pidfile --detach ovs-vswitchd -v --pidfile --detach \ --log-file=/var/log/openvswitch/ovs-vswitchd.log \ -vconsole:err -vsyslog:info -vfile:info ovs-vsctl --no-wait init sudo ovs-vsctl set-manager ptcp:6640
debug using the OVS startup scripts
If you dont want to start the processes manually, you can modify the initialization script and look for -vsyslog, -vfile, etc. You can change those to the syslog level that you want. The script is typically generally located at:
vi /usr/local/share/openvswitch/scripts/ovs-ctl # Then restart the process once you have the values you want in place /usr/local/share/openvswitch/scripts/ovs-ctl restart
Happy hacking!