use of com.citrix.netscaler.nitro.resource.config.basic.servicegroup in project cloudstack by apache.
the class NetscalerResource method removeAutoScaleConfig.
private synchronized boolean removeAutoScaleConfig(final LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
final String srcIp = loadBalancerTO.getSrcIp();
final int srcPort = loadBalancerTO.getSrcPort();
generateAutoScaleVmGroupIdentifier(loadBalancerTO);
final String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
final String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
if (loadBalancerTO.getAutoScaleVmGroupTO().getCurrentState().equals("enabled")) {
disableAutoScaleConfig(loadBalancerTO, false);
}
if (isServiceGroupBoundToVirtualServer(nsVirtualServerName, serviceGroupName)) {
// UnBind autoscale service group
// unbind lb vserver lb lb_autoscaleGroup
final lbvserver_servicegroup_binding vserver_servicegroup_binding = new lbvserver_servicegroup_binding();
try {
vserver_servicegroup_binding.set_name(nsVirtualServerName);
vserver_servicegroup_binding.set_servicegroupname(serviceGroupName);
lbvserver_servicegroup_binding.delete(_netscalerService, vserver_servicegroup_binding);
} catch (final Exception e) {
throw e;
}
}
if (nsServiceGroupExists(serviceGroupName)) {
// Remove autoscale service group
final com.citrix.netscaler.nitro.resource.config.basic.servicegroup serviceGroup = new com.citrix.netscaler.nitro.resource.config.basic.servicegroup();
try {
serviceGroup.set_servicegroupname(serviceGroupName);
servicegroup.delete(_netscalerService, serviceGroup);
} catch (final Exception e) {
throw e;
}
}
removeLBVirtualServer(nsVirtualServerName);
return true;
}
Aggregations