From 310a9fd671c2696fbfc07446b97c641b2a62d92d Mon Sep 17 00:00:00 2001 From: Murali reddy Date: Wed, 2 May 2012 17:20:10 +0530 Subject: [PATCH] bug cs-14285 NetScaler SDX: can not create VPX instances when XVA image is not NSVPX-XEN-9.3-52.4_nc.xva status cs-14285: resolved fixed This fix enables to use the first available VPX image and device profile on the SDX while creating VPX --- .../network/resource/NetscalerResource.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/core/src/com/cloud/network/resource/NetscalerResource.java b/core/src/com/cloud/network/resource/NetscalerResource.java index 160c90ec1e7..c7b31f31464 100644 --- a/core/src/com/cloud/network/resource/NetscalerResource.java +++ b/core/src/com/cloud/network/resource/NetscalerResource.java @@ -61,8 +61,11 @@ import com.citrix.netscaler.nitro.resource.config.network.*; import com.citrix.netscaler.nitro.resource.config.ns.*; import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding; import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats; +import com.citrix.sdx.nitro.resource.config.device_profile; import com.citrix.sdx.nitro.resource.config.ns; import com.citrix.sdx.nitro.resource.config.mps; +import com.citrix.sdx.nitro.resource.config.xen_vpx_image; + import org.apache.log4j.Logger; class NitroError { @@ -179,7 +182,7 @@ public class NetscalerResource implements ServerResource { login(); validateDeviceType(_deviceName); validateInterfaces(_publicInterface, _privateInterface); - + //enable load balancing feature enableLoadBalancingFeature(); @@ -603,9 +606,26 @@ public class NetscalerResource implements ServerResource { ns_obj.set_memory_total(new Double(2048)); ns_obj.set_throughput(new Double(1000)); ns_obj.set_pps(new Double(1000000)); - ns_obj.set_nsroot_profile("NS_nsroot_profile"); ns_obj.set_number_of_ssl_cores(0); - ns_obj.set_image_name("NSVPX-XEN-9.3-52.4_nc.xva"); + + // use the first device profile available on the SDX to create an instance of VPX + device_profile[] profiles = device_profile.get(_netscalerSdxService); + if (!(profiles != null && profiles.length >= 1)) { + 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.")); + } + String profileName = profiles[0].get_name(); + ns_obj.set_nsroot_profile(profileName); + + // 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 + xen_vpx_image[] vpxImages = xen_vpx_image.get(_netscalerSdxService); + if (!(vpxImages != null && vpxImages.length >= 1)) { + 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.")); + } + String imageName = vpxImages[0].get_file_name(); + ns_obj.set_image_name(imageName); String publicIf = _publicInterface; String privateIf = _privateInterface;