mirror of https://github.com/apache/cloudstack.git
Create Autoscale config in Netscaler with unique Identifier based on Vmgroup
This commit is contained in:
parent
35b0e086d4
commit
4836aba56f
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1525,7 +1525,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();
|
||||
|
|
@ -1567,7 +1567,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);
|
||||
|
|
@ -1609,7 +1609,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);
|
||||
|
|
@ -1924,7 +1924,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);
|
||||
|
|
@ -2229,8 +2229,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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue