diff --git a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java index 362b85ac6a0..44f7ab3f04c 100644 --- a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java +++ b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java @@ -361,6 +361,7 @@ public class LoadBalancerTO implements Serializable { } public static class AutoScaleVmGroupTO implements Serializable { + private final String uuid; private final int minMembers; private final int maxMembers; private final int memberPort; @@ -370,8 +371,9 @@ public class LoadBalancerTO implements Serializable { private final String state; private final String currentState; - AutoScaleVmGroupTO(int minMembers, int maxMembers, int memberPort, int interval, List policies, AutoScaleVmProfileTO profile, String state, String currentState) + AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List policies, AutoScaleVmProfileTO profile, String state, String currentState) { + this.uuid = uuid; this.minMembers = minMembers; this.maxMembers = maxMembers; this.memberPort = memberPort; @@ -382,6 +384,10 @@ public class LoadBalancerTO implements Serializable { this.currentState = currentState; } + public String getUuid() { + return uuid; + } + public int getMinMembers() { return minMembers; } @@ -444,7 +450,7 @@ public class LoadBalancerTO implements Serializable { 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()); } diff --git a/core/src/com/cloud/network/resource/NetscalerResource.java b/core/src/com/cloud/network/resource/NetscalerResource.java index 64980dc79cf..c295c51a947 100644 --- a/core/src/com/cloud/network/resource/NetscalerResource.java +++ b/core/src/com/cloud/network/resource/NetscalerResource.java @@ -1528,7 +1528,7 @@ public class NetscalerResource implements ServerResource { } addLBVirtualServer(nsVirtualServerName, srcIp, srcPort, lbAlgorithm, lbProtocol, loadBalancerTO.getStickinessPolicies(), vmGroupTO); - String serviceGroupName = generateAutoScaleServiceGroupName(vmGroupIdentifier); + String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO); servicegroup serviceGroup = getServiceGroupIfExisits(serviceGroupName); if(serviceGroup == null) { // add servicegroup lb_autoscaleGroup -autoscale POLICY -memberPort 80 @@ -1571,7 +1571,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); @@ -1613,7 +1613,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); @@ -1923,7 +1923,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 policies = vmGroupTO.getPolicies(); String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier); @@ -2231,8 +2231,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) { diff --git a/deps/cloud-netscaler.jar b/deps/cloud-netscaler.jar index 0cf1820f86e..8134cba102f 100755 Binary files a/deps/cloud-netscaler.jar and b/deps/cloud-netscaler.jar differ