def test_corosync_targets_skip_offline_unfence_node_running_corosync( self, ): self._unfence_failure_common_calls() self.config.http.corosync.get_corosync_online_targets( communication_list=[ dict( label=self.existing_nodes[0], output=corosync_running_check_response(True), ), dict( label=self.existing_nodes[1], output=corosync_running_check_response(False), ), dict( label=self.existing_nodes[2], was_connected=False, errno=7, error_msg="an error", ), ] ) self.config.http.scsi.unfence_node( communication_list=[ dict( label=self.existing_nodes[0], raw_data=json.dumps( dict( node=self.existing_nodes[0], original_devices=DEVICES_1, updated_devices=DEVICES_2, ) ), ), ], ) self.config.env.push_cib( resources=fixture_scsi(devices=DEVICES_2), status=_fixture_status_lrm_ops( SCSI_STONITH_ID, lrm_start_ops=DEFAULT_LRM_START_OPS_UPDATED, lrm_monitor_ops=DEFAULT_LRM_MONITOR_OPS_UPDATED, ), ) self.command(force_flags=[reports.codes.SKIP_OFFLINE_NODES])() self.env_assist.assert_reports( [ fixture.warn( reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, node=self.existing_nodes[2], command="remote/status", reason="an error", ), ] )
def test_corosync_targets_skip_offline_unfence_node_running_corosync( self, ): self.config_cib() self.config.corosync_conf.load_content( corosync_conf_fixture(self.existing_corosync_nodes)) self.config.http.corosync.get_corosync_online_targets( communication_list=[ dict( label=self.existing_nodes[0], output=corosync_running_check_response(True), ), dict( label=self.existing_nodes[1], output=corosync_running_check_response(False), ), dict( label=self.existing_nodes[2], was_connected=False, errno=7, error_msg="an error", ), ]) communication_list = [ dict( label=self.existing_nodes[0], raw_data=json.dumps(self.get_raw_data(self.existing_nodes[0])), ), ] self.unfence_config(communication_list=communication_list) self.config.env.push_cib( resources=fixture_scsi( stonith_id=self.stonith_id, stonith_type=self.stonith_type, devices=DEVICES_2, ), status=_fixture_status_lrm_ops( self.stonith_id, self.stonith_type, lrm_start_ops=DEFAULT_LRM_START_OPS_UPDATED, lrm_monitor_ops=DEFAULT_LRM_MONITOR_OPS_UPDATED, ), ) self.command(force_flags=[reports.codes.SKIP_OFFLINE_NODES])() self.env_assist.assert_reports([ fixture.warn( reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, node=self.existing_nodes[2], command="remote/status", reason="an error", ), ])
def test_need_stopped_cluster_not_stopped_skip_offline(self): # If we know for sure that corosync is running, skip_offline doesn't # matter. self.corosync_conf_facade.need_stopped_cluster = True self.config.http.corosync.check_corosync_offline(communication_list=[ dict( label="node-1", output=corosync_running_check_response(True), ), dict(label="node-2"), ]) env = self.env_assistant.get_env() self.env_assistant.assert_raise_library_error( lambda: env.push_corosync_conf(self.corosync_conf_facade, skip_offline_nodes=True), [], ) self.env_assistant.assert_reports([ fixture.info(report_codes.COROSYNC_NOT_RUNNING_CHECK_STARTED), fixture.error( report_codes.COROSYNC_RUNNING_ON_NODE, node="node-1", ), fixture.info( report_codes.COROSYNC_NOT_RUNNING_ON_NODE, node="node-2", ), ])
def test_corosync_targets_unable_to_connect(self): self._unfence_failure_common_calls() self.config.http.corosync.get_corosync_online_targets( communication_list=[ dict( label=self.existing_nodes[0], output=corosync_running_check_response(True), ), ] + [ dict( label=node, was_connected=False, errno=7, error_msg="an error", ) for node in self.existing_nodes[1:] ] ) self.env_assist.assert_raise_library_error(self.command()) self.env_assist.assert_reports( [ fixture.error( reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, force_code=reports.codes.SKIP_OFFLINE_NODES, node=node, command="remote/status", reason="an error", ) for node in self.existing_nodes[1:] ] )
def test_corosync_targets_unable_to_perform_unfencing_operation( self, ): self._unfence_failure_common_calls() self.config.http.corosync.get_corosync_online_targets( communication_list=[ dict( label=self.existing_nodes[0], was_connected=False, errno=7, error_msg="an error", ), dict( label=self.existing_nodes[1], was_connected=False, errno=7, error_msg="an error", ), dict( label=self.existing_nodes[2], output=corosync_running_check_response(False), ), ] ) self.config.http.scsi.unfence_node([DEV_2], communication_list=[]) self.env_assist.assert_raise_library_error( self.command(force_flags=[reports.codes.SKIP_OFFLINE_NODES]) ) self.env_assist.assert_reports( [ fixture.warn( reports.codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, node=node, command="remote/status", reason="an error", ) for node in self.existing_nodes[0:2] ] + [ fixture.error( reports.codes.UNABLE_TO_PERFORM_OPERATION_ON_ANY_NODE, ), ] )
def test_need_stopped_cluster_not_stopped(self): self.corosync_conf_facade.need_stopped_cluster = True self.config.http.corosync.check_corosync_offline(communication_list=[{ "label": self.node_labels[0], "output": corosync_running_check_response(True), }] + [{ "label": node } for node in self.node_labels[1:]]) env = self.env_assistant.get_env() self.env_assistant.assert_raise_library_error( lambda: env.push_corosync_conf(self.corosync_conf_facade), []) self.env_assistant.assert_reports([ fixture.info(report_codes.COROSYNC_NOT_RUNNING_CHECK_STARTED), fixture.error( report_codes.COROSYNC_RUNNING_ON_NODE, node="node-1", ), fixture.info( report_codes.COROSYNC_NOT_RUNNING_ON_NODE, node="node-2", ), ])