cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pran...@apache.org
Subject git commit: Create Autoscale config in Netscaler with unique Identifier based on Vmgroup
Date Thu, 27 Sep 2012 15:03:36 GMT
Updated Branches:
  refs/heads/autoscale bf62abae8 -> 9d660bbb6


Create Autoscale config in Netscaler with unique Identifier based on Vmgroup


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

Branch: refs/heads/autoscale
Commit: 9d660bbb634538ca4747fed8f91405883d39f3dc
Parents: bf62aba
Author: Vijay Vekatachalam <vijay.venkatachalam@citrix.com>
Authored: Thu Sep 27 20:31:58 2012 +0530
Committer: Pranav Saxena <pranav.saxena@citrix.com>
Committed: Thu Sep 27 20:31:58 2012 +0530

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/LoadBalancerTO.java |   10 ++++++-
 .../cloud/network/resource/NetscalerResource.java  |   19 ++++++++++----
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9d660bbb/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
index 1a8093c..24ea702 100644
--- a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
+++ b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
@@ -362,6 +362,7 @@ public class LoadBalancerTO {
     }
 
     public static class AutoScaleVmGroupTO implements Serializable {
+        private final String uuid;
         private final int minMembers;
         private final int maxMembers;
         private final int memberPort;
@@ -371,8 +372,9 @@ public class LoadBalancerTO {
         private final String state;
         private final String currentState;
 
-        AutoScaleVmGroupTO(int minMembers, int maxMembers, int memberPort, int interval,
List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state, String
currentState)
+        AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int
interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state,
String currentState)
         {
+            this.uuid = uuid;
             this.minMembers = minMembers;
             this.maxMembers = maxMembers;
             this.memberPort = memberPort;
@@ -383,6 +385,10 @@ public class LoadBalancerTO {
             this.currentState = currentState;
         }
 
+        public String getUuid() {
+            return uuid;
+        }
+
         public int getMinMembers() {
             return minMembers;
         }
@@ -445,7 +451,7 @@ public class LoadBalancerTO {
                 autoScaleVmProfile.getSnmpPort(), autoScaleVmProfile.getDestroyVmGraceperiod());
 
         AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
-        autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(),
autoScaleVmGroup.getMemberPort(),
+        autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(),
autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
                 autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO,
autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9d660bbb/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
index 7c8f88c..9900e01 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
@@ -1521,7 +1521,7 @@ public class NetscalerResource implements ServerResource {
         }
         addLBVirtualServer(nsVirtualServerName, srcIp, srcPort, lbAlgorithm, lbProtocol,
loadBalancerTO.getStickinessPolicies(), vmGroupTO);
 
-        String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
+        String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
         if(!nsServiceGroupExists(serviceGroupName)) {
             // add servicegroup lb_autoscaleGroup -autoscale POLICY -memberPort 80
             int memberPort = vmGroupTO.getMemberPort();
@@ -1563,7 +1563,7 @@ public class NetscalerResource implements ServerResource {
         String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
 
         String nsVirtualServerName  = generateNSVirtualServerName(srcIp, srcPort);
-        String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
+        String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
 
         if(loadBalancerTO.getAutoScaleVmGroupTO().getCurrentState().equals("enabled")) {
             disableAutoScaleConfig(loadBalancerTO, false);
@@ -1605,7 +1605,7 @@ public class NetscalerResource implements ServerResource {
         int srcPort = loadBalancerTO.getSrcPort();
 
         String nsVirtualServerName  = generateNSVirtualServerName(srcIp, srcPort);
-        String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
+        String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
         String profileName = generateAutoScaleProfileName(vmGroupIdentifier);
         String timerName = generateAutoScaleTimerName(vmGroupIdentifier);
         String scaleDownActionName = generateAutoScaleScaleDownActionName(vmGroupIdentifier);
@@ -1920,7 +1920,7 @@ public class NetscalerResource implements ServerResource {
         String scaleUpActionName = generateAutoScaleScaleUpActionName(vmGroupIdentifier);
         String mtName = generateSnmpMetricTableName(vmGroupIdentifier);
         String monitorName = generateSnmpMonitorName(vmGroupIdentifier);
-        String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier);
+        String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
         AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
         List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
         String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier);
@@ -2225,8 +2225,15 @@ public class NetscalerResource implements ServerResource {
         return lbTO.getSrcIp() + "-" + lbTO.getSrcPort();
     }
 
-    private String generateAutoScaleServiceGroupName(String vmGroupIdentifier) {
-        return genObjectName("Cloud-AutoScale-SvcGrp", vmGroupIdentifier);
+    private String generateAutoScaleServiceGroupName(LoadBalancerTO lbTO) {
+        /*
+         *  ServiceGroup name in NetScaler wont support long names. Providing special name.
+         *  Need for introducing uuid because every vmgroup creation should be distinguished.
+         *  Ex. (1) create a vm group, delete a vmgroup, create a vmgroup on same lb ip and
port
+         *  This will reuse all vms from the original vm group in step (1)
+         */
+
+        return "Cloud" + lbTO.getAutoScaleVmGroupTO().getUuid().replace("-", "");
     }
 
     private String generateAutoScaleTimerName(String vmGroupIdentifier) {


Mime
View raw message