Package com.sequenceiq.cloudbreak.controller

Examples of com.sequenceiq.cloudbreak.controller.InternalServerException


            if (attempt <= MAX_RETRIES) {
                LOGGER.info("Failed to update stack while creating corresponding cluster. [attempt: '{}', Cause: {}]. Trying to save it again.",
                        attempt++, e.getClass().getSimpleName());
                return doUpdateStackCluster(stackId, cluster);
            } else {
                throw new InternalServerException(String.format("Failed to update stack '%s' in 5 attempts. (while trying to add cluster)", stackId), e);
            }
        }
    }
View Full Code Here


            if (attempt <= MAX_RETRIES) {
                LOGGER.info("Failed to update stack while trying to set 'CF stack completed'. [attempt: '{}', Cause: {}]. Trying to save it again.",
                        attempt++, e.getClass().getSimpleName());
                return doUpdateStackCreateComplete(stackId);
            } else {
                throw new InternalServerException(String.format("Failed to update stack '%s' in 5 attempts. (while trying to set 'CF stack completed')",
                        stackId), e);
            }
        }
    }
View Full Code Here

            if (attempt <= MAX_RETRIES) {
                LOGGER.info("Failed to update stack while trying to set 'metadataReady'. [attempt: '{}', Cause: {}]. Trying to save it again.",
                        attempt++, e.getClass().getSimpleName());
                return doUpdateMetadataReady(stackId, ready);
            } else {
                throw new InternalServerException(String.format("Failed to update stack '%s' in 5 attempts. (while trying to set 'metadataReady')",
                        stackId), e);
            }
        }
    }
View Full Code Here

            if (attempt <= MAX_RETRIES) {
                LOGGER.info("Failed to update stack while trying to set 'nodecount'. [attempt: '{}', Cause: {}]. Trying to save it again.",
                        attempt++, e.getClass().getSimpleName());
                return doUpdateStackCreateComplete(stackId);
            } else {
                throw new InternalServerException(String.format("Failed to update stack '%s' in 5 attempts. (while trying to set 'nodecount')",
                        stackId), e);
            }
        }
    }
View Full Code Here

            JsonNode actualObj = null;
            try {
                actualObj = MAPPER.readValue(keyJson, JsonNode.class);
            } catch (IOException e) {
                LOGGER.info("Can not read Json node: ", e);
                throw new InternalServerException("Can not read Json node: ", e);
            }
            String storageAccountKey = actualObj.get("StorageService").get("StorageServiceKeys").get("Primary").asText();

            AzureClientUtil.createBlobContainer(storageAccountKey, targetBlobContainerUri);
            AzureClientUtil.copyOsImage(storageAccountKey, baseImageUri, targetImageUri);

            String copyStatus = PENDING;
            while (PENDING.equals(copyStatus)) {
                Map<String, String> copyStatusFromServer = (Map<String, String>) AzureClientUtil.getCopyOsImageProgress(storageAccountKey, targetImageUri);
                copyStatus = copyStatusFromServer.get("status");
                Long copied = Long.valueOf(copyStatusFromServer.get("copiedBytes"));
                Long total = Long.valueOf(copyStatusFromServer.get("totalBytes"));
                double copyPercentage = (long) ((float) copied / total * ONE_HUNDRED);
                LOGGER.info(String.format("copy progress=%s / %s percentage: %s%%.",
                        copyStatusFromServer.get("copiedBytes"),
                        copyStatusFromServer.get("totalBytes"),
                        copyPercentage));

                websocketService.sendToTopicUser(stack.getOwner(), WebsocketEndPoint.COPY_IMAGE,
                        new StatusMessage(stack.getId(), stack.getName(), PENDING, String.format("The copy status is: %s%%.", copyPercentage)));
                retryingStackUpdater.updateStackStatusReason(stack.getId(), String.format("The copy status is: %s%%.", copyPercentage));
                try {
                    Thread.sleep(MILLIS);
                } catch (InterruptedException e) {
                    LOGGER.info("Interrupted exception occured during sleep.", e);
                    Thread.currentThread().interrupt();
                }
            }
            if (!SUCCESS.equals(copyStatus)) {
                throw new InternalServerException("Copy OS image failed with status: " + copyStatus);
            }
            params = new HashMap<>();
            params.put(AzureStackUtil.NAME, azureStackUtil.getOsImageName(credential));
            params.put(OS, "Linux");
            params.put(MEDIALINK, targetImageUri);
View Full Code Here

                HttpResponseDecorator response = (HttpResponseDecorator) azureClient.createStorageAccount(params);
                String requestId = (String) azureClient.getRequestId(response);
                waitUntilComplete(azureClient, requestId);
            } else {
                LOGGER.error(String.format("Error occurs on %s stack under the storage creation", stack.getId()), ex);
                throw new InternalServerException(ex.getMessage());
            }
        }
    }
View Full Code Here

    }

    private void waitUntilComplete(AzureClient azureClient, String requestId) {
        boolean finished = azureClient.waitUntilComplete(requestId);
        if (!finished) {
            throw new InternalServerException("Azure resource timeout");
        }
    }
View Full Code Here

                params.put(DESCRIPTION, VM_COMMON_NAME);
                params.put(LOCATION, ((AzureTemplate) stack.getTemplate()).getLocation().location());
                azureClient.createAffinityGroup(params);
            } else {
                LOGGER.error(String.format("Error occurs on %s stack under the affinity group creation", stack.getId()), ex);
                throw new InternalServerException(ex.getMessage());
            }
        }
    }
View Full Code Here

                    new GccRemoveReadyPollerObject(zoneOperations, globalOperations, stack, resource.getResourceName());
            gccRemoveReadyPollerObjectPollingService.pollWithTimeout(gccRemoveCheckerStatus, gccRemoveReady, POLLING_INTERVAL, MAX_POLLING_ATTEMPTS);
        } catch (GoogleJsonResponseException ex) {
            exceptionHandler(ex, resource.getResourceName(), stack);
        } catch (IOException e) {
            throw new InternalServerException(e.getMessage());
        }
        return true;
    }
View Full Code Here

                        }
                    }
                }
                return dSD;
            } catch (Exception ex) {
                throw new InternalServerException(String.format("Stack describe problem on {} stack", stack.getId()), ex);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.controller.InternalServerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.