Skip to content

Commit 70f8139

Browse files
authored
Extra delay between running firmware and updating firmware version (sonic-net#3610)
* Extra delay between running firmware and updating firmware version Signed-off-by: Stephen Sun <[email protected]> * Fix review comments Signed-off-by: Stephen Sun <[email protected]> --------- Signed-off-by: Stephen Sun <[email protected]>
1 parent 636f7f1 commit 70f8139

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sfputil/main.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,9 @@ def download_firmware(port_name, filepath):
15911591
1 = Hitless Reset to Inactive Image (Default)\n \
15921592
2 = Attempt non-hitless Reset to Running Image\n \
15931593
3 = Attempt Hitless Reset to Running Image\n")
1594-
def run(port_name, mode):
1594+
@click.option('--delay', metavar='<delay>', type=click.IntRange(0, 10), default=5,
1595+
help="Delay time before updating firmware information to STATE_DB")
1596+
def run(port_name, mode, delay):
15951597
"""Run the firmware with default mode=0"""
15961598

15971599
if is_port_type_rj45(port_name):
@@ -1607,6 +1609,11 @@ def run(port_name, mode):
16071609
click.echo('Failed to run firmware in mode={}! CDB status: {}'.format(mode, status))
16081610
sys.exit(EXIT_FAIL)
16091611

1612+
# The cable firmware can be still under initialization immediately after run_firmware
1613+
# We put a delay here to avoid potential error message in accessing the cable EEPROM
1614+
if delay:
1615+
time.sleep(delay)
1616+
16101617
update_firmware_info_to_state_db(port_name)
16111618
click.echo("Firmware run in mode={} success".format(mode))
16121619

0 commit comments

Comments
 (0)