amorenoz / ovs-dbg

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

ovs-offline: collect from extracted sos report #109

Closed amorenoz closed 1 year ago

amorenoz commented 2 years ago

Allow especifying a directory of an already extracted sos report. Refactor extraction code to a function that implements both "tar" and "cp" based extractions.

Fixes: #108

Signed-off-by: Adrian Moreno amorenoz@redhat.com

amorenoz commented 2 years ago
ls
total 170M
-rw------- 1 amorenoz adrian  37M Sep 28  2021 _sosreport-hareshcomputesriovoffload-0-2021-09-27-dsonvwz.tar.xz
drwxr-xr-x 3 amorenoz adrian 4.0K Oct  7 12:28 sosreport-hareshcomputesriovoffload-0-2021-09-27-dsonvwz.tar.xz
-rw------- 1 amorenoz adrian  52M Sep 28  2021 _sosreport-hareshcontrollersriov-0-2021-09-28-kakcvko.tar.xz
drwxr-xr-x 3 amorenoz adrian 4.0K Oct  7 13:40 sosreport-hareshcontrollersriov-0-2021-09-28-kakcvko.tar.xz

ovs-offline stop && ovs-offline  collect-sos-ovs _sosreport-hareshcomputesriovoffload-0-2021-09-27-dsonvwz.tar.xz && ovs-offline start && ovs-vsctl --db unix:/tmp/ovs-offline/var-run/ovs/db.sock show; ovs-offline stop && ovs-offline  collect-sos-ovs sosreport-hareshcomputesriovoffload-0-2021-09-27-dsonvwz.tar.xz/ && ovs-offline start && ovs-vsctl --db unix:/tmp/ovs-offline/var-run/ovs/db.sock show; ovs-offline stop && ovs-offline  collect-sos-ovn _sosreport-hareshcontrollersriov-0-2021-09-28-kakcvko.tar.xz && ovs-offline start &&  ovn-nbctl --db unix:/tmp/ovs-offline/var-run/ovn_nb/ovnnb_db.sock show &&  ovs-offline stop && ovs-offline  collect-sos-ovn sosreport-hareshcontrollersriov-0-2021-09-28-kakcvko.tar.xz/ && ovs-offline start &&  ovn-nbctl --db unix:/tmp/ovs-offline/var-run/ovn_nb/ovnnb_db.sock show
Offline OVS Debugging stopped
*****************************
Extracting OVS data from sos report...

Offline OVS Debugging: OVS data collected and stored in /tmp/ovs-offline
*******************************************************************
Starting container ovsdb-server-ovs
003b693b70666789a977f23006f0120518b64a7f4e8dc3e09abc92ee25779bb4
Starting container ovs-vswitchd
4f2486c043d6edaa0a41895443729e3bf2d664f138090b946142a69b22599d18

Offline OVS Debugging started
******************************

Working directory: /tmp/ovs-offline:

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

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

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

* You can also run offline commands directly with the following:
    source /tmp/ovs-offline/bin/activate
6e519ba3-1d89-456f-af61-8f0223dd9712
    Manager "ptcp:6640:127.0.0.1"
    Bridge br-int
        fail_mode: secure
        datapath_type: system
        Port ovn-ecf608-0
            Interface ovn-ecf608-0
                type: geneve
                options: {csum="true", key=flow, remote_ip="10.10.51.136"}
                bfd_status: {diagnostic="No Diagnostic", flap_count="0", forwarding="false", remote_diagnostic="No Diagnostic", remote_state=down, state=down}
        Port patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738
            Interface patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738
                type: patch
                options: {peer=patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int}
        Port enp4s0f1_2
            Interface enp4s0f1_2
        Port br-int
            Interface br-int
                type: internal
        Port tap555ce370-10
            Interface tap555ce370-10
    Bridge br-data
        fail_mode: standalone
        Port mx-bond
            Interface mx-bond
        Port br-data
            Interface br-data
                type: internal
        Port patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int
            Interface patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int
                type: patch
                options: {peer=patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738}
        Port vlan405
            tag: 405
            Interface vlan405
                type: internal
    ovs_version: "2.15.1"
