mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Review 16080 Move Netscaler plugin from non-oss to oss and upgrade the nitro API to 10.1
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
This commit is contained in:
parent
28ac2f758e
commit
356daf3eed
@ -97,6 +97,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.cloudstack</groupId>
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
|
<artifactId>cloud-plugin-network-netscaler</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
<artifactId>cloud-plugin-network-ovs</artifactId>
|
<artifactId>cloud-plugin-network-ovs</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -659,21 +664,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
|
||||||
<id>netscaler</id>
|
|
||||||
<activation>
|
|
||||||
<property>
|
|
||||||
<name>noredist</name>
|
|
||||||
</property>
|
|
||||||
</activation>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cloudstack</groupId>
|
|
||||||
<artifactId>cloud-plugin-network-netscaler</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>srx</id>
|
<id>srx</id>
|
||||||
<activation>
|
<activation>
|
||||||
|
|||||||
@ -30,12 +30,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.citrix.netscaler.nitro</groupId>
|
<groupId>com.citrix.netscaler.nitro</groupId>
|
||||||
<artifactId>nitro</artifactId>
|
<artifactId>nitro</artifactId>
|
||||||
<version>10.0.e</version>
|
<version>10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cloud.com.citrix</groupId>
|
<groupId>com.citrix.netscaler.nitro</groupId>
|
||||||
<artifactId>netscaler-sdx</artifactId>
|
<artifactId>sdx_nitro</artifactId>
|
||||||
<version>1.0</version>
|
<version>10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -72,10 +72,10 @@ import com.citrix.netscaler.nitro.resource.config.ssl.sslvserver_sslcertkey_bind
|
|||||||
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
|
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
|
||||||
import com.citrix.netscaler.nitro.service.nitro_service;
|
import com.citrix.netscaler.nitro.service.nitro_service;
|
||||||
import com.citrix.netscaler.nitro.util.filtervalue;
|
import com.citrix.netscaler.nitro.util.filtervalue;
|
||||||
import com.citrix.sdx.nitro.resource.config.device_profile;
|
import com.citrix.sdx.nitro.resource.config.mps.device_profile;
|
||||||
import com.citrix.sdx.nitro.resource.config.mps;
|
import com.citrix.sdx.nitro.resource.config.mps.mps;
|
||||||
import com.citrix.sdx.nitro.resource.config.ns;
|
import com.citrix.sdx.nitro.resource.config.ns.ns;
|
||||||
import com.citrix.sdx.nitro.resource.config.xen_vpx_image;
|
import com.citrix.sdx.nitro.resource.config.xen.xen_nsvpx_image;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
apiCallResult = _netscalerService.login();
|
apiCallResult = _netscalerService.login();
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
|
throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
|
||||||
apiCallResult.message);
|
apiCallResult.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_netscalerSdxService = new com.citrix.sdx.nitro.service.nitro_service(_ip, "https");
|
_netscalerSdxService = new com.citrix.sdx.nitro.service.nitro_service(_ip, "https");
|
||||||
@ -306,7 +306,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
|
com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
|
||||||
if (login == null) {
|
if (login == null) {
|
||||||
throw new ExecutionException("Failed to log in to Netscaler SDX device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
|
throw new ExecutionException("Failed to log in to Netscaler SDX device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
|
||||||
apiCallResult.message);
|
apiCallResult.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (nitro_exception e) {
|
} catch (nitro_exception e) {
|
||||||
@ -374,7 +374,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
throw new ExecutionException("Failed to get the hardware description of the Netscaler device at " + _ip);
|
throw new ExecutionException("Failed to get the hardware description of the Netscaler device at " + _ip);
|
||||||
} else {
|
} else {
|
||||||
if ((_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX")) ||
|
if ((_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX")) ||
|
||||||
(_deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance"))) {
|
(_deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new ExecutionException("Netscalar device type specified does not match with the actuall device type.");
|
throw new ExecutionException("Netscalar device type specified does not match with the actuall device type.");
|
||||||
@ -510,7 +510,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
|
String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
|
||||||
|
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
||||||
|
|
||||||
if (serviceBindings != null) {
|
if (serviceBindings != null) {
|
||||||
for (DestinationTO destination : loadBalancer.getDestinations()) {
|
for (DestinationTO destination : loadBalancer.getDestinations()) {
|
||||||
@ -635,21 +635,21 @@ public class NetscalerResource implements ServerResource {
|
|||||||
apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.service.add(_netscalerService, newService);
|
apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.service.add(_netscalerService, newService);
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to create service " + nsServiceName + " using server " + nsServerName + " due to" +
|
throw new ExecutionException("Failed to create service " + nsServiceName + " using server " + nsServerName + " due to" +
|
||||||
apiCallResult.message);
|
apiCallResult.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//bind service to load balancing virtual server
|
//bind service to load balancing virtual server
|
||||||
if (!nsServiceBindingExists(nsVirtualServerName, nsServiceName)) {
|
if (!nsServiceBindingExists(nsVirtualServerName, nsServiceName)) {
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
|
||||||
new com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding();
|
new com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding();
|
||||||
svcBinding.set_name(nsVirtualServerName);
|
svcBinding.set_name(nsVirtualServerName);
|
||||||
svcBinding.set_servicename(nsServiceName);
|
svcBinding.set_servicename(nsServiceName);
|
||||||
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.add(_netscalerService, svcBinding);
|
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.add(_netscalerService, svcBinding);
|
||||||
|
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to bind service: " + nsServiceName + " to the lb virtual server: " + nsVirtualServerName +
|
throw new ExecutionException("Failed to bind service: " + nsServiceName + " to the lb virtual server: " + nsVirtualServerName +
|
||||||
" on Netscaler device");
|
" on Netscaler device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
String intermediateCertFileName = intermediateCertKeyName + ".pem";
|
String intermediateCertFileName = intermediateCertKeyName + ".pem";
|
||||||
|
|
||||||
if (!SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
|
if (!SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
|
||||||
byte[] certData = intermediateCert.getEncoded();
|
intermediateCert.getEncoded();
|
||||||
StringWriter textWriter = new StringWriter();
|
StringWriter textWriter = new StringWriter();
|
||||||
PEMWriter pemWriter = new PEMWriter(textWriter);
|
PEMWriter pemWriter = new PEMWriter(textWriter);
|
||||||
pemWriter.writeObject(intermediateCert);
|
pemWriter.writeObject(intermediateCert);
|
||||||
@ -735,13 +735,13 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Successfully added LB destination: " + destination.getDestIp() + ":" + destination.getDestPort() + " to load balancer " +
|
s_logger.debug("Successfully added LB destination: " + destination.getDestIp() + ":" + destination.getDestPort() + " to load balancer " +
|
||||||
srcIp + ":" + srcPort);
|
srcIp + ":" + srcPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// remove a destination from the deployed load balancing rule
|
// remove a destination from the deployed load balancing rule
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
||||||
if (serviceBindings != null) {
|
if (serviceBindings != null) {
|
||||||
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
||||||
if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
|
if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
|
||||||
@ -749,7 +749,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
|
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to delete the binding between the virtual server: " + nsVirtualServerName +
|
throw new ExecutionException("Failed to delete the binding between the virtual server: " + nsVirtualServerName +
|
||||||
" and service:" + nsServiceName + " due to" + apiCallResult.message);
|
" and service:" + nsServiceName + " due to" + apiCallResult.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if service is bound to any other virtual server
|
// check if service is bound to any other virtual server
|
||||||
@ -780,7 +780,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if (lbserver != null) {
|
if (lbserver != null) {
|
||||||
//unbind the all services associated with this virtual server
|
//unbind the all services associated with this virtual server
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
|
||||||
|
|
||||||
if (serviceBindings != null) {
|
if (serviceBindings != null) {
|
||||||
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
||||||
@ -788,11 +788,11 @@ public class NetscalerResource implements ServerResource {
|
|||||||
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
|
apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to unbind service from the lb virtual server: " + nsVirtualServerName + " due to " +
|
throw new ExecutionException("Failed to unbind service from the lb virtual server: " + nsVirtualServerName + " due to " +
|
||||||
apiCallResult.message);
|
apiCallResult.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service svc =
|
com.citrix.netscaler.nitro.resource.config.basic.service svc =
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName);
|
com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName);
|
||||||
String nsServerName = svc.get_servername();
|
String nsServerName = svc.get_servername();
|
||||||
|
|
||||||
// check if service is bound to any other virtual server
|
// check if service is bound to any other virtual server
|
||||||
@ -830,8 +830,8 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// unbind before deleting
|
// unbind before deleting
|
||||||
if (nsVirtualServerExists(nsVirtualServerName) &&
|
if (nsVirtualServerExists(nsVirtualServerName) &&
|
||||||
SSL.isSslCertKeyPresent(_netscalerService, certKeyName) &&
|
SSL.isSslCertKeyPresent(_netscalerService, certKeyName) &&
|
||||||
SSL.isBoundToVserver(_netscalerService, certKeyName, nsVirtualServerName)) {
|
SSL.isBoundToVserver(_netscalerService, certKeyName, nsVirtualServerName)) {
|
||||||
SSL.unbindCertKeyFromVserver(_netscalerService, certKeyName, nsVirtualServerName);
|
SSL.unbindCertKeyFromVserver(_netscalerService, certKeyName, nsVirtualServerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
* Check and delete intermediate certs:
|
* Check and delete intermediate certs:
|
||||||
* we can delete an intermediate cert if no other
|
* we can delete an intermediate cert if no other
|
||||||
* cert references it as the athority
|
* cert references it as the athority
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sslCert.getChain() != null) {
|
if (sslCert.getChain() != null) {
|
||||||
List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
|
List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
|
||||||
@ -858,7 +858,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
String intermediateCertFileName = intermediateCertKeyName + ".pem";
|
String intermediateCertFileName = intermediateCertKeyName + ".pem";
|
||||||
|
|
||||||
if (SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName) &&
|
if (SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName) &&
|
||||||
!SSL.isCaforCerts(_netscalerService, intermediateCertKeyName)) {
|
!SSL.isCaforCerts(_netscalerService, intermediateCertKeyName)) {
|
||||||
SSL.deleteSslCertKey(_netscalerService, intermediateCertKeyName);
|
SSL.deleteSslCertKey(_netscalerService, intermediateCertKeyName);
|
||||||
SSL.deleteCertFile(_ip, _username, _password, intermediateCertFileName);
|
SSL.deleteCertFile(_ip, _username, _password, intermediateCertFileName);
|
||||||
} else {
|
} else {
|
||||||
@ -914,8 +914,8 @@ public class NetscalerResource implements ServerResource {
|
|||||||
ns_obj.set_password(password);
|
ns_obj.set_password(password);
|
||||||
|
|
||||||
// configure VPX instances with defaults
|
// configure VPX instances with defaults
|
||||||
ns_obj.set_feature_license("Standard");
|
ns_obj.set_license("Standard");
|
||||||
ns_obj.set_memory_total(new Double(2048));
|
ns_obj.set_vm_memory_total(new Double(2048));
|
||||||
ns_obj.set_throughput(new Double(1000));
|
ns_obj.set_throughput(new Double(1000));
|
||||||
ns_obj.set_pps(new Double(1000000));
|
ns_obj.set_pps(new Double(1000000));
|
||||||
ns_obj.set_number_of_ssl_cores(0);
|
ns_obj.set_number_of_ssl_cores(0);
|
||||||
@ -924,17 +924,17 @@ public class NetscalerResource implements ServerResource {
|
|||||||
device_profile[] profiles = device_profile.get(_netscalerSdxService);
|
device_profile[] profiles = device_profile.get(_netscalerSdxService);
|
||||||
if (!(profiles != null && profiles.length >= 1)) {
|
if (!(profiles != null && profiles.length >= 1)) {
|
||||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||||
" as there are no admin profile to use for creating VPX."));
|
" as there are no admin profile to use for creating VPX."));
|
||||||
}
|
}
|
||||||
String profileName = profiles[0].get_name();
|
String profileName = profiles[0].get_name();
|
||||||
ns_obj.set_nsroot_profile(profileName);
|
ns_obj.set_profile_name(profileName);
|
||||||
|
|
||||||
// use the first VPX image of the available VPX images on the SDX to create an instance of VPX
|
// use the first VPX image of the available VPX images on the SDX to create an instance of VPX
|
||||||
// TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
|
// TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
|
||||||
xen_vpx_image[] vpxImages = xen_vpx_image.get(_netscalerSdxService);
|
xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
|
||||||
if (!(vpxImages != null && vpxImages.length >= 1)) {
|
if (!(vpxImages != null && vpxImages.length >= 1)) {
|
||||||
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
|
||||||
" as there are no VPX images on SDX to use for creating VPX."));
|
" as there are no VPX images on SDX to use for creating VPX."));
|
||||||
}
|
}
|
||||||
String imageName = vpxImages[0].get_file_name();
|
String imageName = vpxImages[0].get_file_name();
|
||||||
ns_obj.set_image_name(imageName);
|
ns_obj.set_image_name(imageName);
|
||||||
@ -955,7 +955,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
// wait for VPX instance to start-up
|
// wait for VPX instance to start-up
|
||||||
long startTick = System.currentTimeMillis();
|
long startTick = System.currentTimeMillis();
|
||||||
long startWaitMilliSeconds = 600000;
|
long startWaitMilliSeconds = 600000;
|
||||||
while (!newVpx.get_ns_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
|
while (!newVpx.get_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -966,7 +966,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if vpx instance never came up then error out
|
// if vpx instance never came up then error out
|
||||||
if (!newVpx.get_ns_state().equalsIgnoreCase("up")) {
|
if (!newVpx.get_state().equalsIgnoreCase("up")) {
|
||||||
return new Answer(cmd, new ExecutionException("Failed to start VPX instance " + vpxName + " created on the netscaler SDX device " + _ip));
|
return new Answer(cmd, new ExecutionException("Failed to start VPX instance " + vpxName + " created on the netscaler SDX device " + _ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,13 +1036,13 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new CreateLoadBalancerApplianceAnswer(cmd, true, "provisioned VPX instance", "NetscalerVPXLoadBalancer", "Netscaler", new NetscalerResource(),
|
return new CreateLoadBalancerApplianceAnswer(cmd, true, "provisioned VPX instance", "NetscalerVPXLoadBalancer", "Netscaler", new NetscalerResource(),
|
||||||
publicIf, privateIf, _username, _password);
|
publicIf, privateIf, _username, _password);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (shouldRetry(numRetries)) {
|
if (shouldRetry(numRetries)) {
|
||||||
return retry(cmd, numRetries);
|
return retry(cmd, numRetries);
|
||||||
}
|
}
|
||||||
return new CreateLoadBalancerApplianceAnswer(cmd, false, "failed to provisioned VPX instance due to " + e.getMessage(), null, null, null, null, null, null,
|
return new CreateLoadBalancerApplianceAnswer(cmd, false, "failed to provisioned VPX instance due to " + e.getMessage(), null, null, null, null, null, null,
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1108,8 +1108,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
// Unbind GSLB service with GSLB virtual server
|
// Unbind GSLB service with GSLB virtual server
|
||||||
GSLB.deleteVserverServiceBinding(_netscalerService, serviceName, vserverName);
|
GSLB.deleteVserverServiceBinding(_netscalerService, serviceName, vserverName);
|
||||||
|
|
||||||
// delete 'gslbservice' object
|
GSLB.getServiceObject(_netscalerService, serviceName);
|
||||||
gslbservice service = GSLB.getServiceObject(_netscalerService, serviceName);
|
|
||||||
GSLB.deleteService(_netscalerService, serviceName);
|
GSLB.deleteService(_netscalerService, serviceName);
|
||||||
|
|
||||||
// delete the GSLB service monitor
|
// delete the GSLB service monitor
|
||||||
@ -1288,7 +1287,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// create a 'gslbvserver' object representing a globally load balanced service
|
// create a 'gslbvserver' object representing a globally load balanced service
|
||||||
private static void
|
private static void
|
||||||
createVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, long persistenceId, String serviceType)
|
createVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, long persistenceId, String serviceType)
|
||||||
throws ExecutionException {
|
throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
gslbvserver vserver;
|
gslbvserver vserver;
|
||||||
@ -1398,7 +1397,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// update 'gslbvserver' object representing a globally load balanced service
|
// update 'gslbvserver' object representing a globally load balanced service
|
||||||
private static void updateVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, String serviceType)
|
private static void updateVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, String serviceType)
|
||||||
throws ExecutionException {
|
throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
gslbvserver vServer = getVserverObject(client, vserverName);
|
gslbvserver vServer = getVserverObject(client, vserverName);
|
||||||
if (vServer != null) {
|
if (vServer != null) {
|
||||||
@ -1421,7 +1420,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// create, delete, update, get the GSLB services
|
// create, delete, update, get the GSLB services
|
||||||
private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp, String servicePort, String siteName)
|
private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp, String servicePort, String siteName)
|
||||||
throws ExecutionException {
|
throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
gslbservice service;
|
gslbservice service;
|
||||||
service = getServiceObject(client, serviceName);
|
service = getServiceObject(client, serviceName);
|
||||||
@ -1493,7 +1492,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp, String publicPort, String siteName)
|
private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp, String publicPort, String siteName)
|
||||||
throws ExecutionException {
|
throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
gslbservice service;
|
gslbservice service;
|
||||||
service = getServiceObject(client, serviceName);
|
service = getServiceObject(client, serviceName);
|
||||||
@ -1688,7 +1687,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_logger.debug("Failed to delete GSLB monitor " + monitorName + " and GSLB service " + serviceName + " binding due to " + e.getMessage() +
|
s_logger.debug("Failed to delete GSLB monitor " + monitorName + " and GSLB service " + serviceName + " binding due to " + e.getMessage() +
|
||||||
" but moving on ..., will be cleaned up as part of GSLB " + " service delete any way..");
|
" but moving on ..., will be cleaned up as part of GSLB " + " service delete any way..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2357,7 +2356,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
// if Vlan to interface binding does not exist then ignore the exception and proceed
|
// if Vlan to interface binding does not exist then ignore the exception and proceed
|
||||||
if (!(e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS)) {
|
if (!(e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS)) {
|
||||||
throw new ExecutionException("Failed to unbind vlan from the interface while shutdown of guest network on the Netscaler device due to " +
|
throw new ExecutionException("Failed to unbind vlan from the interface while shutdown of guest network on the Netscaler device due to " +
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2380,7 +2379,10 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// remove subnet IP
|
// remove subnet IP
|
||||||
try {
|
try {
|
||||||
nsip subnetIp = nsip.get(_netscalerService, vlanSelfIp);
|
nsip _vlanSelfIp = new nsip();
|
||||||
|
_vlanSelfIp.set_ipaddress(vlanSelfIp);
|
||||||
|
|
||||||
|
nsip subnetIp = nsip.get(_netscalerService, _vlanSelfIp);
|
||||||
apiCallResult = nsip.delete(_netscalerService, subnetIp);
|
apiCallResult = nsip.delete(_netscalerService, subnetIp);
|
||||||
if (apiCallResult.errorcode != 0) {
|
if (apiCallResult.errorcode != 0) {
|
||||||
throw new ExecutionException("Failed to remove subnet ip:" + vlanSelfIp + " from the NetScaler device due to" + apiCallResult.message);
|
throw new ExecutionException("Failed to remove subnet ip:" + vlanSelfIp + " from the NetScaler device due to" + apiCallResult.message);
|
||||||
@ -2425,9 +2427,12 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean nsSnipExists(String subnetIP) throws ExecutionException {
|
private boolean nsSnipExists(String subnetIp) throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
nsip snip = nsip.get(_netscalerService, subnetIP);
|
nsip _subnetIp = new nsip();
|
||||||
|
_subnetIp.set_ipaddress(subnetIp);
|
||||||
|
|
||||||
|
nsip snip = nsip.get(_netscalerService, _subnetIp);
|
||||||
return (snip != null);
|
return (snip != null);
|
||||||
} catch (nitro_exception e) {
|
} catch (nitro_exception e) {
|
||||||
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
|
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
|
||||||
@ -2585,7 +2590,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
private boolean nsServiceBindingExists(String lbVirtualServer, String serviceName) throws ExecutionException {
|
private boolean nsServiceBindingExists(String lbVirtualServer, String serviceName) throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
|
||||||
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, lbVirtualServer);
|
com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, lbVirtualServer);
|
||||||
if (serviceBindings != null) {
|
if (serviceBindings != null) {
|
||||||
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
|
||||||
if (serviceName.equalsIgnoreCase(binding.get_servicename())) {
|
if (serviceName.equalsIgnoreCase(binding.get_servicename())) {
|
||||||
@ -2603,17 +2608,17 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
private boolean isServiceGroupBoundToVirtualServer(String nsVirtualServerName, String serviceGroupName) throws ExecutionException {
|
private boolean isServiceGroupBoundToVirtualServer(String nsVirtualServerName, String serviceGroupName) throws ExecutionException {
|
||||||
|
|
||||||
lbvserver_servicegroup_binding vserver_servicegroup_binding = new lbvserver_servicegroup_binding();
|
new lbvserver_servicegroup_binding();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lbvserver_servicegroup_binding[] result =
|
lbvserver_servicegroup_binding[] result =
|
||||||
lbvserver_servicegroup_binding.get_filtered(_netscalerService, nsVirtualServerName, "servicegroupname:" + serviceGroupName);
|
lbvserver_servicegroup_binding.get_filtered(_netscalerService, nsVirtualServerName, "servicegroupname:" + serviceGroupName);
|
||||||
if (result != null && result.length > 0) {
|
if (result != null && result.length > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ExecutionException("Failed to verify lb vserver " + nsVirtualServerName + "and servicegrop " + serviceGroupName + " binding exists due to " +
|
throw new ExecutionException("Failed to verify lb vserver " + nsVirtualServerName + "and servicegrop " + serviceGroupName + " binding exists due to " +
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2647,7 +2652,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if (NetUtils.sameSubnet(vlanSelfIp, server.get_ipaddress(), vlanNetmask)) {
|
if (NetUtils.sameSubnet(vlanSelfIp, server.get_ipaddress(), vlanNetmask)) {
|
||||||
// first remove services associated with this server
|
// first remove services associated with this server
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service serveicesList[] =
|
com.citrix.netscaler.nitro.resource.config.basic.service serveicesList[] =
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService);
|
com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService);
|
||||||
if (serveicesList != null) {
|
if (serveicesList != null) {
|
||||||
for (com.citrix.netscaler.nitro.resource.config.basic.service svc : serveicesList) {
|
for (com.citrix.netscaler.nitro.resource.config.basic.service svc : serveicesList) {
|
||||||
if (svc.get_servername().equals(server.get_ipaddress())) {
|
if (svc.get_servername().equals(server.get_ipaddress())) {
|
||||||
@ -2685,7 +2690,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if ((stickyPolicies != null) && (stickyPolicies.length > 0) && (stickyPolicies[0] != null)) {
|
if ((stickyPolicies != null) && (stickyPolicies.length > 0) && (stickyPolicies[0] != null)) {
|
||||||
StickinessPolicyTO stickinessPolicy = stickyPolicies[0];
|
StickinessPolicyTO stickinessPolicy = stickyPolicies[0];
|
||||||
if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName()) ||
|
if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName()) ||
|
||||||
(StickinessMethodType.AppCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName()))) {
|
(StickinessMethodType.AppCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName()))) {
|
||||||
nsProtocol = "HTTP";
|
nsProtocol = "HTTP";
|
||||||
return nsProtocol;
|
return nsProtocol;
|
||||||
}
|
}
|
||||||
@ -2706,7 +2711,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addLBVirtualServer(String virtualServerName, String publicIp, int publicPort, String lbAlgorithm, String protocol, StickinessPolicyTO[] stickyPolicies,
|
private void addLBVirtualServer(String virtualServerName, String publicIp, int publicPort, String lbAlgorithm, String protocol, StickinessPolicyTO[] stickyPolicies,
|
||||||
AutoScaleVmGroupTO vmGroupTO) throws ExecutionException {
|
AutoScaleVmGroupTO vmGroupTO) throws ExecutionException {
|
||||||
try {
|
try {
|
||||||
String lbMethod;
|
String lbMethod;
|
||||||
if ("roundrobin".equalsIgnoreCase(lbAlgorithm)) {
|
if ("roundrobin".equalsIgnoreCase(lbAlgorithm)) {
|
||||||
@ -2724,7 +2729,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if (vserver != null) {
|
if (vserver != null) {
|
||||||
if (!vserver.get_servicetype().equalsIgnoreCase(protocol)) {
|
if (!vserver.get_servicetype().equalsIgnoreCase(protocol)) {
|
||||||
throw new ExecutionException("Can not update virtual server:" + virtualServerName + " as current protocol:" + vserver.get_servicetype() +
|
throw new ExecutionException("Can not update virtual server:" + virtualServerName + " as current protocol:" + vserver.get_servicetype() +
|
||||||
" of virtual server is different from the " + " intended protocol:" + protocol);
|
" of virtual server is different from the " + " intended protocol:" + protocol);
|
||||||
}
|
}
|
||||||
vserverExisis = true;
|
vserverExisis = true;
|
||||||
}
|
}
|
||||||
@ -2826,7 +2831,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if (csMonitor != null) {
|
if (csMonitor != null) {
|
||||||
if (!csMonitor.get_type().equalsIgnoreCase(lbProtocol)) {
|
if (!csMonitor.get_type().equalsIgnoreCase(lbProtocol)) {
|
||||||
throw new ExecutionException("Can not update monitor :" + nsMonitorName + " as current protocol:" + csMonitor.get_type() +
|
throw new ExecutionException("Can not update monitor :" + nsMonitorName + " as current protocol:" + csMonitor.get_type() +
|
||||||
" of monitor is different from the " + " intended protocol:" + lbProtocol);
|
" of monitor is different from the " + " intended protocol:" + lbProtocol);
|
||||||
}
|
}
|
||||||
csMonitorExisis = true;
|
csMonitorExisis = true;
|
||||||
}
|
}
|
||||||
@ -2847,7 +2852,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
csMon.set_failureretries(hcp.getUnhealthThresshold());
|
csMon.set_failureretries(hcp.getUnhealthThresshold());
|
||||||
csMon.set_successretries(hcp.getHealthcheckThresshold());
|
csMon.set_successretries(hcp.getHealthcheckThresshold());
|
||||||
s_logger.debug("Monitor properites going to get created :interval :: " + csMon.get_interval() + "respTimeOUt:: " + csMon.get_resptimeout() +
|
s_logger.debug("Monitor properites going to get created :interval :: " + csMon.get_interval() + "respTimeOUt:: " + csMon.get_resptimeout() +
|
||||||
"failure retires(unhealththresshold) :: " + csMon.get_failureretries() + "successtries(healththresshold) ::" + csMon.get_successretries());
|
"failure retires(unhealththresshold) :: " + csMon.get_failureretries() + "successtries(healththresshold) ::" + csMon.get_successretries());
|
||||||
lbmonitor.add(_netscalerService, csMon);
|
lbmonitor.add(_netscalerService, csMon);
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Monitor :" + nsMonitorName + " is already existing. Skipping to delete and create it");
|
s_logger.debug("Monitor :" + nsMonitorName + " is already existing. Skipping to delete and create it");
|
||||||
@ -2866,7 +2871,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
serviceObject = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, nsServiceName);
|
serviceObject = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, nsServiceName);
|
||||||
if (serviceObject != null) {
|
if (serviceObject != null) {
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor =
|
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor =
|
||||||
new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
|
new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
|
||||||
serviceMonitor.set_monitor_name(nsMonitorName);
|
serviceMonitor.set_monitor_name(nsMonitorName);
|
||||||
serviceMonitor.set_name(nsServiceName);
|
serviceMonitor.set_name(nsServiceName);
|
||||||
serviceMonitor.set_monstate("ENABLED");
|
serviceMonitor.set_monstate("ENABLED");
|
||||||
@ -2889,7 +2894,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
if (serviceObject != null) {
|
if (serviceObject != null) {
|
||||||
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor =
|
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor =
|
||||||
new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
|
new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
|
||||||
serviceMonitor.set_monitor_name(nsMonitorName);
|
serviceMonitor.set_monitor_name(nsMonitorName);
|
||||||
serviceMonitor.set_name(nsServiceName);
|
serviceMonitor.set_name(nsServiceName);
|
||||||
s_logger.debug("Trying to unbind the monitor :" + nsMonitorName + " from the service :" + nsServiceName);
|
s_logger.debug("Trying to unbind the monitor :" + nsMonitorName + " from the service :" + nsServiceName);
|
||||||
@ -2955,7 +2960,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
int srcPort = loadBalancerTO.getSrcPort();
|
int srcPort = loadBalancerTO.getSrcPort();
|
||||||
String lbProtocol = getNetScalerProtocol(loadBalancerTO);
|
String lbProtocol = getNetScalerProtocol(loadBalancerTO);
|
||||||
String lbAlgorithm = loadBalancerTO.getAlgorithm();
|
String lbAlgorithm = loadBalancerTO.getAlgorithm();
|
||||||
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||||
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
AutoScaleVmGroupTO vmGroupTO = loadBalancerTO.getAutoScaleVmGroupTO();
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
@ -3008,7 +3013,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
private synchronized boolean removeAutoScaleConfig(LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
|
private synchronized boolean removeAutoScaleConfig(LoadBalancerTO loadBalancerTO) throws Exception, ExecutionException {
|
||||||
String srcIp = loadBalancerTO.getSrcIp();
|
String srcIp = loadBalancerTO.getSrcIp();
|
||||||
int srcPort = loadBalancerTO.getSrcPort();
|
int srcPort = loadBalancerTO.getSrcPort();
|
||||||
String vmGroupIdentifier = generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
generateAutoScaleVmGroupIdentifier(loadBalancerTO);
|
||||||
|
|
||||||
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
|
||||||
String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
|
String serviceGroupName = generateAutoScaleServiceGroupName(loadBalancerTO);
|
||||||
@ -3064,7 +3069,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
AutoScaleVmProfileTO profileTO = vmGroupTO.getProfile();
|
AutoScaleVmProfileTO profileTO = vmGroupTO.getProfile();
|
||||||
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
List<AutoScalePolicyTO> policies = vmGroupTO.getPolicies();
|
||||||
int interval = vmGroupTO.getInterval();
|
int interval = vmGroupTO.getInterval();
|
||||||
List<Pair<String, String>> counterParams = profileTO.getCounterParamList();
|
profileTO.getCounterParamList();
|
||||||
String snmpCommunity = null;
|
String snmpCommunity = null;
|
||||||
int snmpPort = DEFAULT_SNMP_PORT;
|
int snmpPort = DEFAULT_SNMP_PORT;
|
||||||
long cur_prirotiy = 1;
|
long cur_prirotiy = 1;
|
||||||
@ -3156,7 +3161,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
// add autoscale action lb_scaleUpAction provision -vserver lb -profilename lb_asprofile -params
|
// add autoscale action lb_scaleUpAction provision -vserver lb -profilename lb_asprofile -params
|
||||||
// -lbruleid=1234&command=deployvm&zoneid=10&templateid=5&serviceofferingid=3- -quiettime 300
|
// -lbruleid=1234&command=deployvm&zoneid=10&templateid=5&serviceofferingid=3- -quiettime 300
|
||||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction =
|
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction =
|
||||||
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||||
try {
|
try {
|
||||||
scaleUpAction.set_name(scaleUpActionName);
|
scaleUpAction.set_name(scaleUpActionName);
|
||||||
scaleUpAction.set_type("SCALE_UP"); // TODO: will this be called provision?
|
scaleUpAction.set_type("SCALE_UP"); // TODO: will this be called provision?
|
||||||
@ -3165,10 +3170,10 @@ public class NetscalerResource implements ServerResource {
|
|||||||
scaleUpAction.set_profilename(profileName);
|
scaleUpAction.set_profilename(profileName);
|
||||||
scaleUpAction.set_quiettime(scaleUpQuietTime);
|
scaleUpAction.set_quiettime(scaleUpQuietTime);
|
||||||
String scaleUpParameters =
|
String scaleUpParameters =
|
||||||
"command=deployVirtualMachine" + "&" + ApiConstants.ZONE_ID + "=" + profileTO.getZoneId() + "&" + ApiConstants.SERVICE_OFFERING_ID + "=" +
|
"command=deployVirtualMachine" + "&" + ApiConstants.ZONE_ID + "=" + profileTO.getZoneId() + "&" + ApiConstants.SERVICE_OFFERING_ID + "=" +
|
||||||
profileTO.getServiceOfferingId() + "&" + ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId() + "&" + ApiConstants.DISPLAY_NAME + "=" +
|
profileTO.getServiceOfferingId() + "&" + ApiConstants.TEMPLATE_ID + "=" + profileTO.getTemplateId() + "&" + ApiConstants.DISPLAY_NAME + "=" +
|
||||||
profileTO.getVmName() + "&" + ((profileTO.getNetworkId() == null) ? "" : (ApiConstants.NETWORK_IDS + "=" + profileTO.getNetworkId() + "&")) +
|
profileTO.getVmName() + "&" + ((profileTO.getNetworkId() == null) ? "" : (ApiConstants.NETWORK_IDS + "=" + profileTO.getNetworkId() + "&")) +
|
||||||
((profileTO.getOtherDeployParams() == null) ? "" : (profileTO.getOtherDeployParams() + "&")) + "lbruleid=" + loadBalancerTO.getUuid();
|
((profileTO.getOtherDeployParams() == null) ? "" : (profileTO.getOtherDeployParams() + "&")) + "lbruleid=" + loadBalancerTO.getUuid();
|
||||||
scaleUpAction.set_parameters(scaleUpParameters);
|
scaleUpAction.set_parameters(scaleUpParameters);
|
||||||
autoscaleaction.add(_netscalerService, scaleUpAction);
|
autoscaleaction.add(_netscalerService, scaleUpAction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -3178,7 +3183,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction =
|
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction =
|
||||||
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||||
Integer destroyVmGracePeriod = profileTO.getDestroyVmGraceperiod();
|
Integer destroyVmGracePeriod = profileTO.getDestroyVmGraceperiod();
|
||||||
try {
|
try {
|
||||||
scaleDownAction.set_name(scaleDownActionName);
|
scaleDownAction.set_name(scaleDownActionName);
|
||||||
@ -3200,13 +3205,13 @@ public class NetscalerResource implements ServerResource {
|
|||||||
/* Create min member policy */
|
/* Create min member policy */
|
||||||
String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier);
|
String minMemberPolicyName = generateAutoScaleMinPolicyName(vmGroupIdentifier);
|
||||||
String minMemberPolicyExp =
|
String minMemberPolicyExp =
|
||||||
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
||||||
addAutoScalePolicy(timerName, minMemberPolicyName, cur_prirotiy++, minMemberPolicyExp, scaleUpActionName, interval, interval, isCleanUp);
|
addAutoScalePolicy(timerName, minMemberPolicyName, cur_prirotiy++, minMemberPolicyExp, scaleUpActionName, interval, interval, isCleanUp);
|
||||||
|
|
||||||
/* Create max member policy */
|
/* Create max member policy */
|
||||||
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(vmGroupIdentifier);
|
String maxMemberPolicyName = generateAutoScaleMaxPolicyName(vmGroupIdentifier);
|
||||||
String maxMemberPolicyExp =
|
String maxMemberPolicyExp =
|
||||||
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
||||||
addAutoScalePolicy(timerName, maxMemberPolicyName, cur_prirotiy++, maxMemberPolicyExp, scaleDownActionName, interval, interval, isCleanUp);
|
addAutoScalePolicy(timerName, maxMemberPolicyName, cur_prirotiy++, maxMemberPolicyExp, scaleDownActionName, interval, interval, isCleanUp);
|
||||||
|
|
||||||
/* Create Counters */
|
/* Create Counters */
|
||||||
@ -3336,12 +3341,12 @@ public class NetscalerResource implements ServerResource {
|
|||||||
if (isScaleUpPolicy(autoScalePolicyTO)) {
|
if (isScaleUpPolicy(autoScalePolicyTO)) {
|
||||||
action = scaleUpActionName;
|
action = scaleUpActionName;
|
||||||
String scaleUpCondition =
|
String scaleUpCondition =
|
||||||
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.LT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MAXAUTOSCALEMEMBERS)";
|
||||||
policyExpression = scaleUpCondition + " && " + policyExpression;
|
policyExpression = scaleUpCondition + " && " + policyExpression;
|
||||||
} else {
|
} else {
|
||||||
action = scaleDownActionName;
|
action = scaleDownActionName;
|
||||||
String scaleDownCondition =
|
String scaleDownCondition =
|
||||||
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
"SYS.VSERVER(\"" + nsVirtualServerName + "\").ACTIVESERVICES.GT(SYS.VSERVER(\"" + nsVirtualServerName + "\").MINAUTOSCALEMEMBERS)";
|
||||||
policyExpression = scaleDownCondition + " && " + policyExpression;
|
policyExpression = scaleDownCondition + " && " + policyExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3409,7 +3414,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
/* Delete AutoScale Config */
|
/* Delete AutoScale Config */
|
||||||
// Delete AutoScale ScaleDown action
|
// Delete AutoScale ScaleDown action
|
||||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction =
|
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleDownAction =
|
||||||
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||||
try {
|
try {
|
||||||
scaleDownAction.set_name(scaleDownActionName);
|
scaleDownAction.set_name(scaleDownActionName);
|
||||||
autoscaleaction.delete(_netscalerService, scaleDownAction);
|
autoscaleaction.delete(_netscalerService, scaleDownAction);
|
||||||
@ -3421,7 +3426,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
|
|
||||||
// Delete AutoScale ScaleUp action
|
// Delete AutoScale ScaleUp action
|
||||||
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction =
|
com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction scaleUpAction =
|
||||||
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
new com.citrix.netscaler.nitro.resource.config.autoscale.autoscaleaction();
|
||||||
try {
|
try {
|
||||||
scaleUpAction.set_name(scaleUpActionName);
|
scaleUpAction.set_name(scaleUpActionName);
|
||||||
autoscaleaction.delete(_netscalerService, scaleUpAction);
|
autoscaleaction.delete(_netscalerService, scaleUpAction);
|
||||||
@ -3504,7 +3509,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void addAutoScalePolicy(String timerName, String policyName, long priority, String policyExpression, String action, int duration, int interval,
|
private synchronized void addAutoScalePolicy(String timerName, String policyName, long priority, String policyExpression, String action, int duration, int interval,
|
||||||
boolean isCleanUp) throws Exception {
|
boolean isCleanUp) throws Exception {
|
||||||
// Adding a autoscale policy
|
// Adding a autoscale policy
|
||||||
// add timer policy lb_policy_scaleUp_cpu_mem -rule - (SYS.CUR_VSERVER.METRIC_TABLE(cpu).AVG_VAL.GT(80)-
|
// add timer policy lb_policy_scaleUp_cpu_mem -rule - (SYS.CUR_VSERVER.METRIC_TABLE(cpu).AVG_VAL.GT(80)-
|
||||||
// -action lb_scaleUpAction
|
// -action lb_scaleUpAction
|
||||||
@ -3572,7 +3577,7 @@ public class NetscalerResource implements ServerResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
|
private boolean isAutoScaleSupportedInNetScaler() throws ExecutionException {
|
||||||
autoscaleprofile autoscaleProfile = new autoscaleprofile();
|
new autoscaleprofile();
|
||||||
try {
|
try {
|
||||||
autoscaleprofile.get(_netscalerService);
|
autoscaleprofile.get(_netscalerService);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
@ -47,6 +47,7 @@
|
|||||||
<module>network-elements/ovs</module>
|
<module>network-elements/ovs</module>
|
||||||
<module>network-elements/juniper-contrail</module>
|
<module>network-elements/juniper-contrail</module>
|
||||||
<module>network-elements/palo-alto</module>
|
<module>network-elements/palo-alto</module>
|
||||||
|
<module>network-elements/netscaler</module>
|
||||||
<module>network-elements/nicira-nvp</module>
|
<module>network-elements/nicira-nvp</module>
|
||||||
<module>network-elements/bigswitch-vns</module>
|
<module>network-elements/bigswitch-vns</module>
|
||||||
<module>network-elements/midonet</module>
|
<module>network-elements/midonet</module>
|
||||||
@ -136,17 +137,6 @@
|
|||||||
<module>network-elements/f5</module>
|
<module>network-elements/f5</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
|
||||||
<id>netscaler</id>
|
|
||||||
<activation>
|
|
||||||
<property>
|
|
||||||
<name>noredist</name>
|
|
||||||
</property>
|
|
||||||
</activation>
|
|
||||||
<modules>
|
|
||||||
<module>network-elements/netscaler</module>
|
|
||||||
</modules>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>srx</id>
|
<id>srx</id>
|
||||||
<activation>
|
<activation>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user