diff mbox series

[ovs-dev,v2] northd: Fix logical router load-balancer nat rules when using DGP.

Message ID 20240711193139.326949-1-roberto.acosta@luizalabs.com
State Changes Requested
Headers show
Series [ovs-dev,v2] northd: Fix logical router load-balancer nat rules when using DGP. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_ovn-kubernetes success github build: passed
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Roberto Bartzen Acosta July 11, 2024, 7:31 p.m. UTC
This commit fixes the build_distr_lrouter_nat_flows_for_lb function to
include one NAT stateless flow entry for each DGP in use. Since we have
added support to create multiple gateway ports per logical router, it's
necessary to include in the LR nat rules pipeline a specific entry for each
attached DGP. Otherwise, the ingress traffic is only redirected when the
incoming LRP matches the chassis_resident field.

Considering that DNAT rules for DGPs were implemented with the need to
configure the DGP-related gateway-port column, the load-balancer NAT rule
configuration can use a similar idea. In this case, we don't know the LRP
responsible for the incoming traffic, and therefore we need to automatically
apply a stateless NAT rule to the load-balancer on all DGPs to allow inbound
traffic.

After applying this patch, the incoming and/or outgoing traffic can pass
through any chassis where the DGP resides without having problems with CT
state.

Fixes: 15348b7b806f ("ovn-northd: Multiple distributed gateway port support.")
Signed-off-by: Roberto Bartzen Acosta <roberto.acosta@luizalabs.com>
---
 northd/en-lr-stateful.c |  12 -----
 northd/northd.c         |  67 ++++++++++++++++++------
 tests/ovn-northd.at     | 111 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+), 27 deletions(-)

Comments

Aaron Conole July 23, 2024, 12:38 p.m. UTC | #1
Roberto Bartzen Acosta <roberto.acosta@luizalabs.com> writes:

> Hey Aaron,

Hi Roberto,

> How are you doing? 
> How can I see the real reason for this error? the log message "echo '*** ERROR: 255 ***'"
> after the "podman cp" doesn't say much to me, sorry.
> It seems to me that this has no relation to my patch. Can you help me understand the
> problem so I can fix it?

Sure thing - in the link below there is a pointer to a build URL:

https://github.com/ovsrobot/ovn/actions/runs/9897498819


And just looking at the logs, for example:

main: clean up vswitch
8559
../../../tests/ovn.at:36697: test -e $OVS_RUNDIR/ovs-vswitchd.pid
8560
../../../tests/ovn.at:36697: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
8561
ovn.at:36697: waiting while kill -0 $TMPPID 2>/dev/null...
8562
ovn.at:36697: wait succeeded quickly
8563
../../../tests/ovn.at:36697: test -e $OVS_RUNDIR/ovsdb-server.pid
8564
../../../tests/ovn.at:36697: ovs-appctl --timeout=10 -t ovsdb-server exit
8565
ovn.at:36697: waiting while kill -0 $TMPPID 2>/dev/null...
8566
ovn.at:36697: wait succeeded quickly
8567
Undefined Behavior Sanitizer or Address Sanitizer reported errors in: sanitizers.126090
8568

8569
=================================================================
8570
==126090==ERROR: LeakSanitizer: detected memory leaks
8571

8572
Direct leak of 108 byte(s) in 3 object(s) allocated from:
8573
    #0 0x55b195ca1110 in realloc (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8574
    #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
8575
    #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
8576
    #3 0x55b1960a4801 in ds_reserve /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
8577
    #4 0x55b1960a4801 in ds_put_format_valist /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
8578
    #5 0x55b1960a474a in ds_put_format /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
8579
    #6 0x55b195d98baf in build_distr_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11079:5
8580
    #7 0x55b195d98baf in build_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
8581
    #8 0x55b195d18f26 in build_lrouter_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
8582
    #9 0x55b195cfb804 in build_lflows_thread /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16150:21
8583
    #10 0x55b1960d88ce in ovsthread_wrapper /workspace/ovn-tmp/ovs/lib/ovs-thread.c:423:12
8584
    #11 0x55b195c9e7dc in asan_thread_start(void*) asan_interceptors.cpp.o
8585

8586
Direct leak of 36 byte(s) in 1 object(s) allocated from:
8587
    #0 0x55b195ca1110 in realloc (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8588
    #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
8589
    #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
8590
    #3 0x55b1960a4801 in ds_reserve /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
8591
    #4 0x55b1960a4801 in ds_put_format_valist /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
8592
    #5 0x55b1960a474a in ds_put_format /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
8593
    #6 0x55b195d98baf in build_distr_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11079:5
8594
    #7 0x55b195d98baf in build_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
8595
    #8 0x55b195d18f26 in build_lrouter_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
8596
    #9 0x55b195d16a60 in lflow_handle_northd_lb_changes /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16793:9
8597
    #10 0x55b195dced9a in lflow_northd_handler /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/en-lflow.c:144:10
8598
    #11 0x55b195e48bef in engine_compute /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:437:28
8599
    #12 0x55b195e48bef in engine_run_node /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:499:14
8600
    #13 0x55b195e48bef in engine_run /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:524:9
8601
    #14 0x55b195e05da5 in inc_proc_northd_run /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/inc-proc-northd.c:414:5
8602
    #15 0x55b195dc1bbc in main /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/ovn-northd.c:970:32
8603
    #16 0x7fa4617251c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
8604
    #17 0x7fa46172528a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
8605
    #18 0x55b195c05ea4 in _start (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x2dbea4) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8606

8607
Direct leak of 27 byte(s) in 3 object(s) allocated from:
8608
    #0 0x55b195ca1110 in realloc (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8609
    #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
8610
    #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
8611
    #3 0x55b1960a4801 in ds_reserve /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
8612
    #4 0x55b1960a4801 in ds_put_format_valist /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
8613
    #5 0x55b1960a474a in ds_put_format /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
8614
    #6 0x55b195d985e6 in build_distr_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11045:9
8615
    #7 0x55b195d985e6 in build_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
8616
    #8 0x55b195d18f26 in build_lrouter_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
8617
    #9 0x55b195cfb804 in build_lflows_thread /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16150:21
8618
    #10 0x55b1960d88ce in ovsthread_wrapper /workspace/ovn-tmp/ovs/lib/ovs-thread.c:423:12
8619
    #11 0x55b195c9e7dc in asan_thread_start(void*) asan_interceptors.cpp.o
8620

8621
Direct leak of 9 byte(s) in 1 object(s) allocated from:
8622
    #0 0x55b195ca1110 in realloc (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8623
    #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
8624
    #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
