cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/master to f65f3b9
Date Wed, 24 Apr 2013 15:56:50 GMT
Updated Branches:
  refs/heads/master ff7112a07 -> f65f3b9d5


CLOUDSTACK-1958: List GSLB response should have the GSLB site (zone load
balancer rule) details as well


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

Branch: refs/heads/master
Commit: f65f3b9d50f7ece9ef1c72af0f3518d8813f2951
Parents: ff7112a
Author: Murali Reddy <murali.reddy@citrix.com>
Authored: Wed Apr 24 21:02:42 2013 +0530
Committer: Murali Reddy <murali.reddy@citrix.com>
Committed: Wed Apr 24 21:03:26 2013 +0530

----------------------------------------------------------------------
 .../region/ha/GlobalLoadBalancingRulesService.java |    3 +++
 .../org/apache/cloudstack/api/ApiConstants.java    |    1 +
 .../api/response/GlobalLoadBalancerResponse.java   |   10 ++++++++++
 server/src/com/cloud/api/ApiDBUtils.java           |    9 +++++++++
 server/src/com/cloud/api/ApiResponseHelper.java    |    8 ++++++++
 .../gslb/GlobalLoadBalancingRulesServiceImpl.java  |   14 ++++++++++++++
 6 files changed, 45 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java b/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
index e2f097e..186faf7 100644
--- a/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
+++ b/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
@@ -17,6 +17,7 @@
 
 package com.cloud.region.ha;
 
+import com.cloud.network.rules.LoadBalancer;
 import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
 
 import java.util.List;
@@ -44,4 +45,6 @@ public interface GlobalLoadBalancingRulesService {
 
     List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd
listGslbCmd);
 
+    List<LoadBalancer> listSiteLoadBalancers(long gslbRuleId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index e774ecc..1165c7b 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -335,6 +335,7 @@ public class ApiConstants {
     public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
     public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
     public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
+    public static final String LOAD_BALANCER_RULE = "loadbalancerrule";
     public static final String LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist";
     public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
     public static final String FIREWALL_DEVICE_NAME = "fwdevicename";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
index 38e080b..9f5139d 100644
--- a/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java
@@ -23,6 +23,8 @@ import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
 
+import java.util.List;
+
 @EntityReference(value= GlobalLoadBalancerRule.class)
 public class GlobalLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse
{
 
@@ -76,6 +78,10 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements
Controll
     @Param(description = "the domain of the load balancer rule")
     private String domainName;
 
+    @SerializedName(ApiConstants.LOAD_BALANCER_RULE)
+    @Param(description="List of load balancer rules that are part of GSLB rule", responseObject
= LoadBalancerResponse.class)
+    private List<LoadBalancerResponse> siteLoadBalancers;
+
     public void setRegionIdId(Integer regionId) {
         this.regionId = regionId;
     }
@@ -130,4 +136,8 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements
Controll
     public void setDomainName(String domainName) {
         this.domainName = domainName;
     }
+
+    public void setSiteLoadBalancers(List<LoadBalancerResponse> siteLoadBalancers)
{
+        this.siteLoadBalancers = siteLoadBalancers;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index c60af27..21ce63b 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -25,6 +25,8 @@ import java.util.Set;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
 import org.apache.cloudstack.affinity.AffinityGroup;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
@@ -388,6 +390,7 @@ public class ApiDBUtils {
     static VpcProvisioningService _vpcProvSvc;
     static AffinityGroupDao _affinityGroupDao;
     static AffinityGroupJoinDao _affinityGroupJoinDao;
+    static GlobalLoadBalancingRulesService _gslbService;
 
     @Inject private ManagementServer ms;
     @Inject public AsyncJobManager asyncMgr;
@@ -494,6 +497,7 @@ public class ApiDBUtils {
     @Inject private VpcProvisioningService vpcProvSvc;
     @Inject private AffinityGroupDao affinityGroupDao;
     @Inject private AffinityGroupJoinDao affinityGroupJoinDao;
+    @Inject private GlobalLoadBalancingRulesService gslbService;
 
     @PostConstruct
     void init() {
@@ -599,6 +603,7 @@ public class ApiDBUtils {
         _vpcProvSvc = vpcProvSvc;
         _affinityGroupDao = affinityGroupDao;
         _affinityGroupJoinDao = affinityGroupJoinDao;
+        _gslbService = gslbService;
         // Note: stats collector should already have been initialized by this time, otherwise
a null instance is returned
         _statsCollector = StatsCollector.getInstance();
     }
@@ -1630,4 +1635,8 @@ public class ApiDBUtils {
     public static AffinityGroupResponse fillAffinityGroupDetails(AffinityGroupResponse resp,
AffinityGroupJoinVO group) {
         return _affinityGroupJoinDao.setAffinityGroupResponse(resp, group);
     }
+
+    public static List<? extends LoadBalancer> listSiteLoadBalancers(long gslbRuleId)
{
+        return _gslbService.listSiteLoadBalancers(gslbRuleId);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index cd0158d..894ec8d 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -798,6 +798,14 @@ public class ApiResponseHelper implements ResponseGenerator {
         response.setId(globalLoadBalancerRule.getUuid());
         populateOwner(response, globalLoadBalancerRule);
         response.setObjectName("globalloadbalancer");
+
+        List<LoadBalancerResponse> siteLbResponses = new ArrayList<LoadBalancerResponse>();
+        List<? extends LoadBalancer> siteLoadBalaners = ApiDBUtils.listSiteLoadBalancers(globalLoadBalancerRule.getId());
+        for (LoadBalancer siteLb : siteLoadBalaners) {
+            LoadBalancerResponse siteLbResponse = createLoadBalancerResponse(siteLb);
+            siteLbResponses.add(siteLbResponse);
+        }
+        response.setSiteLoadBalancers(siteLbResponses);
         return response;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f65f3b9d/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
index 1ed2618..56c46b0 100644
--- a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
+++ b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
@@ -511,6 +511,20 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
         return null;
     }
 
+    @Override
+    public List<LoadBalancer> listSiteLoadBalancers(long gslbRuleId) {
+        List<GlobalLoadBalancerLbRuleMapVO> gslbLbMapVos = _gslbLbMapDao.listByGslbRuleId(gslbRuleId);
+        List<LoadBalancer> siteLoadBalancers = new ArrayList<LoadBalancer>();
+        if (gslbLbMapVos != null) {
+            for (GlobalLoadBalancerLbRuleMapVO gslbLbMapVo : gslbLbMapVos) {
+                LoadBalancerVO loadBalancer = _lbDao.findById(gslbLbMapVo.getLoadBalancerId());
+                siteLoadBalancers.add(loadBalancer);
+            }
+            return siteLoadBalancers;
+        }
+        return null;
+    }
+
     private boolean applyGlobalLoadBalancerRuleConfig(long gslbRuleId, boolean revoke) throws
ResourceUnavailableException {
 
         GlobalLoadBalancerRuleVO gslbRule = _gslbRuleDao.findById(gslbRuleId);


Mime
View raw message