Package com.cloud.network.rules

Examples of com.cloud.network.rules.LoadBalancer


        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(), getLbProtocol(), getDisplay());
            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


    /////////////// API Implementation///////////////////
    /////////////////////////////////////////////////////
    @Override
    public void execute() {
        StickinessPolicy policy = _lbService.updateLBStickinessPolicy(this.getId(), this.getCustomId(), this.getDisplay());
        LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
        LBStickinessResponse spResponse = _responseGenerator.createLBStickinessPolicyResponse(policy, lb);
        setResponseObject(spResponse);
        spResponse.setResponseName(getCommandName());
    }
View Full Code Here

            } else {
                throw new InvalidParameterValueException("Either LB Ruleid or HealthCheckpolicy Id should be specified");
            }
        }

        LoadBalancer lb = _lbService.findById(lbRuleId);
        if (lb != null) {
            List<? extends HealthCheckPolicy> healthCheckPolicies = _lbService.searchForLBHealthCheckPolicies(this);
            LBHealthCheckResponse spResponse = _responseGenerator.createLBHealthCheckPolicyResponse(healthCheckPolicies, lb);
            hcpResponses.add(spResponse);
            response.setResponses(hcpResponses);
View Full Code Here

    }

    @Override
    public void execute() {

        LoadBalancer lb = null;
        if (lbRuleId == null && id == null) {
            throw new InvalidParameterValueException("LB rule id and stickiness policy id can't be null");
        }

        if (id != null) {
            lb = _lbService.findLbByStickinessId(id);
            if (lb == null) {
                throw new InvalidParameterValueException("stickiness policy id doesn't exist");
            }

            if ((lbRuleId != null) && (lbRuleId != lb.getId())) {
                throw new InvalidParameterValueException("stickiness policy id doesn't belong to lbId" + lbRuleId);
            }
        }

        if (lbRuleId != null && lb == null) {
View Full Code Here

    /////////////// API Implementation///////////////////
    /////////////////////////////////////////////////////
    @Override
    public void execute() {
        HealthCheckPolicy policy = _lbService.updateLBHealthCheckPolicy(this.getId(), this.getCustomId(), this.getDisplay());
        LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
        LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
        setResponseObject(hcResponse);
        hcResponse.setResponseName(getCommandName());
    }
View Full Code Here

            CallContext.current().setEventDetails("Rule Id: " + getEntityId());
            success = _lbService.applyLBStickinessPolicy(this);
            if (success) {
                // State might be different after the rule is applied, so get new object here
                policy = _entityMgr.findById(StickinessPolicy.class, getEntityId());
                LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
                LBStickinessResponse spResponse = _responseGenerator.createLBStickinessPolicyResponse(policy, lb);
                setResponseObject(spResponse);
                spResponse.setResponseName(getCommandName());
            }
        } finally {
View Full Code Here

        return BaseAsyncCmd.networkSyncObject;
    }

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

        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

        return "Removing a certificate from a loadbalancer with ID " + getLbRuleId();
    }

    @Override
    public long getEntityOwnerId() {
        LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLbRuleId());
        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

        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

TOP

Related Classes of com.cloud.network.rules.LoadBalancer

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.