use of com.sequenceiq.cloudbreak.api.model.HostMetadataResponse in project cloudbreak by hortonworks.
the class HostMetadataToHostMetadataResponseConverter method convert.
@Override
public HostMetadataResponse convert(HostMetadata source) {
HostMetadataResponse hostMetadataResponse = new HostMetadataResponse();
hostMetadataResponse.setId(source.getId());
hostMetadataResponse.setGroupName(source.getHostGroup().getName());
hostMetadataResponse.setName(source.getHostName());
hostMetadataResponse.setState(source.getHostMetadataState().name());
return hostMetadataResponse;
}
use of com.sequenceiq.cloudbreak.api.model.HostMetadataResponse in project cloudbreak by hortonworks.
the class CloudbreakUtil method waitForHostStatusStack.
public static WaitResult waitForHostStatusStack(StackEndpoint stackV1Endpoint, String stackId, String hostGroup, String desiredStatus) {
WaitResult waitResult = WaitResult.SUCCESSFUL;
Boolean found = FALSE;
int retryCount = 0;
do {
LOGGER.info("Waiting for host status {} in hostgroup {} ...", desiredStatus, hostGroup);
sleep();
StackResponse stackResponse = stackV1Endpoint.get(Long.valueOf(stackId), new HashSet<>());
Set<HostGroupResponse> hostGroupResponse = stackResponse.getCluster().getHostGroups();
for (HostGroupResponse hr : hostGroupResponse) {
if (hr.getName().equals(hostGroup)) {
Set<HostMetadataResponse> hostMetadataResponses = hr.getMetadata();
for (HostMetadataResponse hmr : hostMetadataResponses) {
if (hmr.getState().equals(desiredStatus)) {
found = Boolean.TRUE;
}
}
}
}
retryCount++;
} while (!found && (retryCount < MAX_RETRY));
if (retryCount == MAX_RETRY) {
waitResult = WaitResult.TIMEOUT;
}
return waitResult;
}
Aggregations