8625
    #3 0x55b1960a4801 in ds_reserve /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
8626
    #4 0x55b1960a4801 in ds_put_format_valist /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
8627
    #5 0x55b1960a474a in ds_put_format /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
8628
    #6 0x55b195d985e6 in build_distr_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11045:9
8629
    #7 0x55b195d985e6 in build_lrouter_nat_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
8630
    #8 0x55b195d18f26 in build_lrouter_flows_for_lb /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
8631
    #9 0x55b195d16a60 in lflow_handle_northd_lb_changes /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16793:9
8632
    #10 0x55b195dced9a in lflow_northd_handler /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/en-lflow.c:144:10
8633
    #11 0x55b195e48bef in engine_compute /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:437:28
8634
    #12 0x55b195e48bef in engine_run_node /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:499:14
8635
    #13 0x55b195e48bef in engine_run /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:524:9
8636
    #14 0x55b195e05da5 in inc_proc_northd_run /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/inc-proc-northd.c:414:5
8637
    #15 0x55b195dc1bbc in main /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/ovn-northd.c:970:32
8638
    #16 0x7fa4617251c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
8639
    #17 0x7fa46172528a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
8640
    #18 0x55b195c05ea4 in _start (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x2dbea4) (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
8641

8642
SUMMARY: AddressSanitizer: 180 byte(s) leaked in 8 allocation(s).
8643
../../../tests/ovs-macros.at:231: hard failure
8644
500. ovn.at:36697: 500. DNAT_SNAT and LB traffic -- parallelization=yes -- ovn_monitor_all=no (ovn.at:36697): FAILED (ovs-macros.at:231)
8645


I guess that's because you added:

     struct ds undnat_action = DS_EMPTY_INITIALIZER;
    struct ds dnat_action = DS_EMPTY_INITIALIZER;
    struct ds snat_action = DS_EMPTY_INITIALIZER;

BUT, it doesn't look like you destroy them when done, so you leak the
memory.

I think that's the cause for these, but just a quick review.

If you do ever suspect an issue you can use the recheck feature of the
robot to kick off another run and look for those.

See the following for more details:
https://mail.openvswitch.org/pipermail/ovs-dev/2023-December/410120.html

Hope it helps!

> Thanks!
>
> Kind regards,
> Roberto
>
> Em qui., 11 de jul. de 2024 às 19:04, 0-day Robot <robot@bytheb.org> escreveu:
>
>  From: robot@bytheb.org
>
>  Test-Label: github-robot: Build and Test
>  Test-Status: fail
>  http://patchwork.ozlabs.org/api/patches/1959493/
>
>  _github build: failed_
>  Build URL: https://github.com/ovsrobot/ovn/actions/runs/9897498819
>  Build Logs:
>  -----------------------Summary of failed steps-----------------------
>  "linux clang test sanitizers 301-600" failed at step build
>  "linux clang test sanitizers 601- unstable" failed at step build
>  "linux clang system-test sanitizers -100" failed at step build
>  "linux clang system-test sanitizers 101- unstable" failed at step build
>  ----------------------End summary of failed steps--------------------
>
>  -------------------------------BEGIN LOGS----------------------------
>  ####################################################################################
>  
>  #### [Begin job log] "linux clang test sanitizers 301-600" at step build
>  ####################################################################################
>  
>  /workspace/logs/testsuite.dir/499/ovn-nb/
>  /workspace/logs/testsuite.dir/499/ovn-nb/ovn-nb.db
>  /workspace/logs/testsuite.dir/499/ovn-nb/.ovn-nb.db.~lock~
>  /workspace/logs/testsuite.dir/499/ovn-nb/ovsdb-server.log
>  /workspace/logs/testsuite.dir/499/cleanup
>  /workspace/logs/testsuite.dir/499/main/
>  /workspace/logs/testsuite.dir/499/main/hv2_br-phys-tx.pcap
>  /workspace/logs/testsuite.dir/499/main/hv2_br-phys-rx.pcap
>  /workspace/logs/testsuite.dir/499/main/hv1_br-phys-tx.pcap
>  /workspace/logs/testsuite.dir/499/main/hv1_br-phys-rx.pcap
>  /workspace/logs/testsuite.dir/499/main/conf.db
>  /workspace/logs/testsuite.dir/499/main/ovs-vswitchd.log
>  /workspace/logs/testsuite.dir/499/main/.conf.db.~lock~
>  /workspace/logs/testsuite.dir/499/main/ovsdb-server.log
>  /workspace/logs/testsuite.log
>  /workspace/logs/config.log
>  /workspace/logs/system-userspace-testsuite.at
>  /workspace/logs/system-dpdk-testsuite.at
>  /workspace/logs/system-kmod-testsuite.at
>  + podman cp
>  5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2://workspace/logs.tgz
>  logs.tgz
>  + echo '*** ERROR: 1 ***'
>  *** ERROR: 1 ***
>  + podman rm -f
>  5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2
>  5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2
>  ##[error]Process completed with exit code 1.
>  ####################################################################################
>  
>  #### [End job log] "linux clang test sanitizers 301-600" at step build
>  ####################################################################################
>  
>
>  ####################################################################################
>  
>  #### [Begin job log] "linux clang test sanitizers 601- unstable" at step build
>  ####################################################################################
>  
>  + '[' 255 -ne 0 ']'
>  + archive_logs
>  + '[' -z 1 ']'
>  + log_dir=/workspace/logs/
>  + container_exec '
>          mkdir /workspace/logs/         &&         cp /workspace/ovn-tmp/config.log
>  /workspace/logs/         &&         cp -r /workspace/ovn-tmp/*/_build/sub/tests/testsuite.* 
>         /workspace/logs/ || true         &&         cp -r
>  /workspace/ovn-tmp/tests/system-*-testsuite.*         /workspace/logs/ || true         &&   
>       chmod -R +r /workspace/logs/         &&
>          tar -czvf /workspace/logs.tgz /workspace/logs/
>      '
>  + podman exec -i
>  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1 /bin/bash -c
>  '
>          mkdir /workspace/logs/         &&         cp /workspace/ovn-tmp/config.log
>  /workspace/logs/         &&         cp -r /workspace/ovn-tmp/*/_build/sub/tests/testsuite.* 
>         /workspace/logs/ || true         &&         cp -r
>  /workspace/ovn-tmp/tests/system-*-testsuite.*         /workspace/logs/ || true         &&   
>       chmod -R +r /workspace/logs/         &&
>          tar -czvf /workspace/logs.tgz /workspace/logs/
>      '
>  cp: cannot stat '/workspace/ovn-tmp/*/_build/sub/tests/testsuite.*': No such file or
>  directory
>  tar: Removing leading `/' from member names
>  | | #defi/workspace/logs/
>  /workspace/logs/config.log
>  /workspace/logs/system-userspace-testsuite.at
>  /workspace/logs/system-dpdk-testsuite.at
>  /workspace/logs/system-kmod-testsuite.at
>  + podman cp
>  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1://workspace/logs.tgz
>  logs.tgz
>  + echo '*** ERROR: 255 ***'
>  *** ERROR: 255 ***
>  + podman rm -f
>  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1
>  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1
>  ##[error]Process completed with exit code 255.
>  ####################################################################################
>  
>  #### [End job log] "linux clang test sanitizers 601- unstable" at step build
>  ####################################################################################
>  
>
>  ####################################################################################
>  
>  #### [Begin job log] "linux clang system-test sanitizers -100" at step build
>  ####################################################################################
>  
>  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/ovn-nb.db
>  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/.ovn-nb.db.~lock~
>  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/ovsdb-server.log
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.11
>  /workspace/logs/system-kmod-testsuite.dir/036/ovsdb-server.log
>  /workspace/logs/system-kmod-testsuite.dir/036/cleanup
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.19
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.15
>  /workspace/logs/system-kmod-testsuite.dir/036/wget8.log
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.13
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.2
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.7
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.16
>  /workspace/logs/system-kmod-testsuite.dir/036/wget2.log
>  /workspace/logs/system-kmod-testsuite.dir/036/index.html.1
>  /workspace/logs/system-kmod-testsuite.log
>  /workspace/logs/system-userspace-testsuite.at
>  /workspace/logs/system-dpdk-testsuite.at
>  /workspace/logs/system-kmod-testsuite.at
>  + podman cp
>  8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049://workspace/logs.tgz
>  logs.tgz
>  + echo '*** ERROR: 1 ***'
>  *** ERROR: 1 ***
>  + podman rm -f
>  8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049
>  8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049
>  ##[error]Process completed with exit code 1.
>  ####################################################################################
>  
>  #### [End job log] "linux clang system-test sanitizers -100" at step build
>  ####################################################################################
>  
>
>  ####################################################################################
>  
>  #### [Begin job log] "linux clang system-test sanitizers 101- unstable" at step build
>  ####################################################################################
>  
>  /workspace/logs/system-kmod-testsuite.dir/181/conf.db
>  /workspace/logs/system-kmod-testsuite.dir/181/ovs-vswitchd.log
>  /workspace/logs/system-kmod-testsuite.dir/181/.conf.db.~lock~
>  /workspace/logs/system-kmod-testsuite.dir/181/northd/
>  /workspace/logs/system-kmod-testsuite.dir/181/northd/ovn-northd.log
>  /workspace/logs/system-kmod-testsuite.dir/181/ovn-controller.log
>  /workspace/logs/system-kmod-testsuite.dir/181/system-kmod-testsuite.log
>  /workspace/logs/system-kmod-testsuite.dir/181/nc1.pid
>  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/
>  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/ovn-nb.db
>  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/.ovn-nb.db.~lock~
>  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/ovsdb-server.log
>  /workspace/logs/system-kmod-testsuite.dir/181/ovsdb-server.log
>  /workspace/logs/system-kmod-testsuite.dir/181/nc0.pid
>  /workspace/logs/system-kmod-testsuite.dir/181/cleanup
>  /workspace/logs/system-kmod-testsuite.log
>  /workspace/logs/system-userspace-testsuite.at
>  /workspace/logs/system-dpdk-testsuite.at
>  /workspace/logs/system-kmod-testsuite.at
>  + podman cp
>  fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826://workspace/logs.tgz
>  logs.tgz
>  + echo '*** ERROR: 255 ***'
>  *** ERROR: 255 ***
>  + podman rm -f
>  fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826
>  fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826
>  ##[error]Process completed with exit code 255.
>  ####################################################################################
>  
>  #### [End job log] "linux clang system-test sanitizers 101- unstable" at step build
>  ####################################################################################
>  
>  --------------------------------END LOGS-----------------------------
>
> ‘Esta mensagem é direcionada apenas para os endereços constantes no cabeçalho inicial. Se você
> não está listado nos endereços constantes no cabeçalho, pedimos-lhe que desconsidere
> completamente o conteúdo dessa mensagem e cuja cópia, encaminhamento e/ou execução das
> ações citadas estão imediatamente anuladas e proibidas’.
>
>  ‘Apesar do Magazine Luiza tomar todas as precauções razoáveis para assegurar que nenhum vírus
> esteja presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por quaisquer
> perdas ou danos causados por esse e-mail ou por seus anexos’.
Roberto Bartzen Acosta July 23, 2024, 12:53 p.m. UTC | #2
Em ter., 23 de jul. de 2024 às 09:38, Aaron Conole <aconole@redhat.com>
escreveu:

> Roberto Bartzen Acosta <roberto.acosta@luizalabs.com> writes:
>
> > Hey Aaron,
>
> Hi Roberto,
>
> > How are you doing?
> > How can I see the real reason for this error? the log message "echo '***
> ERROR: 255 ***'"
> > after the "podman cp" doesn't say much to me, sorry.
> > It seems to me that this has no relation to my patch. Can you help me
> understand the
> > problem so I can fix it?
>
> Sure thing - in the link below there is a pointer to a build URL:
>
> https://github.com/ovsrobot/ovn/actions/runs/9897498819
>
>
> And just looking at the logs, for example:
>
> main: clean up vswitch
> 8559
> ../../../tests/ovn.at:36697: test -e $OVS_RUNDIR/ovs-vswitchd.pid
> 8560
> ../../../tests/ovn.at:36697: ovs-appctl --timeout=10 -t ovs-vswitchd exit
> --cleanup
> 8561
> ovn.at:36697: waiting while kill -0 $TMPPID 2>/dev/null...
> 8562
> ovn.at:36697: wait succeeded quickly
> 8563
> ../../../tests/ovn.at:36697: test -e $OVS_RUNDIR/ovsdb-server.pid
> 8564
> ../../../tests/ovn.at:36697: ovs-appctl --timeout=10 -t ovsdb-server exit
> 8565
> ovn.at:36697: waiting while kill -0 $TMPPID 2>/dev/null...
> 8566
> ovn.at:36697: wait succeeded quickly
> 8567
> Undefined Behavior Sanitizer or Address Sanitizer reported errors in:
> sanitizers.126090
> 8568
>
> 8569
> =================================================================
> 8570
> ==126090==ERROR: LeakSanitizer: detected memory leaks
> 8571
>
> 8572
> Direct leak of 108 byte(s) in 3 object(s) allocated from:
> 8573
>     #0 0x55b195ca1110 in realloc
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8574
>     #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
> 8575
>     #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
> 8576
>     #3 0x55b1960a4801 in ds_reserve
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
> 8577
>     #4 0x55b1960a4801 in ds_put_format_valist
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
> 8578
>     #5 0x55b1960a474a in ds_put_format
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
> 8579
>     #6 0x55b195d98baf in build_distr_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11079:5
> 8580
>     #7 0x55b195d98baf in build_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
> 8581
>     #8 0x55b195d18f26 in build_lrouter_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
> 8582
>     #9 0x55b195cfb804 in build_lflows_thread
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16150:21
> 8583
>     #10 0x55b1960d88ce in ovsthread_wrapper
> /workspace/ovn-tmp/ovs/lib/ovs-thread.c:423:12
> 8584
>     #11 0x55b195c9e7dc in asan_thread_start(void*) asan_interceptors.cpp.o
> 8585
>
> 8586
> Direct leak of 36 byte(s) in 1 object(s) allocated from:
> 8587
>     #0 0x55b195ca1110 in realloc
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8588
>     #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
> 8589
>     #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
> 8590
>     #3 0x55b1960a4801 in ds_reserve
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
> 8591
>     #4 0x55b1960a4801 in ds_put_format_valist
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
> 8592
>     #5 0x55b1960a474a in ds_put_format
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
> 8593
>     #6 0x55b195d98baf in build_distr_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11079:5
> 8594
>     #7 0x55b195d98baf in build_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
> 8595
>     #8 0x55b195d18f26 in build_lrouter_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
> 8596
>     #9 0x55b195d16a60 in lflow_handle_northd_lb_changes
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16793:9
> 8597
>     #10 0x55b195dced9a in lflow_northd_handler
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/en-lflow.c:144:10
> 8598
>     #11 0x55b195e48bef in engine_compute
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:437:28
> 8599
>     #12 0x55b195e48bef in engine_run_node
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:499:14
> 8600
>     #13 0x55b195e48bef in engine_run
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:524:9
> 8601
>     #14 0x55b195e05da5 in inc_proc_northd_run
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/inc-proc-northd.c:414:5
> 8602
>     #15 0x55b195dc1bbc in main
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/ovn-northd.c:970:32
> 8603
>     #16 0x7fa4617251c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9)
> (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
> 8604
>     #17 0x7fa46172528a in __libc_start_main
> (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId:
> 08134323d00289185684a4cd177d202f39c2a5f3)
> 8605
>     #18 0x55b195c05ea4 in _start
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x2dbea4)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8606
>
> 8607
> Direct leak of 27 byte(s) in 3 object(s) allocated from:
> 8608
>     #0 0x55b195ca1110 in realloc
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8609
>     #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
> 8610
>     #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
> 8611
>     #3 0x55b1960a4801 in ds_reserve
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
> 8612
>     #4 0x55b1960a4801 in ds_put_format_valist
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
> 8613
>     #5 0x55b1960a474a in ds_put_format
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
> 8614
>     #6 0x55b195d985e6 in build_distr_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11045:9
> 8615
>     #7 0x55b195d985e6 in build_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
> 8616
>     #8 0x55b195d18f26 in build_lrouter_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
> 8617
>     #9 0x55b195cfb804 in build_lflows_thread
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16150:21
> 8618
>     #10 0x55b1960d88ce in ovsthread_wrapper
> /workspace/ovn-tmp/ovs/lib/ovs-thread.c:423:12
> 8619
>     #11 0x55b195c9e7dc in asan_thread_start(void*) asan_interceptors.cpp.o
> 8620
>
> 8621
> Direct leak of 9 byte(s) in 1 object(s) allocated from:
> 8622
>     #0 0x55b195ca1110 in realloc
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x377110)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8623
>     #1 0x55b196100888 in xrealloc__ /workspace/ovn-tmp/ovs/lib/util.c:150:9
> 8624
>     #2 0x55b196100888 in xrealloc /workspace/ovn-tmp/ovs/lib/util.c:182:12
> 8625
>     #3 0x55b1960a4801 in ds_reserve
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:63:22
> 8626
>     #4 0x55b1960a4801 in ds_put_format_valist
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:164:9
> 8627
>     #5 0x55b1960a474a in ds_put_format
> /workspace/ovn-tmp/ovs/lib/dynamic-string.c:142:5
> 8628
>     #6 0x55b195d985e6 in build_distr_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11045:9
> 8629
>     #7 0x55b195d985e6 in build_lrouter_nat_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11302:17
> 8630
>     #8 0x55b195d18f26 in build_lrouter_flows_for_lb
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:11440:9
> 8631
>     #9 0x55b195d16a60 in lflow_handle_northd_lb_changes
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/northd.c:16793:9
> 8632
>     #10 0x55b195dced9a in lflow_northd_handler
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/en-lflow.c:144:10
> 8633
>     #11 0x55b195e48bef in engine_compute
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:437:28
> 8634
>     #12 0x55b195e48bef in engine_run_node
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:499:14
> 8635
>     #13 0x55b195e48bef in engine_run
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../lib/inc-proc-eng.c:524:9
> 8636
>     #14 0x55b195e05da5 in inc_proc_northd_run
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/inc-proc-northd.c:414:5
> 8637
>     #15 0x55b195dc1bbc in main
> /workspace/ovn-tmp/ovn-24.03.90/_build/sub/../../northd/ovn-northd.c:970:32
> 8638
>     #16 0x7fa4617251c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9)
> (BuildId: 08134323d00289185684a4cd177d202f39c2a5f3)
> 8639
>     #17 0x7fa46172528a in __libc_start_main
> (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId:
> 08134323d00289185684a4cd177d202f39c2a5f3)
> 8640
>     #18 0x55b195c05ea4 in _start
> (/workspace/ovn-tmp/ovn-24.03.90/_build/sub/northd/ovn-northd+0x2dbea4)
> (BuildId: 2796c1a70d6ad795706de27129fa1f63838eb036)
> 8641
>
> 8642
> SUMMARY: AddressSanitizer: 180 byte(s) leaked in 8 allocation(s).
> 8643
> ../../../tests/ovs-macros.at:231: hard failure
> 8644
> 500. ovn.at:36697: 500. DNAT_SNAT and LB traffic -- parallelization=yes
> -- ovn_monitor_all=no (ovn.at:36697): FAILED (ovs-macros.at:231)
> 8645
>
>
> I guess that's because you added:
>
>      struct ds undnat_action = DS_EMPTY_INITIALIZER;
>     struct ds dnat_action = DS_EMPTY_INITIALIZER;
>     struct ds snat_action = DS_EMPTY_INITIALIZER;
>
> BUT, it doesn't look like you destroy them when done, so you leak the
> memory.
>
> I think that's the cause for these, but just a quick review.
>
> If you do ever suspect an issue you can use the recheck feature of the
> robot to kick off another run and look for those.
>
> See the following for more details:
> https://mail.openvswitch.org/pipermail/ovs-dev/2023-December/410120.html


Hi Aaron,

Thanks for your help and feedback.

Kind regards,
Roberto


>
>
> Hope it helps!
>
> > Thanks!
> >
> > Kind regards,
> > Roberto
> >
> > Em qui., 11 de jul. de 2024 às 19:04, 0-day Robot <robot@bytheb.org>
> escreveu:
> >
> >  From: robot@bytheb.org
> >
> >  Test-Label: github-robot: Build and Test
> >  Test-Status: fail
> >  http://patchwork.ozlabs.org/api/patches/1959493/
> >
> >  _github build: failed_
> >  Build URL: https://github.com/ovsrobot/ovn/actions/runs/9897498819
> >  Build Logs:
> >  -----------------------Summary of failed steps-----------------------
> >  "linux clang test sanitizers 301-600" failed at step build
> >  "linux clang test sanitizers 601- unstable" failed at step build
> >  "linux clang system-test sanitizers -100" failed at step build
> >  "linux clang system-test sanitizers 101- unstable" failed at step build
> >  ----------------------End summary of failed steps--------------------
> >
> >  -------------------------------BEGIN LOGS----------------------------
> >
> ####################################################################################
> >
> >  #### [Begin job log] "linux clang test sanitizers 301-600" at step build
> >
> ####################################################################################
> >
> >  /workspace/logs/testsuite.dir/499/ovn-nb/
> >  /workspace/logs/testsuite.dir/499/ovn-nb/ovn-nb.db
> >  /workspace/logs/testsuite.dir/499/ovn-nb/.ovn-nb.db.~lock~
> >  /workspace/logs/testsuite.dir/499/ovn-nb/ovsdb-server.log
> >  /workspace/logs/testsuite.dir/499/cleanup
> >  /workspace/logs/testsuite.dir/499/main/
> >  /workspace/logs/testsuite.dir/499/main/hv2_br-phys-tx.pcap
> >  /workspace/logs/testsuite.dir/499/main/hv2_br-phys-rx.pcap
> >  /workspace/logs/testsuite.dir/499/main/hv1_br-phys-tx.pcap
> >  /workspace/logs/testsuite.dir/499/main/hv1_br-phys-rx.pcap
> >  /workspace/logs/testsuite.dir/499/main/conf.db
> >  /workspace/logs/testsuite.dir/499/main/ovs-vswitchd.log
> >  /workspace/logs/testsuite.dir/499/main/.conf.db.~lock~
> >  /workspace/logs/testsuite.dir/499/main/ovsdb-server.log
> >  /workspace/logs/testsuite.log
> >  /workspace/logs/config.log
> >  /workspace/logs/system-userspace-testsuite.at
> >  /workspace/logs/system-dpdk-testsuite.at
> >  /workspace/logs/system-kmod-testsuite.at
> >  + podman cp
> >
> 5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2://workspace/logs.tgz
> >  logs.tgz
> >  + echo '*** ERROR: 1 ***'
> >  *** ERROR: 1 ***
> >  + podman rm -f
> >  5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2
> >  5d6f68a7193409d86a8ab7c081c105496e9a3e4e994b119949e9709104b9c7a2
> >  ##[error]Process completed with exit code 1.
> >
> ####################################################################################
> >
> >  #### [End job log] "linux clang test sanitizers 301-600" at step build
> >
> ####################################################################################
> >
> >
> >
> ####################################################################################
> >
> >  #### [Begin job log] "linux clang test sanitizers 601- unstable" at
> step build
> >
> ####################################################################################
> >
> >  + '[' 255 -ne 0 ']'
> >  + archive_logs
> >  + '[' -z 1 ']'
> >  + log_dir=/workspace/logs/
> >  + container_exec '
> >          mkdir /workspace/logs/         &&         cp
> /workspace/ovn-tmp/config.log
> >  /workspace/logs/         &&         cp -r
> /workspace/ovn-tmp/*/_build/sub/tests/testsuite.*
> >         /workspace/logs/ || true         &&         cp -r
> >  /workspace/ovn-tmp/tests/system-*-testsuite.*         /workspace/logs/
> || true         &&
> >       chmod -R +r /workspace/logs/         &&
> >          tar -czvf /workspace/logs.tgz /workspace/logs/
> >      '
> >  + podman exec -i
> >  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1
> /bin/bash -c
> >  '
> >          mkdir /workspace/logs/         &&         cp
> /workspace/ovn-tmp/config.log
> >  /workspace/logs/         &&         cp -r
> /workspace/ovn-tmp/*/_build/sub/tests/testsuite.*
> >         /workspace/logs/ || true         &&         cp -r
> >  /workspace/ovn-tmp/tests/system-*-testsuite.*         /workspace/logs/
> || true         &&
> >       chmod -R +r /workspace/logs/         &&
> >          tar -czvf /workspace/logs.tgz /workspace/logs/
> >      '
> >  cp: cannot stat '/workspace/ovn-tmp/*/_build/sub/tests/testsuite.*': No
> such file or
> >  directory
> >  tar: Removing leading `/' from member names
> >  | | #defi/workspace/logs/
> >  /workspace/logs/config.log
> >  /workspace/logs/system-userspace-testsuite.at
> >  /workspace/logs/system-dpdk-testsuite.at
> >  /workspace/logs/system-kmod-testsuite.at
> >  + podman cp
> >
> 3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1://workspace/logs.tgz
> >  logs.tgz
> >  + echo '*** ERROR: 255 ***'
> >  *** ERROR: 255 ***
> >  + podman rm -f
> >  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1
> >  3f432eb02e21a359ab371521889acf59a561caf0497569bf47b6aa8d0bfa0ee1
> >  ##[error]Process completed with exit code 255.
> >
> ####################################################################################
> >
> >  #### [End job log] "linux clang test sanitizers 601- unstable" at step
> build
> >
> ####################################################################################
> >
> >
> >
> ####################################################################################
> >
> >  #### [Begin job log] "linux clang system-test sanitizers -100" at step
> build
> >
> ####################################################################################
> >
> >  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/ovn-nb.db
> >  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/.ovn-nb.db.~lock~
> >  /workspace/logs/system-kmod-testsuite.dir/036/ovn-nb/ovsdb-server.log
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.11
> >  /workspace/logs/system-kmod-testsuite.dir/036/ovsdb-server.log
> >  /workspace/logs/system-kmod-testsuite.dir/036/cleanup
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.19
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.15
> >  /workspace/logs/system-kmod-testsuite.dir/036/wget8.log
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.13
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.2
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.7
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.16
> >  /workspace/logs/system-kmod-testsuite.dir/036/wget2.log
> >  /workspace/logs/system-kmod-testsuite.dir/036/index.html.1
> >  /workspace/logs/system-kmod-testsuite.log
> >  /workspace/logs/system-userspace-testsuite.at
> >  /workspace/logs/system-dpdk-testsuite.at
> >  /workspace/logs/system-kmod-testsuite.at
> >  + podman cp
> >
> 8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049://workspace/logs.tgz
> >  logs.tgz
> >  + echo '*** ERROR: 1 ***'
> >  *** ERROR: 1 ***
> >  + podman rm -f
> >  8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049
> >  8de83105e9f78b7efbd81505be2ed39c2c78a061312a09510ec2d712c56ce049
> >  ##[error]Process completed with exit code 1.
> >
> ####################################################################################
> >
> >  #### [End job log] "linux clang system-test sanitizers -100" at step
> build
> >
> ####################################################################################
> >
> >
> >
> ####################################################################################
> >
> >  #### [Begin job log] "linux clang system-test sanitizers 101- unstable"
> at step build
> >
> ####################################################################################
> >
> >  /workspace/logs/system-kmod-testsuite.dir/181/conf.db
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovs-vswitchd.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/.conf.db.~lock~
> >  /workspace/logs/system-kmod-testsuite.dir/181/northd/
> >  /workspace/logs/system-kmod-testsuite.dir/181/northd/ovn-northd.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovn-controller.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/system-kmod-testsuite.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/nc1.pid
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/ovn-nb.db
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/.ovn-nb.db.~lock~
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovn-nb/ovsdb-server.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/ovsdb-server.log
> >  /workspace/logs/system-kmod-testsuite.dir/181/nc0.pid
> >  /workspace/logs/system-kmod-testsuite.dir/181/cleanup
> >  /workspace/logs/system-kmod-testsuite.log
> >  /workspace/logs/system-userspace-testsuite.at
> >  /workspace/logs/system-dpdk-testsuite.at
> >  /workspace/logs/system-kmod-testsuite.at
> >  + podman cp
> >
> fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826://workspace/logs.tgz
> >  logs.tgz
> >  + echo '*** ERROR: 255 ***'
> >  *** ERROR: 255 ***
> >  + podman rm -f
> >  fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826
> >  fac1c98ecaa438027bf2301f9437907052e7cffac1a8854a76b201fab3d8c826
> >  ##[error]Process completed with exit code 255.
> >
> ####################################################################################
> >
> >  #### [End job log] "linux clang system-test sanitizers 101- unstable"
> at step build
> >
> ####################################################################################
> >
> >  --------------------------------END LOGS-----------------------------
> >
> > ‘Esta mensagem é direcionada apenas para os endereços constantes no
> cabeçalho inicial. Se você
> > não está listado nos endereços constantes no cabeçalho, pedimos-lhe que
> desconsidere
> > completamente o conteúdo dessa mensagem e cuja cópia, encaminhamento
> e/ou execução das
> > ações citadas estão imediatamente anuladas e proibidas’.
> >
> >  ‘Apesar do Magazine Luiza tomar todas as precauções razoáveis para
> assegurar que nenhum vírus
> > esteja presente nesse e-mail, a empresa não poderá aceitar a
> responsabilidade por quaisquer
> > perdas ou danos causados por esse e-mail ou por seus anexos’.
>
>
diff mbox series

