-
Notifications
You must be signed in to change notification settings - Fork 539
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
Warm reboot: bring up ports for whole system warm reboot #653
Conversation
The existing implementation was targeting swss docker warm restart assuming stateDB and host netdev not touched. As to system warm reboot, for going up path, we need to make sure syncd/libsai/SDK have finished their tasks ( one of tasks is to recreate host interfaces), probably syncd should set a flag in stateDB (maybe reuse WARM_RESTART_TABLE, state=reconciled). Then swss starts it tasks. Since no real order control between portsyncd/portmgrd and orchagent, we should not re-apply the default config in port config file which may cause port state flapping and other unwanted consequence. While portmgrd has all up to date data for all config it had applied before shutdown, it is ok for it to replay the data. As to portState in StateDB, it is an indication that netdev has been created. During warm reboot, libsai/SDK/syncd should have guaranteed that state, the easy way is to save and restore it during reboot. Note, swss needs the state reconciled signal from syncd in stateDB to proceed. Just my 2cents about port state restore during system warm reboot. Of course there are other alternatives to the problem. |
tests/conftest.py
Outdated
@@ -167,6 +167,9 @@ def __init__(self, name=None, keeptb=False): | |||
if ctn.id == ctn_sw_id or ctn.name == ctn_sw_id: | |||
ctn_sw_name = ctn.name | |||
|
|||
# mount redis to base to unique directory | |||
self.redis_sock = '/var/run/redis-vs' + '/' + "redis.sock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rebase to master? #Pending
host interface admin state (up or down) is not owned by sai/syncd/sdk, they cannot recover that. They will creates those interfaces in the kernel, but it is portmgrd's job to make sure they are in the correct admin state. #Resolved |
portsyncd/linksync.cpp
Outdated
string cmd, res; | ||
/* Bring down the existing kernel interfaces */ | ||
SWSS_LOG_INFO("Bring down old interface %s(%d)", key.c_str(), idx_p->if_index); | ||
cmd = "ip link set " + key + " down"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in normal reboot (swss restart), it will see the previous netdev created in last run (syncd restart will recreate those interface). Therefore, it records all old interfaces and bring the down. In warm reboot (either swss docker restart or system reboot), the existing interface will be used, we should not bring them up. You can talk with prince on the previous normal restart flow. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ask to clarify, do you mean below?
In warm reboot (either swss docker restart or system reboot), the existing interface will be used, we should not bring them down.
In reply to: 227303475 [](ancestors = 227303475)
@jipanyang , I am not sure we need a flag to indicate syncd has finished it job. after system reboot, syncd will start and wait for orchagent to all create_switch(). orchagent will start and call create_switch(). once create_switch is finished, SAI is finishing the warm reboot process. All SAI states are recovered and all host interfaces are created (not bring up). Then, portsyncd will enumerate all ports and put them into state db. portmgrd will bring them up. In the code, bring the port down is an issue, I think he needs to figure out how to properly solve this one. But other than that, I think this is what you described, i do not see it is different from what qi propose. #Resolved |
@lguohan @qiluo-msft Again, the default setting in port config file should not be applied again (as in portsyncd), it could cause ASIC port state flapping. We'll want to add more and more incremental update support for port attribute config in portmgrd process. For port state in stateDB, either |
f5e17fa
to
4504893
Compare
I fixed "the default setting in port config file should not be applied again". The only left one is admin_status, which I think it is safe. In reply to: 432374478 [](ancestors = 432374478) |
How is it fixed? Take autoneg as example: if its value is true in port_config.ini, and it was changed to false and applied to ASIC. After warm restart, with this change, autoneg may be enabled again in ASIC. #Resolved |
Also there is possible race condition: since the RTM_NEWLINK message is triggered by libsai/SDK and you are relying on it to populated port state in stateDB, portsyncd may miss the message ( |
Good point. I refine the code, and bypass processing port_config.ini. In reply to: 433596747 [](ancestors = 433596747) |
Good point. I add netlink.dumpRequest in portsyncd to prevent any missing. In reply to: 433597472 [](ancestors = 433597472) |
Existing implementation lacks one feature: Although we restore ConfigDB, containing admin_status up for all ports, after whole system reboot, portmgrd doesn't bring up the netdev. In reply to: 432090516 [](ancestors = 432090516) |
The existing code "https://github.com/Azure/sonic-swss/blob/master/cfgmgr/portmgr.cpp#L122 " should work? I think we do need to move the regular port config https://github.com/Azure/sonic-swss/blob/65b015b17a42013c988b871654f9b4edfb75e749/portsyncd/portsyncd.cpp#L149 to portmgrd, it could be done in separate PR. #Resolved |
We had that at the very initial portsyncd/orchagent warm restart implementation, the conclusion at that time is we don't want to couple portsyncd and orchagent. Why is it needed now? Orchagent has all the data and is self consistent at least for state restore phase. I remember seeing some issue with netlink.dumpRequest() for cold restart (probably with swss only cold restart), but could not recall the exact problem. We may keep an eye on it. |
The code you mentioned is working if ConfigDB has admin_status, set it in ApplDB. However, in portsycnd, code will remove ConfigDB. In reply to: 434191133 [](ancestors = 434191133) |
Currently portsyncd is designed with responsible for waiting all port 'state ok', in both cold start or warm start. Here no new couple coming. Orchagent need to wait all port 'state ok' to begin the warm start logic.
Let me know if you recall, thanks! In reply to: 434192623 [](ancestors = 434192623) |
During warm reboot, orchagent doesn't need the port ok signal from portsyncd. The way orchagent communicates with syncd and the timing of switch create in syncd (at the very begining https://github.com/Azure/sonic-sairedis/blob/d655d20f9ae1b9918fc17317a203046299eba19a/syncd/syncd_hard_reinit.cpp#L1259) has guaranteed the existence of host netdev. It is preferred that portsyncd is able to warm restart independently (it is now) without bothering orchagent. #Resolved |
You are exactly correct!
In reply to: 434419903 [](ancestors = 434419903) |
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
ab3265f
to
15afe73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
…ynchronous mode (sonic-net#653) * Prevent syncd from stopping swss in the presence of SAI failures in synchronous mode * Remove TODO message * Update log message
The motivation here is to fix warm starting swss. Current implementation will
Actually SAI implementation will only create netdev, and keep them down