Search in sources :

Example 1 with SaltHealthReport

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport in project cloudbreak by hortonworks.

the class SaltCheckerConclusionStep method check.

@Override
public Conclusion check(Long resourceId) {
    RPCResponse<SaltHealthReport> saltPingResponse;
    try {
        saltPingResponse = nodeStatusService.saltPing(resourceId);
    } catch (CloudbreakServiceException e) {
        LOGGER.debug("Salt health report failed, fallback and check unreachable nodes, error: {}", e.getMessage());
        return checkUnreachableNodes(resourceId);
    }
    SaltHealthReport report = saltPingResponse.getResult();
    if (report == null) {
        LOGGER.debug("Salt health report was null, fallback and check unreachable nodes.");
        return checkUnreachableNodes(resourceId);
    }
    List<String> failedServicesOnMaster = collectFailedServicesOnMaster(report);
    if (!failedServicesOnMaster.isEmpty()) {
        return createFailedConclusionForMaster(failedServicesOnMaster);
    } else {
        Map<String, String> unreachableMinions = collectUnreachableMinions(report);
        if (unreachableMinions.isEmpty()) {
            return succeeded();
        } else {
            return createFailedConclusionForMinions(unreachableMinions);
        }
    }
}
Also used : SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)

Example 2 with SaltHealthReport

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport in project cloudbreak by hortonworks.

the class SaltCheckerConclusionStepTest method createSaltPingResponse.

private RPCResponse<SaltHealthReport> createSaltPingResponse(HealthStatus masterServiceStatus, HealthStatus minionHealthStatus) {
    StatusDetails pingResponses = StatusDetails.newBuilder().setHost("host1").setStatus(minionHealthStatus).setStatusReason("bigproblem").build();
    SaltMinionsHealth saltMinionsHealth = SaltMinionsHealth.newBuilder().addPingResponses(pingResponses).build();
    ServiceStatus serviceStatus = ServiceStatus.newBuilder().setName("salt-bootstrap").setStatus(masterServiceStatus).build();
    SaltMasterHealth saltMasterHealth = SaltMasterHealth.newBuilder().addServices(serviceStatus).build();
    SaltHealthReport saltHealthReport = SaltHealthReport.newBuilder().setMaster(saltMasterHealth).setMinions(saltMinionsHealth).build();
    RPCResponse<SaltHealthReport> response = new RPCResponse<>();
    response.setResult(saltHealthReport);
    return response;
}
Also used : SaltMinionsHealth(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMinionsHealth) SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) ServiceStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.ServiceStatus) StatusDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.StatusDetails) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) SaltMasterHealth(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMasterHealth)

Example 3 with SaltHealthReport

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport in project cloudbreak by hortonworks.

the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound.

@Test
public void checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound() throws NodesUnreachableException {
    RPCResponse<SaltHealthReport> response = new RPCResponse<>();
    RPCMessage message = new RPCMessage();
    message.setMessage("rpc response");
    response.setMessages(List.of(message));
    when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
    when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
    when(stackUtil.collectNodes(any())).thenReturn(Set.of(createNode("host1"), createNode("host2")));
    when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenThrow(new NodesUnreachableException("error", Set.of("host1")));
    Conclusion stepResult = underTest.check(1L);
    assertTrue(stepResult.isFailureFound());
    assertEquals("Unreachable nodes: [host1]. We detected that cluster members can’t communicate with each other. " + "Please validate if all cluster members are available and healthy through your cloud provider.", stepResult.getConclusion());
    assertEquals("Unreachable salt minions: [host1]", stepResult.getDetails());
    assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).saltPing(eq(1L));
    verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
    verify(stackUtil, times(1)).collectNodes(any());
    verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
Also used : SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage) NodesUnreachableException(com.sequenceiq.cloudbreak.util.NodesUnreachableException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 4 with SaltHealthReport

use of com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport in project cloudbreak by hortonworks.

the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound.

@Test
public void checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound() throws NodesUnreachableException {
    RPCResponse<SaltHealthReport> response = new RPCResponse<>();
    RPCMessage message = new RPCMessage();
    message.setMessage("rpc response");
    response.setMessages(List.of(message));
    when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
    when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
    Set<Node> nodes = Set.of(createNode("host1"), createNode("host2"));
    when(stackUtil.collectNodes(any())).thenReturn(nodes);
    when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenReturn(nodes);
    Conclusion stepResult = underTest.check(1L);
    assertFalse(stepResult.isFailureFound());
    assertNull(stepResult.getConclusion());
    assertNull(stepResult.getDetails());
    assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).saltPing(eq(1L));
    verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
    verify(stackUtil, times(1)).collectNodes(any());
    verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
Also used : SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Aggregations

SaltHealthReport (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport)4 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)3 RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 Test (org.junit.jupiter.api.Test)2 SaltMasterHealth (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMasterHealth)1 SaltMinionsHealth (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMinionsHealth)1 ServiceStatus (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.ServiceStatus)1 StatusDetails (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.StatusDetails)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 NodesUnreachableException (com.sequenceiq.cloudbreak.util.NodesUnreachableException)1