Projects >> CloudStack-archive >>924961d8986f7d39a45ba894d4045481c9fb2ea4

Chunk
Conflicting content
    @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
    private List cidrlist;
<<<<<<< HEAD
    
    @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default")
    private Boolean openFirewall;
=======
    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the load balancer. Must be used with the domainId parameter.")
    private String accountName;
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608

    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the load balancer")
    private Long domainId;
Solution content
    @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
    private List cidrlist;
    
    @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default")
    private Boolean openFirewall;

    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the load balancer. Must be used with the domainId parameter.")
    private String accountName;

    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the load balancer")
    private Long domainId;
File
CreateLoadBalancerRuleCmd.java
Developer's decision
Concatenation
Kind of conflict
Annotation
Attribute
Chunk
Conflicting content
        return publicIpId;
    }

<<<<<<< HEAD
    @Override
    public Integer getSourcePortStart() {
        return publicPort.intValue();
    }

    @Override
    public Integer getSourcePortEnd() {
=======
    public int getSourcePortStart() {
        return publicPort.intValue();
    }

    public int getSourcePortEnd() {
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
        return publicPort.intValue();
    }
Solution content
        return publicIpId;
    }

    public Integer getSourcePortStart() {
        return publicPort.intValue();
    }

    public Integer getSourcePortEnd() {
        return publicPort.intValue();
    }
File
CreateLoadBalancerRuleCmd.java
Developer's decision
Combination
Kind of conflict
Annotation
Method declaration
Method signature
Chunk
Conflicting content
        return null;
    }
    
       return getAccountId();
    }
    
<<<<<<< HEAD
    @Override
    public Integer getIcmpCode() {
    @Override
    public Integer getIcmpType() {
        return null;
    }

}
=======
    public String getAccountName() {
        return accountName;
    }
    
    public Long getZoneId() {
        return zoneId;
    }

    public void setPublicIpId(Long publicIpId) {
        this.publicIpId = publicIpId;
    }

    @Override
    public String getEventType() {
        return EventTypes.EVENT_LOAD_BALANCER_CREATE;
    }

    @Override
    public String getEventDescription() {
        return "creating load balancer: " + getName() + " account: " + getAccountName();

    }

    public String getXid() {
        /*FIXME*/
        return null;
    }

    public void setSourceIpAddressId(Long ipId) {
        this.publicIpId = ipId;
    }

}
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
Solution content
       return getAccountId();
    }
    
    @Override
    public Integer getIcmpCode() {
        return null;
    }
    
    @Override
    public Integer getIcmpType() {
        return null;
    }

}
    }
    
    public String getAccountName() {
        return accountName;
    }
    
    public Long getZoneId() {
        return zoneId;
    }

    public void setPublicIpId(Long publicIpId) {
        this.publicIpId = publicIpId;
    }

    @Override
    public String getEventType() {
        return EventTypes.EVENT_LOAD_BALANCER_CREATE;
    }

    @Override
    public String getEventDescription() {
        return "creating load balancer: " + getName() + " account: " + getAccountName();

    }

    public String getXid() {
        /*FIXME*/
        return null;
    }

    public void setSourceIpAddressId(Long ipId) {
        this.publicIpId = ipId;
    }

}
File
CreateLoadBalancerRuleCmd.java
Developer's decision
Manual
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
     * @return the newly created LoadBalancerVO if successful, null otherwise
     * @throws InsufficientAddressCapacityException 
     */
<<<<<<< HEAD
    LoadBalancer createLoadBalancerRule(LoadBalancer lb, boolean openFirewall) throws NetworkRuleConflictException;
=======
    LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
    
    LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
    
Solution content
     * @return the newly created LoadBalancerVO if successful, null otherwise
     * @throws InsufficientAddressCapacityException 
     */
    LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException;
    
    LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);
    
File
LoadBalancingRulesService.java
Developer's decision
Manual
Kind of conflict
Method interface
Chunk
Conflicting content
import com.cloud.network.dao.NetworkRuleConfigDaoImpl;
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
import com.cloud.network.dao.VpnUserDaoImpl;
<<<<<<< HEAD
import com.cloud.network.firewall.FirewallManagerImpl;
=======
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl;
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
import com.cloud.network.lb.LoadBalancingRulesManagerImpl;
import com.cloud.network.lb.dao.ElasticLbVmMapDaoImpl;
import com.cloud.network.ovs.OvsNetworkManagerImpl;
Solution content
import com.cloud.network.dao.NetworkRuleConfigDaoImpl;
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
import com.cloud.network.dao.VpnUserDaoImpl;
import com.cloud.network.firewall.FirewallManagerImpl;
import com.cloud.network.lb.ElasticLoadBalancerManagerImpl;
import com.cloud.network.lb.LoadBalancingRulesManagerImpl;
import com.cloud.network.lb.dao.ElasticLbVmMapDaoImpl;
import com.cloud.network.ovs.OvsNetworkManagerImpl;
File
DefaultComponentLibrary.java
Developer's decision
Concatenation
Kind of conflict
Import
Chunk
Conflicting content
    @Inject
    FirewallRulesCidrsDao _firewallCidrsDao;
    @Inject
<<<<<<< HEAD
    FirewallManager _firewallMgr;

=======
    ElasticLoadBalancerManager _elbMgr;
    @Inject
    NetworkDao _networkDao;
    
    
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
    @Override
    @DB
    @ActionEvent(eventType = EventTypes.EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, eventDescription = "assigning to load balancer", async = true)
