@Override public void handleDeleteLoadBalancerRule(LoadBalancer lb, long userId, Account caller) { if (!_enabled) { return; } loadBalanceRuleHandler.handleDeleteLoadBalancerRule(lb, userId, caller); }
@Override public boolean deleteApplicationLoadBalancer(long id) { return _lbService.deleteLoadBalancerRule(id, true); }
@Override public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account account, long networkId) throws InsufficientAddressCapacityException, NetworkRuleConflictException { return loadBalanceRuleHandler.handleCreateLoadBalancerRule(lb, account, networkId); }
@Override public boolean validateLBRule(Network network, LoadBalancingRule rule) { if (canHandle(network, Service.Lb)) { String algo = rule.getAlgorithm(); return (algo.equals("roundrobin") || algo.equals("leastconn") || algo.equals("source")); } return true; }
@Override public Long getSyncObjId() { LoadBalancer lb = _lbService.findById(id); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule: " + id); } return lb.getNetworkId(); } }
protected boolean applyLBRules(DomainRouterVO elbVm, List<LoadBalancingRule> rules, long guestNetworkId) throws ResourceUnavailableException { Commands cmds = new Commands(Command.OnError.Continue); createApplyLoadBalancingRulesCommands(rules, elbVm, cmds, guestNetworkId); // Send commands to elbVm return sendCommandsToRouter(elbVm, cmds); }
@Override public List<LbStickinessMethod> getStickinessMethods(long networkid) { String capability = getLBCapability(networkid, Capability.SupportedStickinessMethods.getName()); if (capability == null) { return null; } Gson gson = new Gson(); java.lang.reflect.Type listType = new TypeToken<List<LbStickinessMethod>>() { }.getType(); List<LbStickinessMethod> result = gson.fromJson(capability, listType); return result; }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { boolean result = _lbService.removeCertFromLoadBalancer(getLbRuleId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove certificate from load balancer rule"); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { //To change body of implemented methods use File | Settings | File Templates. if (_lbService.assignCertToLoadBalancer(getLbRuleId(), getCertId())) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign certificate to load balancer"); } }
@Override protected void runInContext() { garbageCollectUnusedElbVms(); }
@Override protected void runInContext() { try { updateLBHealthCheck(Scheme.Public); updateLBHealthCheck(Scheme.Internal); } catch (Exception e) { s_logger.error("Exception in LB HealthCheck Update Checker", e); } } }
@Override public void updateLBHealthCheck(Scheme scheme) { try { _lbService.updateLBHealthChecks(scheme); } catch (ResourceUnavailableException e) { s_logger.debug("Error while updating the LB HealtCheck ", e); } s_logger.debug("LB HealthCheck Manager is running and getting the updates from LB providers and updating service status"); }
@Override public boolean start() { s_logger.debug("LB HealthCheckmanager is getting Started"); _executor.scheduleAtFixedRate(new UpdateLBHealthCheck(), 10, _interval, TimeUnit.SECONDS); return true; }
@Override @ActionEvent(eventType = EventTypes.EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, eventDescription = "removing from load balancer", async = true) public boolean removeFromLoadBalancer(long loadBalancerId, List<Long> instanceIds, Map<Long, List<String>> vmIdIpsMap) { return removeFromLoadBalancerInternal(loadBalancerId, instanceIds, true, vmIdIpsMap); }
@Override public boolean applyLBRules(Network network, List<LoadBalancingRule> rules) throws ResourceUnavailableException { if (!canHandle(network, rules)) { return false; } return _lbMgr.applyLoadBalancerRules(network, rules); }
@Override public boolean applyLoadBalancersForNetwork(long networkId, Scheme scheme) throws ResourceUnavailableException { List<LoadBalancerVO> lbs = _lbDao.listByNetworkIdAndScheme(networkId, scheme); if (lbs != null) { s_logger.debug("Applying load balancer rules of scheme " + scheme + " in network id=" + networkId); return applyLoadBalancerRules(lbs, true); } else { s_logger.info("Network id=" + networkId + " doesn't have load balancer rules of scheme " + scheme + ", nothing to apply"); return true; } }
private void throwExceptionIfSuppliedlLbNameIsNotAssociatedWithIpAddress(final CreateLoadBalancerRuleCmd lb) { final List<LoadBalancerVO> existingLbs = findExistingLoadBalancers(lb.getName(), null, lb.getAccountId(), lb.getDomainId(), null); if (existingLbs != null) { throw new InvalidParameterValueException("Supplied LB name " + lb.getName() + " is not associated with IP " + lb.getSourceIpAddressId()); } }
@Override public Long getSyncObjId() { LoadBalancer lb = _lbService.findById(id); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule: " + id); } return lb.getNetworkId(); } }
@Override public Long getSyncObjId() { LoadBalancer lb = _lbService.findById(id); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule: " + id); } return lb.getNetworkId(); }
@Override public Long getSyncObjId() { LoadBalancer lb = _lbService.findById(getId()); if (lb == null) { throw new InvalidParameterValueException("Unable to find load balancer rule by ID " + getId()); } return lb.getNetworkId(); }