Offline OVS Debugging stopped
*****************************
Extracting OVS data from sos report...

Offline OVS Debugging: OVS data collected and stored in /tmp/ovs-offline
*******************************************************************
Starting container ovsdb-server-ovs
ef79067009457ea90cd7bbf5a370289e931833a583ca28dfe93e608cdbddc9a8
Starting container ovs-vswitchd
d2554fe18b36018f71992262bf22a262417fe52a8af28304353db48738804b65

Offline OVS Debugging started
******************************

Working directory: /tmp/ovs-offline:

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

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

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

* You can also run offline commands directly with the following:
    source /tmp/ovs-offline/bin/activate
6e519ba3-1d89-456f-af61-8f0223dd9712
    Manager "ptcp:6640:127.0.0.1"
    Bridge br-int
        fail_mode: secure
        datapath_type: system
        Port ovn-ecf608-0
            Interface ovn-ecf608-0
                type: geneve
                options: {csum="true", key=flow, remote_ip="10.10.51.136"}
                bfd_status: {diagnostic="No Diagnostic", flap_count="0", forwarding="false", remote_diagnostic="No Diagnostic", remote_state=down, state=down}
        Port patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738
            Interface patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738
                type: patch
                options: {peer=patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int}
        Port enp4s0f1_2
            Interface enp4s0f1_2
        Port br-int
            Interface br-int
                type: internal
        Port tap555ce370-10
            Interface tap555ce370-10
    Bridge br-data
        fail_mode: standalone
        Port mx-bond
            Interface mx-bond
        Port br-data
            Interface br-data
                type: internal
        Port patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int
            Interface patch-provnet-df741617-6923-41e3-9ef6-075004808738-to-br-int
                type: patch
                options: {peer=patch-br-int-to-provnet-df741617-6923-41e3-9ef6-075004808738}
        Port vlan405
            tag: 405
            Interface vlan405
                type: internal
    ovs_version: "2.15.1"
Offline OVS Debugging stopped
*****************************
Extracting OVN data from sos report...

Offline OVS Debugging: OVN data collected and stored in /tmp/ovs-offline
*******************************************************************
Starting container ovsdb-server-ovn_nb
2a0b293d958a9ea9298f8b2e80b08cfedfbda1a3ca78d66d9480dda2a275d5c9
Starting container ovsdb-server-ovn_sb
42fe224b7149107d93953bc462a39fe7ec280eb1bef5bd6ad3d88e37def263ef

Offline OVS Debugging started
******************************

Working directory: /tmp/ovs-offline:

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

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

* You can also run offline commands directly with the following:
    source /tmp/ovs-offline/bin/activate
switch d76451c4-efd7-45cd-bc38-2d83723acb50 (neutron-320f6a29-0e7a-4ffb-9b5c-69aa7d7e0528) (aka external)
    port provnet-df741617-6923-41e3-9ef6-075004808738
        type: localnet
        tag: 405
        addresses: ["unknown"]
    port bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
        type: router
        router-port: lrp-bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
    port dfc037cf-a0a7-4dad-8082-4ce92e746eea
        type: localport
        addresses: ["fa:16:3e:fe:1c:e0 10.10.54.101"]
switch c92ecaeb-0dc2-4de5-ba2f-088373087a03 (neutron-232ef89b-5e67-48ae-bc8b-4ee79df7cb4b) (aka TenGeneve)
    port 8094bf16-8ca9-4de9-ab92-aa9af23b6e73
        type: localport
        addresses: ["fa:16:3e:35:3c:db 7.7.7.2"]
    port 4af127cb-9b74-4135-83d3-5f7fb49badba (aka geneveport)
        addresses: ["f8:f2:1e:03:bf:f2 7.7.7.201"]
    port 9f288ce3-ad56-44e3-bd91-b69787a9296d
        type: router
        router-port: lrp-9f288ce3-ad56-44e3-bd91-b69787a9296d
