def _check_if_atb_can_be_disabled( runner, report_processor, corosync_conf, was_enabled, force=False ): """ Check whenever auto_tie_breaker can be changed without affecting SBD. Raises LibraryError if change of ATB will affect SBD functionality. runner -- CommandRunner report_processor -- report processor corosync_conf -- corosync conf facade was_enabled -- True if ATB was enabled, False otherwise force -- force change """ if ( was_enabled and not corosync_conf.is_enabled_auto_tie_breaker() and sbd.is_auto_tie_breaker_needed(runner, corosync_conf) ): report_processor.process( reports.corosync_quorum_atb_cannot_be_disabled_due_to_sbd( ReportItemSeverity.WARNING if force else ReportItemSeverity.ERROR , None if force else report_codes.FORCE_OPTIONS ))
def _check_if_atb_can_be_disabled( runner, report_processor: ReportProcessor, corosync_conf, was_enabled, force=False, ): """ Check whenever auto_tie_breaker can be changed without affecting SBD. Raises LibraryError if change of ATB will affect SBD functionality. runner -- CommandRunner report_processor -- report processor corosync_conf -- corosync conf facade was_enabled -- True if ATB was enabled, False otherwise force -- force change """ if (was_enabled and not corosync_conf.is_enabled_auto_tie_breaker() and sbd.is_auto_tie_breaker_needed(runner, corosync_conf)): report_processor.report( reports.corosync_quorum_atb_cannot_be_disabled_due_to_sbd( ReportItemSeverity.WARNING if force else ReportItemSeverity.ERROR, None if force else report_codes.FORCE_OPTIONS)) if report_processor.has_errors: raise LibraryError()
def _check_if_atb_can_be_disabled( service_manager: ServiceManagerInterface, report_processor: ReportProcessor, corosync_conf: CorosyncConfFacade, was_enabled: bool, force: bool = False, ) -> None: """ Check whenever auto_tie_breaker can be changed without affecting SBD. Raises LibraryError if change of ATB will affect SBD functionality. service_manager -- report_processor -- report processor corosync_conf -- corosync conf facade was_enabled -- True if ATB was enabled, False otherwise force -- force change """ if (was_enabled and not corosync_conf.is_enabled_auto_tie_breaker() and sbd.is_auto_tie_breaker_needed(service_manager, corosync_conf)): report_processor.report( ReportItem( severity=reports.item.get_severity( reports.codes.FORCE, force, ), message=(reports.messages. CorosyncQuorumAtbCannotBeDisabledDueToSbd()), )) if report_processor.has_errors: raise LibraryError()
def common_test(self, nodes_and_qdevice, sbd_installed, sbd_enabled, device_set, result): self.mock_nodes_and_qdevice.return_value = nodes_and_qdevice self.mock_sbd_installed.return_value = sbd_installed self.mock_sbd_enabled.return_value = sbd_enabled self.mock_device_set.return_value = device_set self.assertEqual( lib_sbd.is_auto_tie_breaker_needed(self.runner, self.corosync_conf_facade, self.node_num_modifier), result) self.mock_nodes_and_qdevice.assert_called_once_with( self.corosync_conf_facade, self.node_num_modifier)
def common_test( self, nodes_and_qdevice, sbd_installed, sbd_enabled, device_set, result ): self.mock_nodes_and_qdevice.return_value = nodes_and_qdevice self.mock_sbd_installed.return_value = sbd_installed self.mock_sbd_enabled.return_value = sbd_enabled self.mock_device_set.return_value = device_set self.assertEqual( lib_sbd.is_auto_tie_breaker_needed( self.runner, self.corosync_conf_facade, self.node_num_modifier ), result ) self.mock_nodes_and_qdevice.assert_called_once_with( self.corosync_conf_facade, self.node_num_modifier )