Package com.cloud.network.rules

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


    public Long getSyncObjId() {
        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

    public Long getSyncObjId() {
        StickinessPolicy policy = _entityMgr.findById(StickinessPolicy.class, getId());
        if (policy == null) {
            throw new InvalidParameterValueException("Unable to find LB stickiness rule: " + id);
        }
        LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
        if (lb == null) {
            throw new InvalidParameterValueException("Unable to find load balancer rule for stickiness rule: " + id);
        }
        return lb.getNetworkId();
    }
View Full Code Here

        return s_name;
    }

    @Override
    public long getEntityOwnerId() {
        LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getId());
        if (lb != null) {
            return lb.getAccountId();
        }

        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
    }
View Full Code Here

        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

        return s_name;
    }

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

            CallContext.current().setEventDetails("Load balancer healthcheck policy Id : " + getEntityId());
            success = _lbService.applyLBHealthCheckPolicy(this);
            if (success) {
                // State might be different after the rule is applied, so get new object here
                policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId());
                LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
                LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
                setResponseObject(hcResponse);
                hcResponse.setResponseName(getCommandName());
            }
        } finally {
View Full Code Here

            throw new NetworkRuleConflictException("ELB: Found existing load balancers matching requested new LB");
        }

        IPAddressVO ipAddr = _ipAddressDao.findById(ipId);

        LoadBalancer result = null;
        try {
            lb.setSourceIpAddressId(ipId);

            result = _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(), lb.getSourcePortStart(), lb.getDefaultPortStart(), ipId.longValue(),
                    lb.getProtocol(), lb.getAlgorithm(), false, CallContext.current(), lb.getLbProtocol(), true);
        } catch (NetworkRuleConflictException e) {
            s_logger.warn("Failed to create LB rule, not continuing with ELB deployment");
            if (newIp) {
                releaseIp(ipId, CallContext.current().getCallingUserId(), account);
            }
            throw e;
        }

        DomainRouterVO elbVm = null;

        if (existingLbs == null) {
            elbVm = findElbVmWithCapacity(ipAddr);
            if (elbVm == null) {
                elbVm = deployLoadBalancerVM(networkId, ipAddr);
                if (elbVm == null) {
                    Network network = _networkModel.getNetwork(networkId);
                    s_logger.warn("Failed to deploy a new ELB vm for ip " + ipAddr + " in network " + network + "lb name=" + lb.getName());
                    if (newIp)
                        releaseIp(ipId, CallContext.current().getCallingUserId(), account);
                }
            }

        } else {
            ElasticLbVmMapVO elbVmMap = _elbVmMapDao.findOneByIp(ipId);
            if (elbVmMap != null) {
                elbVm = _routerDao.findById(elbVmMap.getElbVmId());
            }
        }

        if (elbVm == null) {
            s_logger.warn("No ELB VM can be found or deployed");
            s_logger.warn("Deleting LB since we failed to deploy ELB VM");
            _lbDao.remove(result.getId());
            return null;
        }

        ElasticLbVmMapVO mapping = new ElasticLbVmMapVO(ipId, elbVm.getId(), result.getId());
        _elbVmMapDao.persist(mapping);
        return result;
    }
View Full Code Here

        // FIXME: breaking the dependency on ELB manager. This breaks
        // functionality of ELB using virtual router
        // Bug CS-15411 opened to document this
        // LoadBalancer result = _elbMgr.handleCreateLoadBalancerRule(lb,
        // lbOwner, lb.getNetworkId());
        LoadBalancer result = null;
        if (result == null) {
            IpAddress systemIp = null;
            NetworkOffering off = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
            if (off.getElasticLb() && ipVO == null && network.getVpcId() == null) {
                systemIp = _ipAddrMgr.assignSystemIp(networkId, lbOwner, true, false);
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.