router 8d656c6d-1023-44f9-8c24-9d12713931c8 (neutron-b77b6c7d-ecbe-40e2-bb3c-1e35defde319) (aka router1)
    port lrp-9f288ce3-ad56-44e3-bd91-b69787a9296d
        mac: "fa:16:3e:c9:ee:6c"
        networks: ["7.7.7.1/24"]
    port lrp-bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
        mac: "fa:16:3e:c1:0d:1a"
        networks: ["10.10.54.165/24"]
        gateway chassis: [01619255-64b9-4963-a330-8f4d7d7eeb38 ecf6082b-78c4-499f-a9cf-ec59cb369b77]
    nat 27bcceda-2ce2-43f5-89c5-777e94c7481a
        external ip: "10.10.54.165"
        logical ip: "7.7.7.0/24"
        type: "snat"
    nat 3d5348c8-fed1-45c0-bf78-1661b5dddd67
        external ip: "10.10.54.185"
        logical ip: "7.7.7.201"
        type: "dnat_and_snat"
Offline OVS Debugging stopped
*****************************
Extracting OVN data from sos report...

Offline OVS Debugging: OVN data collected and stored in /tmp/ovs-offline
*******************************************************************
Starting container ovsdb-server-ovn_nb
0ed6bbfcb947e04f6677c10f2f4b01eaf5a39babb51418c9de3253028bbb54f0
Starting container ovsdb-server-ovn_sb
6ec793d20ee36dd0f4fecb2368d72a49512edaf4ca900ce48b6129c3914f09b0

Offline OVS Debugging started
******************************

Working directory: /tmp/ovs-offline:

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

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

* You can also run offline commands directly with the following:
    source /tmp/ovs-offline/bin/activate
switch d76451c4-efd7-45cd-bc38-2d83723acb50 (neutron-320f6a29-0e7a-4ffb-9b5c-69aa7d7e0528) (aka external)
    port provnet-df741617-6923-41e3-9ef6-075004808738
        type: localnet
        tag: 405
        addresses: ["unknown"]
    port bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
        type: router
        router-port: lrp-bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
    port dfc037cf-a0a7-4dad-8082-4ce92e746eea
        type: localport
        addresses: ["fa:16:3e:fe:1c:e0 10.10.54.101"]
switch c92ecaeb-0dc2-4de5-ba2f-088373087a03 (neutron-232ef89b-5e67-48ae-bc8b-4ee79df7cb4b) (aka TenGeneve)
    port 8094bf16-8ca9-4de9-ab92-aa9af23b6e73
        type: localport
        addresses: ["fa:16:3e:35:3c:db 7.7.7.2"]
    port 4af127cb-9b74-4135-83d3-5f7fb49badba (aka geneveport)
        addresses: ["f8:f2:1e:03:bf:f2 7.7.7.201"]
    port 9f288ce3-ad56-44e3-bd91-b69787a9296d
        type: router
        router-port: lrp-9f288ce3-ad56-44e3-bd91-b69787a9296d
router 8d656c6d-1023-44f9-8c24-9d12713931c8 (neutron-b77b6c7d-ecbe-40e2-bb3c-1e35defde319) (aka router1)
    port lrp-9f288ce3-ad56-44e3-bd91-b69787a9296d
        mac: "fa:16:3e:c9:ee:6c"
        networks: ["7.7.7.1/24"]
    port lrp-bd77314d-4fbd-4ba6-a00c-926c1e31b8ed
        mac: "fa:16:3e:c1:0d:1a"
        networks: ["10.10.54.165/24"]
        gateway chassis: [01619255-64b9-4963-a330-8f4d7d7eeb38 ecf6082b-78c4-499f-a9cf-ec59cb369b77]
    nat 27bcceda-2ce2-43f5-89c5-777e94c7481a
        external ip: "10.10.54.165"
        logical ip: "7.7.7.0/24"
        type: "snat"
    nat 3d5348c8-fed1-45c0-bf78-1661b5dddd67
        external ip: "10.10.54.185"
        logical ip: "7.7.7.201"
        type: "dnat_and_snat"