protected List<HypervisorType> getHypervisors(final DeployDestination dest, final DeploymentPlan plan, final List<HypervisorType> supportedHypervisors) throws InsufficientServerCapacityException { List<HypervisorType> hypervisors = new ArrayList<HypervisorType>(); final HypervisorType defaults = _resourceMgr.getDefaultHypervisor(dest.getDataCenter().getId()); if (defaults != HypervisorType.None) { hypervisors.add(defaults); } else { //if there is no default hypervisor, get it from the cluster hypervisors = _resourceMgr.getSupportedHypervisorTypes(dest.getDataCenter().getId(), true, plan.getPodId()); } //keep only elements defined in supported hypervisors final StringBuilder hTypesStr = new StringBuilder(); if (supportedHypervisors != null && !supportedHypervisors.isEmpty()) { hypervisors.retainAll(supportedHypervisors); for (final HypervisorType hType : supportedHypervisors) { hTypesStr.append(hType).append(" "); } } if (hypervisors.isEmpty()) { throw new InsufficientServerCapacityException("Unable to create internal lb vm, " + "there are no clusters in the zone ", DataCenter.class, dest.getDataCenter().getId()); } return hypervisors; }
private boolean startNewVM(long vmId) { try { CallContext.current().setEventDetails("Vm Id: " + vmId); _userVmManager.startVirtualMachine(vmId, null, null, null); } catch (final ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { StringBuilder message = new StringBuilder(ex.getMessage()); if (ex instanceof InsufficientServerCapacityException) { if (((InsufficientServerCapacityException)ex).isAffinityApplied()) { message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them"); } } s_logger.info(ex); s_logger.info(message.toString(), ex); throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString()); } return true; }
protected List<HypervisorType> getHypervisors(final RouterDeploymentDefinition routerDeploymentDefinition) throws InsufficientServerCapacityException { final DeployDestination dest = routerDeploymentDefinition.getDest(); List<HypervisorType> hypervisors = new ArrayList<HypervisorType>(); if (dest.getCluster() != null) { if (dest.getCluster().getHypervisorType() == HypervisorType.Ovm) { hypervisors.add(getClusterToStartDomainRouterForOvm(dest.getCluster().getPodId())); } else { hypervisors.add(dest.getCluster().getHypervisorType()); } } else { final HypervisorType defaults = _resourceMgr.getDefaultHypervisor(dest.getDataCenter().getId()); if (defaults != HypervisorType.None) { hypervisors.add(defaults); } else { // if there is no default hypervisor, get it from the cluster hypervisors = _resourceMgr.getSupportedHypervisorTypes(dest.getDataCenter().getId(), true, routerDeploymentDefinition.getPlan().getPodId()); } } filterSupportedHypervisors(hypervisors); if (hypervisors.isEmpty()) { if (routerDeploymentDefinition.getPodId() != null) { throw new InsufficientServerCapacityException("Unable to create virtual router, there are no clusters in the pod." + getNoHypervisorsErrMsgDetails(), Pod.class, routerDeploymentDefinition.getPodId()); } throw new InsufficientServerCapacityException("Unable to create virtual router, there are no clusters in the zone." + getNoHypervisorsErrMsgDetails(), DataCenter.class, dest.getDataCenter().getId()); } return hypervisors; }
StringBuilder message = new StringBuilder(ex.getMessage()); if (ex instanceof InsufficientServerCapacityException) { if (((InsufficientServerCapacityException) ex).isAffinityApplied()) { message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
s_logger.debug("Unable to find destination for migrating the vm " + profile); throw new InsufficientServerCapacityException("Unable to find a server to migrate to.", host.getClusterId());
StringBuilder message = new StringBuilder(ex.getMessage()); if (ex instanceof InsufficientServerCapacityException) { if (((InsufficientServerCapacityException)ex).isAffinityApplied()) { message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
throw new InsufficientServerCapacityException("Unable to find a server to scale the vm to.", host.getClusterId());
StringBuilder message = new StringBuilder(ex.getMessage()); if (ex instanceof InsufficientServerCapacityException) { if(((InsufficientServerCapacityException)ex).isAffinityApplied()){ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
StringBuilder message = new StringBuilder(ex.getMessage()); if (ex instanceof InsufficientServerCapacityException) { if (((InsufficientServerCapacityException)ex).isAffinityApplied()) { message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
continue; throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));