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);
}
}
}
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;
}
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());
}
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());
}
Aggregations