amorenoz / ovs-dbg

Scripts to help debug OVS and OVN
Apache License 2.0
23 stars 8 forks source link

Support OVN in offline-dbg #34

Closed amorenoz closed 3 years ago

amorenoz commented 3 years ago

Currently there are an issue preventing us from really doing OVN troubleshooting with this tool: We can't run multiple ovsdb-server instances at the same time

This PR adds support for multiple ovsdb-servers, adds collect-db-ovn-{nb,sb} to the commandline and prints OVN hint commands nicely.

Also, it collects the OVN database from a running k8s cluster. As a result, after collecting k8s data:

$ ./bin/offline-dbg collect-k8s ovn_worker && ./bin/offline-dbg start
[...]
Offline OVS Debugging started                                                                                                            
******************************                                                                                                           

Working directory: /tmp/ovs-offline-dbg:                                                                                                 

* openvswitch control found at /tmp/ovs-offline-dbg/var-run/ovs/ovs-vswitchd.8.ctl                                                       
  You can run ovs-appctl commands as:                                                                                                    
      ovs-appctl --target=/tmp/ovs-offline-dbg/var-run/ovs/ovs-vswitchd.8.ctl [...]                                                      

* ovs ovsdb-server socket found at /tmp/ovs-offline-dbg/var-run/ovs/ovs.sock                                                             
  You can run commands such as:                                                                                                          
      ovs-vsctl --db unix:/tmp/ovs-offline-dbg/var-run/ovs/ovs.sock [...]                                                                
  or                                                                                                                                     
      ovsdb-client /tmp/ovs-offline-dbg/var-run/ovs/ovs.sock [...]                                                                       

* ovn_nb ovsdb-server socket found at /tmp/ovs-offline-dbg/var-run/ovn_nb/ovn_nb.sock                                                    
  You can run commands such as:                                                                                                          
      ovn-nbctl --db unix:/tmp/ovs-offline-dbg/var-run/ovn_nb/ovn_nb.sock [...]                                                          
  or                                                                                                                                     
      ovsdb-client /tmp/ovs-offline-dbg/var-run/ovn_nb/ovn_nb.sock [...]                                                                 

* ovn_sb ovsdb-server socket found at /tmp/ovs-offline-dbg/var-run/ovn_sb/ovn_sb.sock                                                    
  You can run commands such as:                                                                                                          
      ovn-sbctl --db unix:/tmp/ovs-offline-dbg/var-run/ovn_sb/ovn_sb.sock [...]                                                          
  or                                                                                                                                     
      ovsdb-client /tmp/ovs-offline-dbg/var-run/ovn_sb/ovn_sb.sock [...]                                                                 

* openflow bridge management sockets found at /tmp/ovs-offline-dbg/var-run/ovs/breth0.mgmt                                               
/tmp/ovs-offline-dbg/var-run/ovs/br-int.mgmt                                                                                             
  You can run ofproto commands such as:                                                                                                  
      ovs-ofctl [...] /tmp/ovs-offline-dbg/var-run/ovs/breth0.mgmt                                                                       
      ovs-ofctl [...] /tmp/ovs-offline-dbg/var-run/ovs/br-int.mgmt                                                                       

You can even run ovn-detrace as:

 $ ovn-detrace --ovnsb=unix:/tmp/ovs-offline-dbg/var-run/ovn_sb/ovn_sb.sock --ovnnb=unix:/tmp/ovs-offline-dbg/var-run/ovn_nb/ovn_nb.sock --ovsdb=unix:/tmp/ovs-offline-dbg/var-run/ovs/ovs.sock

Also, it collects OVN databases from SOS reports.

Fixes: #33

amorenoz commented 3 years ago

@SalDaniele PTAL

amorenoz commented 3 years ago

I know you have a PR pending that touches the same files. I'm happy to wait until it gets merged and rebase mine