use of com.sequenceiq.cloudbreak.cluster.service.NodeIsBusyException in project cloudbreak by hortonworks.
the class ClouderaManagerDecomissioner method verifyNodeNotBusy.
private void verifyNodeNotBusy(Collection<String> hosts, ApiClient client) {
HostServiceStatuses hostServiceStates = getHostServiceStatuses(hosts, client);
if (hostServiceStates.anyHostBusy()) {
Set<String> busyHostNames = hostServiceStates.getBusyHosts();
LOGGER.info("Cannot downscale, some nodes are is BUSY state : ", busyHostNames);
throw new NodeIsBusyException(String.format("Node is in 'busy' state, cannot be decommissioned right now. " + "Please try to remove the node later. Busy hosts: %s", busyHostNames));
}
}
use of com.sequenceiq.cloudbreak.cluster.service.NodeIsBusyException in project cloudbreak by hortonworks.
the class ClusterDownscaleService method handleClusterDownscaleFailure.
public void handleClusterDownscaleFailure(long stackId, Exception error) {
String errorDetails = error.getMessage();
LOGGER.warn("Error during Cluster downscale flow: ", error);
DetailedStackStatus detailedStackStatus = DetailedStackStatus.DOWNSCALE_FAILED;
if (error instanceof NotEnoughNodeException || error instanceof NodeIsBusyException) {
detailedStackStatus = DetailedStackStatus.AVAILABLE;
}
stackUpdater.updateStackStatus(stackId, detailedStackStatus, "Node(s) could not be removed from the cluster: " + errorDetails);
flowMessageService.fireEventAndLog(stackId, UPDATE_FAILED.name(), CLUSTER_SCALING_FAILED, "removed from", errorDetails);
}
use of com.sequenceiq.cloudbreak.cluster.service.NodeIsBusyException in project cloudbreak by hortonworks.
the class ClouderaManagerDecommisionerTest method testVerifyNodesAreBusy.
@Test
public void testVerifyNodesAreBusy() throws ApiException {
// GIVEN
VolumeSetAttributes volumeSetAttributes = new VolumeSetAttributes("az", false, "fstab", List.of(), 50, "vt");
Stack stack = createTestStack(volumeSetAttributes);
Cluster cluster = new Cluster();
stack.setCluster(cluster);
Set<HostGroup> hostGroups = createTestHostGroups(1, 6);
cluster.setHostGroups(hostGroups);
ApiHostTemplateList hostTemplates = createEmptyHostTemplates();
when(clouderaManagerApiFactory.getHostTemplatesResourceApi(Mockito.any(ApiClient.class))).thenReturn(hostTemplatesResourceApi);
when(hostTemplatesResourceApi.readHostTemplates(stack.getName())).thenReturn(hostTemplates);
when(clouderaManagerApiFactory.getHostsResourceApi(Mockito.any(ApiClient.class))).thenReturn(hostsResourceApi);
when(hostsResourceApi.readHosts(eq(null), eq(null), anyString())).thenReturn(apiHostList);
when(apiHostList.getItems()).thenReturn(List.of(getBusyHost()));
when(resourceAttributeUtil.getTypedAttributes(Mockito.any(Resource.class), Mockito.any(Class.class))).thenReturn(Optional.of(volumeSetAttributes));
// WHEN
HostGroup firstHostGroup = hostGroups.iterator().next();
NodeIsBusyException e = Assertions.assertThrows(NodeIsBusyException.class, () -> underTest.verifyNodesAreRemovable(stack, firstHostGroup.getInstanceGroup().getInstanceMetaDataSet(), new ApiClient()));
assertEquals("Node is in 'busy' state, cannot be decommissioned right now. " + "Please try to remove the node later. Busy hosts: [hg0-host-1]", e.getMessage());
// THEN exception
}
Aggregations