[vm_topology.py]: Vlan interface addition delay handling#645
[vm_topology.py]: Vlan interface addition delay handling#645maggiemsft merged 3 commits intosonic-net:masterfrom
Conversation
Vlan interface addition may take few secs to reflect in OVS Command, which causes entire add-topo task to fail. We should have more concrete fail check. As of now added a code to Retry and Exception. Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com>
| if vlan_iface_id is None: | ||
| raise Exception("Can't find vlan_iface_id") | ||
|
|
||
| injected_iface_id = bindings[injected_iface] |
There was a problem hiding this comment.
Can you please hide retry logic inside of get_ovs_port_bindings()?
There was a problem hiding this comment.
1.) I can do that, but I will need to add an extra argument [=vlan_iface] to function get_ovs_port_bindings().
i.e get_ovs_port_bindings(br_name) ==> get_ovs_port_bindings(br_name, vlan_iface).
2.) Or I can write an wrapper on top on get_ovs_port_bindings(br_name) to check vlan_iface.
Kindly let me know which sounds better. Thanks a lot for review.
Vlan interface addition may take few secs to reflect in OVS Command, which causes entire add-topo task to fail. We should have more concrete fail check. As of now added a code to Retry and Exception. Move Retry handing in get_ovs_port_bindings Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com>
praveen-li
left a comment
There was a problem hiding this comment.
Moved Retry mechanism in get_ovs_port_bindings. Kindly Review new changes.
| if vlan_iface_id is None: | ||
| raise Exception("Can't find vlan_iface_id") | ||
|
|
||
| injected_iface_id = bindings[injected_iface] |
There was a problem hiding this comment.
1.) I can do that, but I will need to add an extra argument [=vlan_iface] to function get_ovs_port_bindings().
i.e get_ovs_port_bindings(br_name) ==> get_ovs_port_bindings(br_name, vlan_iface).
2.) Or I can write an wrapper on top on get_ovs_port_bindings(br_name) to check vlan_iface.
Kindly let me know which sounds better. Thanks a lot for review.
| raise Exception("Can't find vlan_iface_id") | ||
|
|
||
| vlan_iface_id = bindings[vlan_iface] | ||
| injected_iface_id = bindings[injected_iface] |
There was a problem hiding this comment.
Gentle Reminder for review.
| bindings = VMTopology.get_ovs_port_bindings(br_name) | ||
| bindings, error = VMTopology.get_ovs_port_bindings(br_name, vlan_iface) | ||
| if error: | ||
| raise Exception("Can't find vlan_iface_id") |
There was a problem hiding this comment.
Can you please raise an Exception inside of the get_ovs_port_bindings method? I don't see any reason you want to have it here.
There was a problem hiding this comment.
Sure I will change that part.
There was a problem hiding this comment.
Sure will raise in function get_ovs_port_bindings.
| # Let`s retry few times in that case. | ||
| retries = 0 | ||
| vlan_iface_id = None | ||
| while retries < RETRIES: |
There was a problem hiding this comment.
I'd better to use for retries in xrange(RETRIES):
There was a problem hiding this comment.
I will change this to range. range takes more space than xrange but it is supported in python3 as well.
| if vlan_iface is None: | ||
| return result, False | ||
| # Check if we have vlan_iface populated | ||
| vlan_iface_id = result[vlan_iface] |
There was a problem hiding this comment.
how can you be sure you have vlan_iface key in the result? I think you need to check that you have vlan_iface key in the result first
There was a problem hiding this comment.
Sure let me add a check for this.
| vlan_iface_id = result[vlan_iface] | ||
| if vlan_iface_id: | ||
| return result, False | ||
| time.sleep(1) |
There was a problem hiding this comment.
make the sleep time increasing in some way?
1,2,3 seconds
or
1, 3, 5 seconds
There was a problem hiding this comment.
i can use 2*retries +1.
Vlan interface addition may take few secs to reflect in OVS Command, which causes entire add-topo task to fail. We should have more concrete fail check. As of now added a code to Retry and Exception. Review Comments Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com>
|
Incorporated Review comments, kindly Review. Thanks a lot. |
Incorporated review comments from PR sonic-net#645, sonic-net#645 Changes: 1.) Move vlan retry logic in get_ovs_port_bindings. 2.) Raise Exception only in get_ovs_port_bindings. RB=1366591 G=lnos-reviewers R=pchaudhary,pmao,rmolina,samaity,sfardeen,zxu A=
cherry-pick sonic-net#20169 to 202412 branch. <!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: warm reboot is not supported in isolated topology. change the skip condition to cover both 202412 and 202505 branch. ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 ### Approach #### What is the motivation for this PR? skip warm reboot test cases for pfcwd #### How did you do it? skip it with conditional mark #### How did you verify/test it? #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
… advance submodule head (sonic-net#11518) sairedis: * 38c0bb1 2022-07-21 | [sairedis] Fix reopen recoding file (sonic-net#1087) (HEAD -> 202205, github/202205) [Kamil Cudnik] platform-daemon: * 17587b6 2022-07-22 | [ycabled] add secure channel support for grpc dualtor active-active connectivity (sonic-net#275) (HEAD -> 202205, github/202205) [vdahiya12] linkmgrd: * c911ec7 2022-07-21 | Avoid unnecessary error logs from `handleGetServerMacAddressNotification` (sonic-net#96) (HEAD -> 202205) [Jing Zhang] * bbae81d 2022-07-18 | Add support for reconciliation after warm restart (sonic-net#76) [Jing Zhang] utilities: * bcc1206 2022-07-20 | Change db_migrator major version on master branch from version 2 to 3 (sonic-net#2272) (HEAD -> 202205) [Vaibhav Hemant Dixit] * ad40697 2022-07-21 | Fix test for pfcwd_sw_enable in db_migrator_test (sonic-net#2253) [bingwang-ms] * 886f612 2022-07-22 | Revert "show commands for SYSTEM READY (sonic-net#1851) (sonic-net#2261)" (sonic-net#2274) (github/202205) [Ying Xie] * a6404b7 2022-07-17 | show commands for SYSTEM READY (sonic-net#1851) (sonic-net#2261) [Senthil Kumar Guruswamy] swss-common: * 509b265 2022-07-06 | Add device global table definition (sonic-net#645) (HEAD -> 202205) [tjchadaga] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Vlan interface addition may take few secs to reflect in OVS Command, which causes entire add-topo task to fail. It is good to have more concrete fail check. As of now added a code to Retry and Exception.
Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
Description of PR
Vlan interface addition may take few secs to reflect in OVS Command, which causes entire add-topo task to fail. It is good to have more concrete fail check. As of now added a code to Retry and Exception.
Fixes # (issue)
Type of change
Approach
How did you do it?
Added retry part in case of delay. Retries count is 3.
How did you verify/test it?
Part of pipeline:
http://172.25.11.20:8080/user/falco/my-views/view/Sonic_Build_Deploy_And_Test_PipeLine/
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation