Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[code sync] Merge code from sonic-net/sonic-utilities:202205 to 202205 #12

Merged
merged 2 commits into from
Jun 23, 2023

Conversation

mssonicbld
Copy link
Collaborator

* 17874100 - (head/202205) [202205][db_migrator] Add migration of FLEX_COUNTER_DELAY_STATUS during 1911->2211 upgrade + fast-reboot. Add UT. (#2870) (2023-06-22) [Vadym Hlushko]<br>```

vadymhlushko-mlnx and others added 2 commits June 22, 2023 17:12
…ng 1911->2211 upgrade + fast-reboot. Add UT. (#2870)

What I did
Add migration of FLEX_COUNTER_DELAY_STATUS attribute of config_db FLEX_COUNTER_TABLE during the SONiC to SONiC upgrade + fast-reboot from older versions 201911 -> 202205.

This change is required for the fast-reboot procedure because without it the counters will be created during the init flow which will waste a lot of resources and cause data plane degradation of more than 30 seconds.

How I did it
Modify the db_migrator.py.

How to verify it
Add UT.

Signed-off-by: vadymhlushko-mlnx <[email protected]>
@mssonicbld mssonicbld merged commit b7c78cb into Azure:202205 Jun 23, 2023
jfeng-arista pushed a commit to jfeng-arista/sonic-utilities.msft that referenced this pull request Sep 1, 2023
cisco sonic router will hit below error message from route_check
str3-8101-02 ERR monit[519]: 'routeCheck' status failed (255) –
Failure results: Azure#12 "Unaccounted_ROUTE_ENTRY_TABLE_entries": Azure#12 "fddd:a150:a0::a66:1/128",Azure#12 "fddd:a150:a0::a67:1/128",Azure#12 "fddd:a150:a0::a71:1/128",Azure#12 "fddd:a150:a0::a78:1/128",Azure#12 "fddd:a150:a0::a80:1/128"Azure#12
Azure#12#012Failed. Look at reported mismatches above#012add: []#012del: []

the parser will only cut the chars before : regardless it is the IPv6 format.
For instance,
route_check: "fddd:a150:a0::a21:1/128
Will be parsed as “fddd" ONLY
Vnet_v6_in_v4-0: : a150:a0::a21:1/128"
solution:
fix the parsing scheme on route check when APPL_DB refers IPv6 format.
mssonicbld pushed a commit to mssonicbld/sonic-utilities.msft that referenced this pull request Nov 24, 2023
…ng (#3030)

* [fast-reboot-filter-routes.py] Remove click and improve error reporting

1. Removed click usage from a script since there is no active click
context therefore we saw these error messages:

```
ERR fast-reboot-filter-routes: Got an exception There is no active click context.: Traceback: Traceback (most recent call last):Azure#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 18, in get_connected_routes#012    output, ret = clicommon.run_command(cmd, return_cmd=True)Azure#12  File "/usr/local/lib/python3.9/dist-packages/utilities_common/cli.py", line 545, in run_command#012    proc = subprocess.Popen(command, shell=shell, text=True, stdout=subprocess.PIPE)Azure#12  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__#012    self._execute_child(args, executable, preexec_fn, close_fds,Azure#12  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child#012    raise child_exception_type(errno_num, err_msg, err_filename)#012FileNotFoundError: [Errno 2] No such file or directory: 'sudo vtysh -c "show ip route connected json"'Azure#12#012During handling of the above exception, another exception occurred:Azure#12#012Traceback (most recent call last):Azure#12  File "/usr/local/lib/python3.9/dist-packages/click/globals.py", line 23, in get_current_context#012    return getattr(_local, 'stack')[-1]#012AttributeError: '_thread._local' object has no attribute 'stack'Azure#12#012During handling of the above exception, another exception occurred:Azure#12#012Traceback (most recent call last):Azure#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 79, in <module>Azure#12    res = main()Azure#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 70, in main#012    connected_routes = get_connected_routes()Azure#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 27, in get_connected_routes#012    ctx = click.get_current_context()Azure#12  File "/usr/local/lib/python3.9/dist-packages/click/globals.py", line 26, in get_current_context#012    raise RuntimeError('There is no active click context.')#012RuntimeError: There is no active click context.
```

2. Improved error reporting so that when an error occurs when we run a
command it will report it via terminal and syslog:

stdout:
```
Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson
```

syslog:
```
Oct 17 11:53:10.620788 arc-switch1025 ERR fast-reboot-filter-routes: Got an exception: Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson: Traceback: Traceback (most recent call last):Azure#12  File "/home/admin/fast-reboot-filter-routes.py", line 73, in <module>Azure#12    res = main()Azure#12  File "/home/admin/fast-reboot-filter-routes.py", line 64, in main#012    connected_routes = get_connected_routes()Azure#12  File "/home/admin/fast-reboot-filter-routes.py", line 18, in get_connected_routes#012    raise Exception("Failed to execute {}: {}".format(" ".join(cmd), output.rstrip('\n')))#012Exception: Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson
```

Signed-off-by: Stepan Blyschak <[email protected]>

* add a test for command failure

Signed-off-by: Stepan Blyschak <[email protected]>

* Increase coverage

Signed-off-by: Stepan Blyschak <[email protected]>

---------

Signed-off-by: Stepan Blyschak <[email protected]>
mssonicbld pushed a commit to mssonicbld/sonic-utilities.msft that referenced this pull request Nov 24, 2023
**What I did**

Fix the Mem Leak by moving the raw pointers in type_maps to use smart pointers

**Why I did it**

```
Indirect leak of 83776 byte(s) in 476 object(s) allocated from:
    #0 0x7f0a2a414647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    Azure#1 0x5555590cc923 in __gnu_cxx::new_allocator, std::allocator > const, referenced_object> > >::allocate(unsigned long, void const*) /usr/include/c++/10/ext/new_allocator.h:115
    Azure#2 0x5555590cc923 in std::allocator_traits, std::allocator > const, referenced_object> > > >::allocate(std::allocator, std::allocator > const, referenced_object> > >&, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:460
    Azure#3 0x5555590cc923 in std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_get_node() /usr/include/c++/10/bits/stl_tree.h:584
    Azure#4 0x5555590cc923 in std::_Rb_tree_node, std::allocator > const, referenced_object> >* std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_create_node, std::allocator > const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:634
    Azure#5 0x5555590cc923 in std::_Rb_tree_iterator, std::allocator > const, referenced_object> > std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_emplace_hint_unique, std::allocator > const&>, std::tuple<> >(std::_Rb_tree_const_iterator, std::allocator > const, referenced_object> >, std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:2461
    Azure#6 0x5555590e8757 in std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::operator[](std::__cxx11::basic_string, std::allocator > const&) /usr/include/c++/10/bits/stl_map.h:501
    Azure#7 0x5555590d48b0 in Orch::setObjectReference(std::map, std::allocator >, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*, std::less, std::allocator > >, std::allocator, std::allocator > const, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*> > >&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) orchagent/orch.cpp:450
    Azure#8 0x5555594ff66b in QosOrch::handleQueueTable(Consumer&, std::tuple, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::vector, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator >, std::__cxx11::basic_string, std::allocator > > > > >&) orchagent/qosorch.cpp:1763
    Azure#9 0x5555594edbd6 in QosOrch::doTask(Consumer&) orchagent/qosorch.cpp:2179
    Azure#10 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:241
    Azure#11 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:238
    Azure#12 0x5555590c8743 in Consumer::execute() orchagent/orch.cpp:235
    Azure#13 0x555559090dad in OrchDaemon::start() orchagent/orchdaemon.cpp:755
    Azure#14 0x555558e9be25 in main orchagent/main.cpp:766
    Azure#15 0x7f0a299b6d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
```
r12f pushed a commit that referenced this pull request Dec 18, 2024
…ng (#3030)

* [fast-reboot-filter-routes.py] Remove click and improve error reporting

1. Removed click usage from a script since there is no active click
context therefore we saw these error messages:

```
ERR fast-reboot-filter-routes: Got an exception There is no active click context.: Traceback: Traceback (most recent call last):#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 18, in get_connected_routes#012    output, ret = clicommon.run_command(cmd, return_cmd=True)#12  File "/usr/local/lib/python3.9/dist-packages/utilities_common/cli.py", line 545, in run_command#012    proc = subprocess.Popen(command, shell=shell, text=True, stdout=subprocess.PIPE)#12  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__#012    self._execute_child(args, executable, preexec_fn, close_fds,#12  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child#012    raise child_exception_type(errno_num, err_msg, err_filename)#012FileNotFoundError: [Errno 2] No such file or directory: 'sudo vtysh -c "show ip route connected json"'#12#012During handling of the above exception, another exception occurred:#12#012Traceback (most recent call last):#12  File "/usr/local/lib/python3.9/dist-packages/click/globals.py", line 23, in get_current_context#012    return getattr(_local, 'stack')[-1]#012AttributeError: '_thread._local' object has no attribute 'stack'#12#012During handling of the above exception, another exception occurred:#12#012Traceback (most recent call last):#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 79, in <module>#12    res = main()#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 70, in main#012    connected_routes = get_connected_routes()#12  File "/usr/local/bin/fast-reboot-filter-routes.py", line 27, in get_connected_routes#012    ctx = click.get_current_context()#12  File "/usr/local/lib/python3.9/dist-packages/click/globals.py", line 26, in get_current_context#012    raise RuntimeError('There is no active click context.')#012RuntimeError: There is no active click context.
```

2. Improved error reporting so that when an error occurs when we run a
command it will report it via terminal and syslog:

stdout:
```
Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson
```

syslog:
```
Oct 17 11:53:10.620788 arc-switch1025 ERR fast-reboot-filter-routes: Got an exception: Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson: Traceback: Traceback (most recent call last):#12  File "/home/admin/fast-reboot-filter-routes.py", line 73, in <module>#12    res = main()#12  File "/home/admin/fast-reboot-filter-routes.py", line 64, in main#012    connected_routes = get_connected_routes()#12  File "/home/admin/fast-reboot-filter-routes.py", line 18, in get_connected_routes#012    raise Exception("Failed to execute {}: {}".format(" ".join(cmd), output.rstrip('\n')))#012Exception: Failed to execute sudo vtysh -c show ip route connected jsson: % Unknown command: show ip route connected jsson
```

Signed-off-by: Stepan Blyschak <[email protected]>

* add a test for command failure

Signed-off-by: Stepan Blyschak <[email protected]>

* Increase coverage

Signed-off-by: Stepan Blyschak <[email protected]>

---------

Signed-off-by: Stepan Blyschak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants