Search in sources :

Example 1 with com.citrix.netscaler.nitro.resource.config.basic.servicegroup

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;
}
Also used : com.citrix.netscaler.nitro.resource.config.basic.servicegroup(com.citrix.netscaler.nitro.resource.config.basic.servicegroup) com.citrix.netscaler.nitro.resource.config.basic.servicegroup(com.citrix.netscaler.nitro.resource.config.basic.servicegroup) ExecutionException(com.cloud.utils.exception.ExecutionException) IOException(java.io.IOException) ConfigurationException(javax.naming.ConfigurationException) com.citrix.netscaler.nitro.resource.config.lb.lbvserver_servicegroup_binding(com.citrix.netscaler.nitro.resource.config.lb.lbvserver_servicegroup_binding) com.citrix.netscaler.nitro.resource.config.ns.nsconfig(com.citrix.netscaler.nitro.resource.config.ns.nsconfig)

Aggregations

com.citrix.netscaler.nitro.resource.config.basic.servicegroup (com.citrix.netscaler.nitro.resource.config.basic.servicegroup)1 com.citrix.netscaler.nitro.resource.config.lb.lbvserver_servicegroup_binding (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_servicegroup_binding)1 com.citrix.netscaler.nitro.resource.config.ns.nsconfig (com.citrix.netscaler.nitro.resource.config.ns.nsconfig)1 ExecutionException (com.cloud.utils.exception.ExecutionException)1 IOException (java.io.IOException)1 ConfigurationException (javax.naming.ConfigurationException)1