mirror of https://github.com/apache/cloudstack.git
BUG CS-16195. Checked if autoscale version is supported in netscaler using configobjects entity
Reviewed-By: Devdeep
This commit is contained in:
parent
4e2b0fda06
commit
cf9e62a80e
|
|
@ -24,6 +24,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.citrix.netscaler.nitro.exception.nitro_exception;
|
||||
import com.citrix.netscaler.nitro.resource.base.base_response;
|
||||
import com.citrix.netscaler.nitro.resource.base.configobjects;
|
||||
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscalepolicy;
|
||||
import com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleprofile;
|
||||
import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding;
|
||||
|
|
@ -94,6 +95,8 @@ import com.cloud.utils.exception.ExecutionException;
|
|||
import com.cloud.utils.net.NetUtils;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
class NitroError {
|
||||
static final int NS_RESOURCE_EXISTS = 273;
|
||||
static final int NS_RESOURCE_NOT_EXISTS=258;
|
||||
|
|
@ -465,6 +468,10 @@ public class NetscalerResource implements ServerResource {
|
|||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||
|
||||
if(loadBalancer.isAutoScaleVmGroupTO()) {
|
||||
if(!isAutoScaleSupportedInNetScaler()) {
|
||||
return new Answer(cmd, false, "AutoScale not supported in this version of NetScaler");
|
||||
}
|
||||
|
||||
applyAutoScaleConfig(loadBalancer);
|
||||
return new Answer(cmd);
|
||||
}
|
||||
|
|
@ -2139,18 +2146,23 @@ public class NetscalerResource implements ServerResource {
|
|||
}
|
||||
|
||||
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
|
||||
autoscaleprofile autoscaleProfile = new autoscaleprofile();
|
||||
try {
|
||||
autoscaleProfile.get(_netscalerService);
|
||||
} catch (Exception ex) {
|
||||
// Looks like autoscale is not supported in this netscaler.
|
||||
// TODO: Config team has introduce a new command to check
|
||||
// the list of entities supported in a NetScaler. Can use that
|
||||
// once it is present in AutoScale branch.
|
||||
s_logger.warn("AutoScale is not supported in NetScaler");
|
||||
configobjects netscaler_entities = configobjects.get(_netscalerService);
|
||||
String[] config_entities = netscaler_entities.get_objects();
|
||||
if(Arrays.asList(config_entities).contains("autoscaleprofile"))
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
// configobjects.get() when run against olderversions of netscaler where autoscale is not supported throws
|
||||
// an error with "Expecting object found"
|
||||
if(ex.getMessage().contains("Expecting object found"))
|
||||
{
|
||||
/* config objects itself is not present, this netscaler should not have autoscale*/
|
||||
s_logger.warn("AutoScale is not supported in NetScaler");
|
||||
return false;
|
||||
}
|
||||
throw new ExecutionException("Exception while checking if autoscale is supported in netscaler ", ex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isScaleUpPolicy(AutoScalePolicyTO autoScalePolicyTO) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue