Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions crmsh/sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ def update_configuration(self) -> None:
utils.sysconfig_set(self.SYSCONFIG_SBD, **self.update_dict)
if self.cluster_is_running:
bootstrap.sync_path(self.SYSCONFIG_SBD)
logger.info("Already synced %s to all nodes", self.SYSCONFIG_SBD)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already has log inside bootstrap.sync_path


@classmethod
def update_sbd_configuration(cls, update_dict: typing.Dict[str, str]) -> None:
Expand Down Expand Up @@ -795,7 +794,8 @@ def purge_sbd_from_cluster():
service_manager.disable_service(constants.SBD_SERVICE, node)

config_bak = f"{SBDManager.SYSCONFIG_SBD}.bak"
logger.info("Move %s to %s on all nodes", SBDManager.SYSCONFIG_SBD, config_bak)
all_nodes_msg = " on all nodes" if utils.list_cluster_nodes_except_me() else ""
logger.info("Move %s to %s%s", SBDManager.SYSCONFIG_SBD, config_bak, all_nodes_msg)
utils.cluster_run_cmd(f"mv {SBDManager.SYSCONFIG_SBD} {config_bak}")

out = sh.cluster_shell().get_stdout_or_raise_error("stonith_admin -L")
Expand Down
7 changes: 4 additions & 3 deletions test/unittests/test_sbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ def test_update_configuration(self, mock_ServiceManager, mock_copy_local_file, m
sbdmanager_instance.update_configuration()
mock_logger_info.assert_has_calls([
call("Update %s in %s: %s", 'key', sbd.SBDManager.SYSCONFIG_SBD, 'value'),
call('Already synced %s to all nodes', sbd.SBDManager.SYSCONFIG_SBD)
])

@patch('logging.Logger.info')
Expand Down Expand Up @@ -808,6 +807,7 @@ def test_cleanup_existing_sbd_resource(self, mock_CrmMonXmlParser, mock_logger_i
call("Remove sbd resource '%s'", 'sbd_resource')
])

@patch('crmsh.utils.list_cluster_nodes_except_me')
@patch('crmsh.parallax.parallax_call')
@patch('crmsh.utils.cleanup_stonith_related_properties')
@patch('crmsh.sbd.sh.cluster_shell')
Expand All @@ -816,8 +816,9 @@ def test_cleanup_existing_sbd_resource(self, mock_CrmMonXmlParser, mock_logger_i
@patch('crmsh.sbd.ServiceManager')
@patch('crmsh.utils.list_cluster_nodes')
@patch('crmsh.sbd.cleanup_existing_sbd_resource')
def test_purge_sbd_from_cluster(self, mock_cleanup_existing_sbd_resource, mock_list_cluster_nodes, mock_ServiceManager, mock_logger_info, mock_cluster_run_cmd, mock_cluster_shell, mock_cleanup_stonith_related_properties, mock_parallax_call):
def test_purge_sbd_from_cluster(self, mock_cleanup_existing_sbd_resource, mock_list_cluster_nodes, mock_ServiceManager, mock_logger_info, mock_cluster_run_cmd, mock_cluster_shell, mock_cleanup_stonith_related_properties, mock_parallax_call, mock_list_cluster_nodes_except_me):
mock_list_cluster_nodes.return_value = ['node1', 'node2']
mock_list_cluster_nodes_except_me.return_value = ['node2']
mock_ServiceManager.return_value.service_is_enabled.side_effect = [True, True]
stonith_data = """stonith-sbd
1 fence device found
Expand All @@ -827,6 +828,6 @@ def test_purge_sbd_from_cluster(self, mock_cleanup_existing_sbd_resource, mock_l
mock_logger_info.assert_has_calls([
call("Disable %s on node %s", constants.SBD_SERVICE, 'node1'),
call("Disable %s on node %s", constants.SBD_SERVICE, 'node2'),
call("Move %s to %s on all nodes", sbd.SBDManager.SYSCONFIG_SBD, sbd.SBDManager.SYSCONFIG_SBD+'.bak')
call("Move %s to %s%s", sbd.SBDManager.SYSCONFIG_SBD, sbd.SBDManager.SYSCONFIG_SBD+'.bak', ' on all nodes')
])
mock_cleanup_stonith_related_properties.assert_called_once()