Solution content
    @Inject
    FirewallRulesCidrsDao _firewallCidrsDao;
    @Inject
    FirewallManager _firewallMgr;
    @Inject
    ElasticLoadBalancerManager _elbMgr;
    @Inject
    NetworkDao _networkDao;
    
    
    @Override
    @DB
    @ActionEvent(eventType = EventTypes.EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, eventDescription = "assigning to load balancer", async = true)
File
LoadBalancingRulesManagerImpl.java
Developer's decision
Concatenation
Kind of conflict
Annotation
Attribute
Chunk
Conflicting content
    @Override @DB
    @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
<<<<<<< HEAD
    public LoadBalancer createLoadBalancerRule(LoadBalancer lb, boolean openFirewall) throws NetworkRuleConflictException {
=======
    public LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb) throws NetworkRuleConflictException, InsufficientAddressCapacityException {
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
        UserContext caller = UserContext.current();
        int srcPortStart = lb.getSourcePortStart();
        int srcPortEnd = lb.getSourcePortEnd();
Solution content
    @Override @DB
    @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
    public LoadBalancer createLoadBalancerRule(CreateLoadBalancerRuleCmd lb, , boolean openFirewall) throws NetworkRuleConflictException, InsufficientAddressCapacityException {
        UserContext caller = UserContext.current();
        int srcPortStart = lb.getSourcePortStart();
        int srcPortEnd = lb.getSourcePortEnd();
File
LoadBalancingRulesManagerImpl.java
Developer's decision
Manual
Kind of conflict
Method signature
Chunk
Conflicting content
        if ((lb.getAlgorithm() == null) || !NetUtils.isValidAlgorithm(lb.getAlgorithm())) {
            throw new InvalidParameterValueException("Invalid algorithm: " + lb.getAlgorithm());
        }
<<<<<<< HEAD

        // verify that lb service is supported by the network
        Network network = _networkMgr.getNetwork(ipAddr.getAssociatedWithNetworkId());
        if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Lb)) {
            throw new InvalidParameterValueException("LB service is not supported in network id=" + network.getId());
=======
        
        LoadBalancer result = _elbMgr.handleCreateLoadBalancerRule(lb, caller.getCaller());
        if (result == null){
            result =  createLoadBalancer(lb);
        } 
        return result;
    }
    
    @DB
    public LoadBalancer createLoadBalancer(CreateLoadBalancerRuleCmd lb) throws NetworkRuleConflictException {
        long ipId = lb.getSourceIpAddressId();
        UserContext caller = UserContext.current();
        int srcPortStart = lb.getSourcePortStart();
        int defPortStart = lb.getDefaultPortStart();
        
        IPAddressVO ipAddr = _ipAddressDao.findById(lb.getSourceIpAddressId());
        Long networkId = ipAddr.getSourceNetworkId();
        NetworkVO network = _networkDao.findById(networkId);
        // make sure ip address exists
        if (ipAddr == null || !ipAddr.readyToUse()) {
            throw new InvalidParameterValueException("Unable to create load balancer rule, invalid IP address id" + ipId);
        }
        
         networkId = ipAddr.getAssociatedWithNetworkId();
        if (networkId == null) {
            throw new InvalidParameterValueException("Unable to create load balancer rule ; ip id=" + ipId + " is not associated with any network");

        }

        _accountMgr.checkAccess(caller.getCaller(), ipAddr);

        // verify that lb service is supported by the network
        if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Lb)) {
            throw new InvalidParameterValueException("LB service is not supported in network id= " + networkId);
>>>>>>> 09952f0f87977e077d0fbe5491c55b557c59b608
        }

        Transaction txn = Transaction.currentTxn();
Solution content
        if ((lb.getAlgorithm() == null) || !NetUtils.isValidAlgorithm(lb.getAlgorithm())) {
            throw new InvalidParameterValueException("Invalid algorithm: " + lb.getAlgorithm());
        }
        
        LoadBalancer result = _elbMgr.handleCreateLoadBalancerRule(lb, caller.getCaller());
        if (result == null){
            result =  createLoadBalancer(lb);
        } 
        return result;
    }
    
    @DB
    public LoadBalancer createLoadBalancer(CreateLoadBalancerRuleCmd lb) throws NetworkRuleConflictException {
        long ipId = lb.getSourceIpAddressId();
        UserContext caller = UserContext.current();
        int srcPortStart = lb.getSourcePortStart();
        int defPortStart = lb.getDefaultPortStart();
        
        IPAddressVO ipAddr = _ipAddressDao.findById(lb.getSourceIpAddressId());
        Long networkId = ipAddr.getSourceNetworkId();
        NetworkVO network = _networkDao.findById(networkId);
        // make sure ip address exists
        if (ipAddr == null || !ipAddr.readyToUse()) {
            throw new InvalidParameterValueException("Unable to create load balancer rule, invalid IP address id" + ipId);
        }
        
         networkId = ipAddr.getAssociatedWithNetworkId();
        if (networkId == null) {
            throw new InvalidParameterValueException("Unable to create load balancer rule ; ip id=" + ipId + " is not associated with any network");

        }

        _accountMgr.checkAccess(caller.getCaller(), ipAddr);

        // verify that lb service is supported by the network
        if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Lb)) {
            throw new InvalidParameterValueException("LB service is not supported in network id= " + networkId);
        }

        Transaction txn = Transaction.currentTxn();
File
LoadBalancingRulesManagerImpl.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
If statement
Method invocation
Method signature
Return statement
Throw statement
Variable