Bug 1965780

Summary: No logical flows is printed by ovn-sbctl when it is running in the daemon mode
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Alexey Roytman <aroytman>
Component: OVNAssignee: OVN Team <ovnteam>
Status: CLOSED ERRATA QA Contact: Jianlin Shi <jishi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: FDP 20.ICC: ctrautma, jiji, kfida, mmichels
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovn-2021-21.06.0-3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-29 20:05:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexey Roytman 2021-05-29 18:59:33 UTC
Description of problem:
When ovn-sbctl runs in the daemon mode, the `lflow-list/dump-flows` commands do not produce any output. Maybe other commands of ovn-snctl and ovn-nbctl have the same issue. 

Version-Release number of selected component (if applicable):
ovn-sbctl 21.03.90
Open vSwitch Library 2.15.90
DB Schema 20.17.0

How reproducible:
see below

Steps to Reproduce:
1. create several of logical floes, e.g. `ovn-nbctl ls-add sw0`
2. validate that `ovn-sbctl lflow-list` returns the flows.
3. run ovn-sbctl as a daemon `export OVN_SB_DAEMON=$(ovn-sbctl --pidfile --detach)`
4 repeat the `ovn-sbctl lflow-list` call. It doesn't produce any output.

Actual results:
No logic flows is printed

Expected results:
Print logical flows.

Additional info:

Comment 1 Mark Michelson 2021-06-03 14:45:53 UTC
If you're looking for a sandbox reproducer:

export OVN_SB_DAEMON=$(ovn-sbctl --pidfile --detach)

ovn-nbctl ls-add sw

ovn-nbctl lr-add ro1
ovn-nbctl lrp-add ro1 ro1-sw 00:00:00:00:00:01 10.0.0.1/24
ovn-nbctl lsp-add sw sw-ro1

ovn-nbctl lr-add ro2
ovn-nbctl lrp-add ro2 ro2-sw 00:00:00:00:00:02 20.0.0.1/24
ovn-nbctl --wait=sb lsp-add sw sw-ro2

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 vm1
ovn-nbctl lsp-set-addresses vm1 "00:00:00:00:01:02 192.168.1.2"
ovn-nbctl lrp-add ro1 ro1-ls1 00:00:00:00:01:01 192.168.1.1/24
ovn-nbctl lsp-add ls1 ls1-ro1
ovn-nbctl lsp-set-type ls1-ro1 router
ovn-nbctl lsp-set-addresses ls1-ro1 router
ovn-nbctl lsp-set-options ls1-ro1 router-port=ro1-ls1

ovn-nbctl ls-add ls2
ovn-nbctl lsp-add ls2 vm2
ovn-nbctl lsp-set-addresses vm2 "00:00:00:00:02:02 192.168.2.2"
ovn-nbctl lrp-add ro2 ro2-ls2 00:00:00:00:02:01 192.168.2.1/24
ovn-nbctl lsp-add ls2 ls2-ro2
ovn-nbctl lsp-set-type ls2-ro2 router
ovn-nbctl lsp-set-addresses ls2-ro2 router
ovn-nbctl lsp-set-options ls2-ro2 router-port=ro2-ls2

ovn-nbctl lsp-set-type sw-ro1 router
ovn-nbctl lsp-set-addresses sw-ro1 router
ovn-nbctl lsp-set-options sw-ro1 router-port=ro1-sw

ovn-nbctl lsp-set-type sw-ro2 router
ovn-nbctl lsp-set-addresses sw-ro2 router
ovn-nbctl --wait=sb lsp-set-options sw-ro2 router-port=ro2-sw


Try running `ovn-sbctl lflow-list` and you'll see no output.

Comment 2 Mark Michelson 2021-06-03 14:54:47 UTC
I'm pretty sure this issue here is that lflow-list uses printf to output the data. However, in daemon mode, the data needs to be sent to the sbctl client process to be output instead.

Comment 6 Jianlin Shi 2021-07-08 05:51:26 UTC
Verified on ovn-2021-20.06.0-4:

[root@wsfd-advnetlab16 bz1965780]# rpm -qa | grep -E "openvswitch|ovn-2021"                           
openvswitch-selinux-extra-policy-1.0-28.el8fdp.noarch
ovn-2021-21.06.0-4.el8fdp.x86_64
openvswitch2.15-2.15.0-26.el8fdp.x86_64
ovn-2021-central-21.06.0-4.el8fdp.x86_64
ovn-2021-host-21.06.0-4.el8fdp.x86_64

[root@wsfd-advnetlab16 bz1965780]# cat rep.sh 
systemctl start openvswitch                                                                           
systemctl start ovn-northd                                                                            
ovn-nbctl set-connection ptcp:6641                                                                    
ovn-sbctl set-connection ptcp:6642                                                                    
ovs-vsctl set open . external_ids:system-id=hv1 external_ids:ovn-remote=tcp:1.1.171.25:6642 external_ids:ovn-encap-type=geneve external_ids:ovn-encap-ip=1.1.171.25
systemctl restart ovn-controller 

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 ls1p1
ovn-nbctl lsp-set-addresses ls1p1 "00:00:00:01:01:01 192.168.1.1"
ovs-vsctl add-port br-int ls1p1 -- set interface ls1p1 type=internal external_ids:iface-id=ls1p1

ovn-sbctl lflow-list
export OVN_SB_DAEMON=$(ovn-sbctl --pidfile --detach)
echo $OVN_SB_DAEMON
ovn-sbctl lflow-list

+ export OVN_SB_DAEMON=/var/run/ovn/ovn-sbctl.33316.ctl                   
+ OVN_SB_DAEMON=/var/run/ovn/ovn-sbctl.33316.ctl                                                                                                                                                           
+ echo /var/run/ovn/ovn-sbctl.33316.ctl                                   
/var/run/ovn/ovn-sbctl.33316.ctl                                          
+ ovn-sbctl lflow-list                                                              
Datapath: "ls1" (2773fde0-72c6-48a2-91f7-bd0ae820aeb5)  Pipeline: ingress                    
  table=0 (ls_in_port_sec_l2  ), priority=100  , match=(eth.src[40]), action=(drop;) 
......

<=== flow is printed

Comment 8 errata-xmlrpc 2021-07-29 20:05:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ovn bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:2969