cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/internallb to af62012
Date Fri, 12 Apr 2013 00:04:38 GMT
Updated Branches:
  refs/heads/internallb 1db240c2b -> af6201257


Internal LB: fixed some bugs in internal lb vm startup process


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/af620125
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/af620125
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/af620125

Branch: refs/heads/internallb
Commit: af6201257b28a0d9177330c8c76b0ec979725870
Parents: 1db240c
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Apr 11 16:55:37 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Apr 11 16:55:37 2013 -0700

----------------------------------------------------------------------
 .../CreateApplicationLoadBalancerCmd.java          |   42 +++------------
 .../lb/InternalLoadBalancerManagerImpl.java        |   14 ++++--
 .../lb/ApplicationLoadBalancerManagerImpl.java     |    2 +-
 3 files changed, 19 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af620125/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
index 84ee4f2..17ae959 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java
@@ -23,7 +23,6 @@ import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
-import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.cloudstack.api.response.NetworkResponse;
 import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
 import org.apache.log4j.Logger;
@@ -37,9 +36,7 @@ import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.Network;
-import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.rules.LoadBalancerContainer.Scheme;
-import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 import com.cloud.utils.net.NetUtils;
 
@@ -77,14 +74,6 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd
{
     @Parameter(name=ApiConstants.SOURCE_IP_NETWORK_ID, type=CommandType.UUID, entityType
= NetworkResponse.class, required=true,
             description="the network id of the source ip address")
     private Long sourceIpNetworkId;
-
-    @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.UUID, entityType = DomainResponse.class,
-            description="the domain ID associated with the load balancer")
-    private Long domainId;
     
     @Parameter(name=ApiConstants.SCHEME, type=CommandType.STRING, required=true, description="the
load balancer scheme. Supported value in this release is Internal")
     private String scheme;
@@ -128,35 +117,20 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd
{
     }
 
     public long getAccountId() {
-        Account account = null;
-        //get account info from the network object if it's a guest network
+        //get account info from the network object
         Network ntwk = _networkService.getNetwork(networkId);
-        if (ntwk.getTrafficType() == TrafficType.Guest){
-            return ntwk.getAccountId();
-        } else if (sourceIp != null) {
-            //get account info from the ip address object if the traffic type is public
-
-        } if ((domainId != null) && (accountName != null)) {
-            account = _responseGenerator.findAccountByNameDomain(accountName, domainId);
-            if (account != null) {
-                return account.getId();
-            } else {
-                throw new InvalidParameterValueException("Unable to find account " + account
+ " in domain id=" + domainId);
-            }
-        } else {
-            throw new InvalidParameterValueException("Can't define the Load Balancer owner.
Either specify guest" +
-                    " network in networkId, or Public Ip address in sourceIpAddress, or account/domainId
parameters");
-        }   
+        if (ntwk == null) {
+            throw new InvalidParameterValueException("Invalid network id specified");
+        }
+       
+        return ntwk.getAccountId();
+        
     }
 
     public int getInstancePort() {
         return instancePort.intValue();
     }
 
-    public String getAccountName() {
-        return accountName;
-    }
-
     @Override
     public String getEventType() {
         return EventTypes.EVENT_LOAD_BALANCER_CREATE;
@@ -164,7 +138,7 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd
{
 
     @Override
     public String getEventDescription() {
-        return "creating load balancer: " + getName() + " account: " + getAccountName();
+        return "creating load balancer: " + getName() + " account: " + getAccountId();
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af620125/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerManagerImpl.java
b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerManagerImpl.java
index 0d0e5fc..d45784e 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerManagerImpl.java
@@ -483,7 +483,8 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO>
{
                 _ntwkModel.isSecurityGroupSupportedInNetwork(guestNetwork), 
                 _ntwkModel.getNetworkTag(internalLbVm.getHypervisorType(), guestNetwork));
 
-        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, null, 
+        //FIXME - for ha proxy 
+        LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, guestNic.getIp4Address(),

                 guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(), 
                 _itMgr.toNicTO(guestNicProfile, internalLbVm.getHypervisorType()), internalLbVm.getVpcId());
 
@@ -635,8 +636,13 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO>
{
             Pair<DeploymentPlan, List<DomainRouterVO>> planAndInternalLbVms =
getDeploymentPlanAndInternalLbVms(dest, guestNetwork.getId(), requestedGuestIp);
             internalLbs = planAndInternalLbVms.second();
             DeploymentPlan plan = planAndInternalLbVms.first();
+            
+            if (internalLbs.size() > 0) {
+                s_logger.debug("Found " + internalLbs.size() + " internal lb vms for the
requested IP " + requestedGuestIp.addr());
+                return internalLbs;
+            }
 
-            List<Pair<NetworkVO, NicProfile>> networks = createInternalLbVmNetworks(guestNetwork,
plan, null);
+            List<Pair<NetworkVO, NicProfile>> networks = createInternalLbVmNetworks(guestNetwork,
plan, requestedGuestIp);
             //don't start the internal lb as we are holding the network lock that needs to
be released at the end of router allocation
             DomainRouterVO internalLbVm = deployInternalLbVm(owner, dest, plan, params, internalLbProvider,
offeringId, guestNetwork.getVpcId(),
                 networks, false);
@@ -717,13 +723,13 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO>
{
         
         long id = _routerDao.getNextInSequence(Long.class, "id");
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Creating the internal lb " + id + " in datacenter "  + dest.getDataCenter());
+            s_logger.debug("Creating the internal lb vm " + id + " in datacenter "  + dest.getDataCenter());
         }
 
         ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
 
         // Internal lb is the network element, we don't know the hypervisor type yet.
-        // Try to allocate the domR twice using diff hypervisors, and when failed both times,
throw the exception up
+        // Try to allocate the internal lb twice using diff hypervisors, and when failed
both times, throw the exception up
         List<HypervisorType> hypervisors = getHypervisors(dest, plan, null);
 
         int allocateRetry = 0;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af620125/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index cb617b5..8e99bb3 100644
--- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -304,7 +304,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements
A
             return;
         } else {
             List<String> usedIps = _networkModel.getUsedIpsInNetwork(sourceIpNtwk);
-            if (usedIps.size() > 0) {
+            if (usedIps.contains(requestedSourceIp.toString())) {
                 throw new InvalidParameterValueException("Ip address " + requestedSourceIp.addr()
+ " is already in use");
             }
         }


Mime
View raw message