Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,12 @@ def reboot(self, reboot_type=ModuleBase.MODULE_REBOOT_DPU):
bool: True if the request has been issued successfully, False if not
"""
logger.log_notice(f"Rebooting {self._name} with type {reboot_type}")
# no_wait=True is not supported at this point, because of race conditions with other drivers
return_value = self.dpuctl_obj.dpu_reboot(skip_pre_post=True)
# Skip pre shutdown and Post startup, handled by pci_detach and pci_reattach
if reboot_type == ModuleBase.MODULE_REBOOT_DPU:
return_value = self.dpuctl_obj.dpu_reboot(skip_pre_post=True)
elif reboot_type == ModuleBase.MODULE_REBOOT_SMARTSWITCH:
# Do not wait for result if we are rebooting NPU + DPUs
return_value = self.dpuctl_obj.dpu_reboot(no_wait=True, skip_pre_post=True)
logger.log_notice(f"Rebooted {self._name} with type {reboot_type} and return value {return_value}")
return return_value

Expand Down
4 changes: 3 additions & 1 deletion platform/mellanox/mlnx-platform-api/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ def test_dpu_module(self, mock_call, mock_get):
mock_obj.assert_called_once_with(skip_pre_post=True)
mock_obj.reset_mock()
m.reboot(reboot_type=ModuleBase.MODULE_REBOOT_SMARTSWITCH)
mock_obj.assert_called_once_with(skip_pre_post=True)
mock_obj.assert_called_once_with(no_wait=True, skip_pre_post=True)
with pytest.raises(RuntimeError):
m.reboot("None")
with patch('sonic_py_common.syslogger.SysLogger.log_error') as mock_method:
m.dpuctl_obj.dpu_power_on = mock.MagicMock(return_value=True)
assert m.set_admin_state(True)
Expand Down
Loading