Patch

diff --git a/northd/en-lr-stateful.c b/northd/en-lr-stateful.c
index baf1bd2f8..f09691af6 100644
--- a/northd/en-lr-stateful.c
+++ b/northd/en-lr-stateful.c
@@ -516,18 +516,6 @@  lr_stateful_record_create(struct lr_stateful_table *table,
 
     table->array[od->index] = lr_stateful_rec;
 
-    /* Load balancers are not supported (yet) if a logical router has multiple
-     * distributed gateway port.  Log a warning. */
-    if (lr_stateful_rec->has_lb_vip && lr_has_multiple_gw_ports(od)) {
-        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
-        VLOG_WARN_RL(&rl, "Load-balancers are configured on logical "
-                     "router %s, which has %"PRIuSIZE" distributed "
-                     "gateway ports. Load-balancer is not supported "
-                     "yet when there is more than one distributed "
-                     "gateway port on the router.",
-                     od->nbr->name, od->n_l3dgw_ports);
-    }
-
     return lr_stateful_rec;
 }
 
diff --git a/northd/northd.c b/northd/northd.c
index 6898daa00..9d22698c9 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -11026,24 +11026,25 @@  static void
 build_distr_lrouter_nat_flows_for_lb(struct lrouter_nat_lb_flows_ctx *ctx,
                                      enum lrouter_nat_lb_flow_type type,
                                      struct ovn_datapath *od,
-                                     struct lflow_ref *lflow_ref)
+                                     struct lflow_ref *lflow_ref,
+                                     struct ovn_port *dgp)
 {
-    struct ovn_port *dgp = od->l3dgw_ports[0];
-
-    const char *undnat_action;
+    struct ds undnat_action = DS_EMPTY_INITIALIZER;
+    struct ds dnat_action = DS_EMPTY_INITIALIZER;
+    struct ds snat_action = DS_EMPTY_INITIALIZER;
 
     switch (type) {
     case LROUTER_NAT_LB_FLOW_FORCE_SNAT:
-        undnat_action = "flags.force_snat_for_lb = 1; next;";
+        ds_put_format(&undnat_action, "flags.force_snat_for_lb = 1; next;");
         break;
     case LROUTER_NAT_LB_FLOW_SKIP_SNAT:
-        undnat_action = "flags.skip_snat_for_lb = 1; next;";
+        ds_put_format(&undnat_action, "flags.skip_snat_for_lb = 1; next;");
         break;
     case LROUTER_NAT_LB_FLOW_NORMAL:
     case LROUTER_NAT_LB_FLOW_MAX:
-        undnat_action = lrouter_use_common_zone(od)
-                        ? "ct_dnat_in_czone;"
-                        : "ct_dnat;";
+        ds_put_format(&undnat_action, "%s",
+                      lrouter_use_common_zone(od) ? "ct_dnat_in_czone;"
+                      : "ct_dnat;");
         break;
     }
 
@@ -11051,6 +11052,31 @@  build_distr_lrouter_nat_flows_for_lb(struct lrouter_nat_lb_flows_ctx *ctx,
     size_t new_match_len = ctx->new_match->length;
     size_t undnat_match_len = ctx->undnat_match->length;
 
+    /* Change the logic to create LB NAT rules when we are using DGPs.
+     * 1. Remove the ct action from the lr_out_undenat NAT rule.
+     * 2. Add the LB backend IPs as a destination action of the lr_in_dnat
+     *    NAT rule with cumulative effect because any backend dst IP used in
+     *    the action list will redirect the packet to the ct_lb pipeline.
+     * 3. Add a new lr_out_snat NAT rule with the LB VIP as source IP
+     *    action to perform the NAT stateless pipeline completely.
+     */
+    if (od->n_l3dgw_ports > 1) {
+        ds_clear(&undnat_action);
+        ds_put_format(&undnat_action, "next;");
+
+        for (size_t i = 0; i < ctx->lb_vip->n_backends; i++) {
+            struct ovn_lb_backend *backend = &ctx->lb_vip->backends[i];
+            bool ipv6 = !IN6_IS_ADDR_V4MAPPED(&backend->ip);
+            ds_put_format(&dnat_action, "%s.dst=%s;", ipv6 ? "ip6" : "ip4",
+                          backend->ip_str);
+        }
+
+        ds_put_format(&snat_action, "%s.src=%s; next;",
+                      ctx->lb_vip->address_family == AF_INET6 ? "ip6" : "ip4",
+                      ctx->lb_vip->vip_str);
+
+    }
+    ds_put_format(&dnat_action, "%s", ctx->new_action[type]);
 
     const char *meter = NULL;
 
@@ -11060,11 +11086,11 @@  build_distr_lrouter_nat_flows_for_lb(struct lrouter_nat_lb_flows_ctx *ctx,
 
     if (ctx->lb_vip->n_backends || !ctx->lb_vip->empty_backend_rej) {
         ds_put_format(ctx->new_match, " && is_chassis_resident(%s)",
-                      od->l3dgw_ports[0]->cr_port->json_key);
+                      dgp->cr_port->json_key);
     }
 
     ovn_lflow_add_with_hint__(ctx->lflows, od, S_ROUTER_IN_DNAT, ctx->prio,
-                              ds_cstr(ctx->new_match), ctx->new_action[type],
+                              ds_cstr(ctx->new_match), ds_cstr(&dnat_action),
                               NULL, meter, &ctx->lb->nlb->header_,
                               lflow_ref);
 
@@ -11093,9 +11119,17 @@  build_distr_lrouter_nat_flows_for_lb(struct lrouter_nat_lb_flows_ctx *ctx,
                   " && is_chassis_resident(%s)", dgp->json_key, dgp->json_key,
                   dgp->cr_port->json_key);
     ovn_lflow_add_with_hint(ctx->lflows, od, S_ROUTER_OUT_UNDNAT, 120,
-                            ds_cstr(ctx->undnat_match), undnat_action,
-                            &ctx->lb->nlb->header_,
+                            ds_cstr(ctx->undnat_match),
+                            ds_cstr(&undnat_action), &ctx->lb->nlb->header_,
                             lflow_ref);
+
+    if (od->n_l3dgw_ports > 1) {
+        ovn_lflow_add_with_hint(ctx->lflows, od, S_ROUTER_OUT_SNAT, 120,
+                                ds_cstr(ctx->undnat_match),
+                                ds_cstr(&snat_action), &ctx->lb->nlb->header_,
+                                lflow_ref);
+    }
+
     ds_truncate(ctx->undnat_match, undnat_match_len);
 }
 
@@ -11263,8 +11297,11 @@  build_lrouter_nat_flows_for_lb(
         if (!od->n_l3dgw_ports) {
             bitmap_set1(gw_dp_bitmap[type], index);
         } else {
-            build_distr_lrouter_nat_flows_for_lb(&ctx, type, od,
-                                                 lb_dps->lflow_ref);
+            for (size_t i = 0; i < od->n_l3dgw_ports; i++) {
+                struct ovn_port *dgp = od->l3dgw_ports[i];
+                build_distr_lrouter_nat_flows_for_lb(&ctx, type, od,
+                                                     lb_dps->lflow_ref, dgp);
+            }
         }
 
         if (lb->affinity_timeout) {
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index a389d1988..bb508f9e6 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -12721,3 +12721,114 @@  AT_CHECK([ovn-sbctl dump-flows lr | grep lr_in_dnat | ovn_strip_lflows], [0], [d
 
 AT_CLEANUP
 ])
+
+OVN_FOR_EACH_NORTHD_NO_HV_PARALLELIZATION([
+AT_SETUP([Load balancer with Distributed Gateway Ports (LB + DGP + NAT Stateless)])
+ovn_start
+
+check ovn-nbctl ls-add public
+check ovn-nbctl lr-add lr1
+
+# lr1 DGP ts1
+check ovn-nbctl ls-add ts1
+check ovn-nbctl lrp-add lr1 lr1-ts1 00:00:01:02:03:04 172.16.10.1/24
+check ovn-nbctl lrp-set-gateway-chassis lr1-ts1 chassis-2
+
+# lr1 DGP ts2
+check ovn-nbctl ls-add ts2
+check ovn-nbctl lrp-add lr1 lr1-ts2 00:00:01:02:03:05 172.16.20.1/24
+check ovn-nbctl lrp-set-gateway-chassis lr1-ts2 chassis-3
+
+# lr1 DGP public
+check ovn-nbctl lrp-add lr1 lr1_public 00:de:ad:ff:00:01 173.16.0.1/16
+check ovn-nbctl lrp-add lr1 lr1_s1 00:de:ad:fe:00:02 172.16.0.1/24
+check ovn-nbctl lrp-set-gateway-chassis lr1_public chassis-1
+
+check ovn-nbctl ls-add s1
+# s1 - lr1
+check ovn-nbctl lsp-add s1 s1_lr1
+check ovn-nbctl lsp-set-type s1_lr1 router
+check ovn-nbctl lsp-set-addresses s1_lr1 "00:de:ad:fe:00:02 172.16.0.1"
+check ovn-nbctl lsp-set-options s1_lr1 router-port=lr1_s1
+
+# s1 - backend vm1
+check ovn-nbctl lsp-add s1 vm1
+check ovn-nbctl lsp-set-addresses vm1 "00:de:ad:01:00:01 172.16.0.101"
+
+# s1 - backend vm2
+check ovn-nbctl lsp-add s1 vm2
+check ovn-nbctl lsp-set-addresses vm2 "00:de:ad:01:00:02 172.16.0.102"
+
+# s1 - backend vm3
+check ovn-nbctl lsp-add s1 vm3
+check ovn-nbctl lsp-set-addresses vm3 "00:de:ad:01:00:03 172.16.0.103"
+
+# Add the lr1 DGP ts1 to the public switch
+check ovn-nbctl lsp-add public public_lr1_ts1
+check ovn-nbctl lsp-set-type public_lr1_ts1 router
+check ovn-nbctl lsp-set-addresses public_lr1_ts1 router
+check ovn-nbctl lsp-set-options public_lr1_ts1 router-port=lr1-ts1 nat-addresses=router
+
+# Add the lr1 DGP ts2 to the public switch
+check ovn-nbctl lsp-add public public_lr1_ts2
+check ovn-nbctl lsp-set-type public_lr1_ts2 router
+check ovn-nbctl lsp-set-addresses public_lr1_ts2 router
+check ovn-nbctl lsp-set-options public_lr1_ts2 router-port=lr1-ts2 nat-addresses=router
+
+# Add the lr1 DGP public to the public switch
+check ovn-nbctl lsp-add public public_lr1
+check ovn-nbctl lsp-set-type public_lr1 router
+check ovn-nbctl lsp-set-addresses public_lr1 router
+check ovn-nbctl lsp-set-options public_lr1 router-port=lr1_public nat-addresses=router
+
+# Create the Load Balancer lb1
+check ovn-nbctl --wait=sb lb-add lb1 "30.0.0.1" "172.16.0.103,172.16.0.102,172.16.0.101"
+
+# Associate load balancer to s1
+check ovn-nbctl ls-lb-add s1 lb1
+check ovn-nbctl --wait=sb sync
+
+ovn-sbctl dump-flows s1 > s1flows
+AT_CAPTURE_FILE([s1flows])
+
+AT_CHECK([grep "ls_in_pre_stateful" s1flows | ovn_strip_lflows | grep "30.0.0.1"], [0], [dnl
+  table=??(ls_in_pre_stateful ), priority=120  , match=(reg0[[2]] == 1 && ip4.dst == 30.0.0.1), action=(reg1 = 30.0.0.1; ct_lb_mark;)
+])
+AT_CHECK([grep "ls_in_lb" s1flows | ovn_strip_lflows | grep "30.0.0.1"], [0], [dnl
+  table=??(ls_in_lb           ), priority=110  , match=(ct.new && ip4.dst == 30.0.0.1), action=(reg0[[1]] = 0; ct_lb_mark(backends=172.16.0.103,172.16.0.102,172.16.0.101);)
+])
+
+# Associate load balancer to lr1 with DGP
+check ovn-nbctl lr-lb-add lr1 lb1
+check ovn-nbctl --wait=sb sync
+
+ovn-sbctl dump-flows lr1 > lr1flows
+AT_CAPTURE_FILE([lr1flows])
+
+# Check stateless NAT rules for load balancer with multiple DGP
+# 1. Check if the backend IPs are in the ipX.dst action
+AT_CHECK([grep "lr_in_dnat" lr1flows | ovn_strip_lflows | grep "30.0.0.1"], [0], [dnl
+  table=??(lr_in_dnat         ), priority=110  , match=(ct.new && !ct.rel && ip4 && ip4.dst == 30.0.0.1 && is_chassis_resident("cr-lr1-ts1")), action=(ip4.dst=172.16.0.103;ip4.dst=172.16.0.102;ip4.dst=172.16.0.101;ct_lb_mark(backends=172.16.0.103,172.16.0.102,172.16.0.101);)
+  table=??(lr_in_dnat         ), priority=110  , match=(ct.new && !ct.rel && ip4 && ip4.dst == 30.0.0.1 && is_chassis_resident("cr-lr1-ts2")), action=(ip4.dst=172.16.0.103;ip4.dst=172.16.0.102;ip4.dst=172.16.0.101;ct_lb_mark(backends=172.16.0.103,172.16.0.102,172.16.0.101);)
+  table=??(lr_in_dnat         ), priority=110  , match=(ct.new && !ct.rel && ip4 && ip4.dst == 30.0.0.1 && is_chassis_resident("cr-lr1_public")), action=(ip4.dst=172.16.0.103;ip4.dst=172.16.0.102;ip4.dst=172.16.0.101;ct_lb_mark(backends=172.16.0.103,172.16.0.102,172.16.0.101);)
+])
+
+# 2. Check if the DGP ports are in the match with action next
+AT_CHECK([grep "lr_out_undnat" lr1flows | ovn_strip_lflows], [0], [dnl
+  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
+  table=??(lr_out_undnat      ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1-ts1" || outport == "lr1-ts1") && is_chassis_resident("cr-lr1-ts1")), action=(next;)
+  table=??(lr_out_undnat      ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1-ts2" || outport == "lr1-ts2") && is_chassis_resident("cr-lr1-ts2")), action=(next;)
+  table=??(lr_out_undnat      ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1_public" || outport == "lr1_public") && is_chassis_resident("cr-lr1_public")), action=(next;)
+])
+
+# 3. Check if the VIP IP is in the ipX.src action
+AT_CHECK([grep "lr_out_snat" lr1flows | ovn_strip_lflows], [0], [dnl
+  table=??(lr_out_snat        ), priority=0    , match=(1), action=(next;)
+  table=??(lr_out_snat        ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1-ts1" || outport == "lr1-ts1") && is_chassis_resident("cr-lr1-ts1")), action=(ip4.src=30.0.0.1; next;)
+  table=??(lr_out_snat        ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1-ts2" || outport == "lr1-ts2") && is_chassis_resident("cr-lr1-ts2")), action=(ip4.src=30.0.0.1; next;)
+  table=??(lr_out_snat        ), priority=120  , match=(ip4 && ((ip4.src == 172.16.0.103) || (ip4.src == 172.16.0.102) || (ip4.src == 172.16.0.101)) && (inport == "lr1_public" || outport == "lr1_public") && is_chassis_resident("cr-lr1_public")), action=(ip4.src=30.0.0.1; next;)
+  table=??(lr_out_snat        ), priority=120  , match=(nd_ns), action=(next;)
+])
+
+AT_CLEANUP
+])