Examples of LoadBalancer


Examples of com.cloud.network.rules.LoadBalancer

        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getId());
        if (lb == null) {
            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
        }
        return lb.getAccountId();
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

    }

    @Override
    public void execute(){
        UserContext.current().setEventDetails("Load balancer Id: "+getId());
        LoadBalancer result = _lbService.updateLoadBalancerRule(this);
        if (result != null){
            LoadBalancerResponse response = _responseGenerator.createLoadBalancerResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        return BaseAsyncCmd.networkSyncObject;
    }

    @Override
    public Long getSyncObjId() {
        LoadBalancer lb = _lbService.findById(getId());
        if (lb == null) {
            throw new InvalidParameterValueException("Unable to find load balancer rule " + getId());
        }
        return lb.getNetworkId();
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        Collection lbruleWeightsCollection = gslbLbRuleWieghtMap.values();
        Iterator iter = lbruleWeightsCollection.iterator();
        while (iter.hasNext()) {
            HashMap<String, String> map = (HashMap<String, String>) iter.next();
            Long weight;
            LoadBalancer lbrule = _entityMgr.findByUuid(LoadBalancer.class, map.get("loadbalancerid"));
            if (lbrule == null) {
                throw new InvalidParameterValueException("Unable to find load balancer rule with ID: " + map.get("loadbalancerid"));
            }
            try {
                weight = Long.parseLong(map.get("weight"));
                if (weight < 1 || weight > 100) {
                    throw new InvalidParameterValueException("Invalid weight " + weight + " given for the LB rule id: " + map.get("loadbalancerid"));
                }
            } catch (NumberFormatException nfe) {
                throw new InvalidParameterValueException("Unable to translate weight given for the LB rule id: " + map.get("loadbalancerid"));
            }
            lbRuleWeightMap.put(lbrule.getId(), weight);
        }

        return lbRuleWeightMap;
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

            IpAddress ipAddr = _networkService.getIp(publicIpId);
            if (ipAddr == null || !ipAddr.readyToUse()) {
                throw new InvalidParameterValueException("Unable to create load balancer rule, invalid IP address id " + ipAddr.getId());
            }
        } else if (getEntityId() != null) {
            LoadBalancer rule = _entityMgr.findById(LoadBalancer.class, getEntityId());
            return rule.getSourceIpAddressId();
        }

        return publicIpId;
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

    @Override
    public void execute() throws ResourceAllocationException, ResourceUnavailableException {

        UserContext callerContext = UserContext.current();
        boolean success = true;
        LoadBalancer rule = null;
        try {
            UserContext.current().setEventDetails("Rule Id: " + getEntityId());

            if (getOpenFirewall()) {
                success = success && _firewallService.applyIngressFirewallRules(getSourceIpAddressId(), callerContext.getCaller());
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        //cidr list parameter is deprecated
        if (cidrlist != null) {
            throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
        }
        try {
            LoadBalancer result = _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(),
                    getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(),
                    getNetworkId(), getEntityOwnerId(), getOpenFirewall());
            this.setEntityId(result.getId());
            this.setEntityUuid(result.getUuid());
        } catch (NetworkRuleConflictException e) {
            s_logger.warn("Exception: ", e);
            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
        } catch (InsufficientAddressCapacityException e) {
            s_logger.warn("Exception: ", e);
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getId());
        if (lb == null) {
            return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
        }
        return lb.getAccountId();
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        return BaseAsyncCmd.networkSyncObject;
    }

    @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();
    }
View Full Code Here

Examples of com.cloud.network.rules.LoadBalancer

        HealthCheckPolicy policy = _entityMgr.findById(HealthCheckPolicy.class,
                getId());
        if (policy == null) {
            throw new InvalidParameterValueException("Unable to find load balancer healthcheck rule: " + id);
        }
        LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
        if (lb == null) {
            throw new InvalidParameterValueException("Unable to find load balancer rule for healthcheck rule: " + id);
        }
        return lb.getNetworkId();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.