Skip to content

Commit ae05d8c

Browse files
committed
Revert "[Mellanox][Smartswitch] Set default reboot type as DPU reboot"
This reverts commit ee76ce5. Signed-off-by: gpunathilell <gpunathilell@nvidia.com>
1 parent 2287035 commit ae05d8c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

platform/mellanox/mlnx-platform-api/sonic_platform/module.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,12 @@ def reboot(self, reboot_type=ModuleBase.MODULE_REBOOT_DPU):
337337
bool: True if the request has been issued successfully, False if not
338338
"""
339339
logger.log_notice(f"Rebooting {self._name} with type {reboot_type}")
340-
# no_wait=True is not supported at this point, because of race conditions with other drivers
341-
return_value = self.dpuctl_obj.dpu_reboot(skip_pre_post=True)
340+
# Skip pre shutdown and Post startup, handled by pci_detach and pci_reattach
341+
if reboot_type == ModuleBase.MODULE_REBOOT_DPU:
342+
return_value = self.dpuctl_obj.dpu_reboot(skip_pre_post=True)
343+
elif reboot_type == ModuleBase.MODULE_REBOOT_SMARTSWITCH:
344+
# Do not wait for result if we are rebooting NPU + DPUs
345+
return_value = self.dpuctl_obj.dpu_reboot(no_wait=True, skip_pre_post=True)
342346
logger.log_notice(f"Rebooted {self._name} with type {reboot_type} and return value {return_value}")
343347
return return_value
344348

platform/mellanox/mlnx-platform-api/tests/test_module.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ def test_dpu_module(self, mock_call, mock_get):
253253
mock_obj.assert_called_once_with(skip_pre_post=True)
254254
mock_obj.reset_mock()
255255
m.reboot(reboot_type=ModuleBase.MODULE_REBOOT_SMARTSWITCH)
256-
mock_obj.assert_called_once_with(skip_pre_post=True)
256+
mock_obj.assert_called_once_with(no_wait=True, skip_pre_post=True)
257+
with pytest.raises(RuntimeError):
258+
m.reboot("None")
257259
with patch('sonic_py_common.syslogger.SysLogger.log_error') as mock_method:
258260
m.dpuctl_obj.dpu_power_on = mock.MagicMock(return_value=True)
259261
assert m.set_admin_state(True)

0 commit comments

Comments
 (0)