|
61 | 61 | import com.citrix.netscaler.nitro.resource.config.ns.*; |
62 | 62 | import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding; |
63 | 63 | import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats; |
| 64 | +import com.citrix.sdx.nitro.resource.config.device_profile; |
64 | 65 | import com.citrix.sdx.nitro.resource.config.ns; |
65 | 66 | import com.citrix.sdx.nitro.resource.config.mps; |
| 67 | +import com.citrix.sdx.nitro.resource.config.xen_vpx_image; |
| 68 | + |
66 | 69 | import org.apache.log4j.Logger; |
67 | 70 |
|
68 | 71 | class NitroError { |
@@ -179,7 +182,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu |
179 | 182 | login(); |
180 | 183 | validateDeviceType(_deviceName); |
181 | 184 | validateInterfaces(_publicInterface, _privateInterface); |
182 | | - |
| 185 | + |
183 | 186 | //enable load balancing feature |
184 | 187 | enableLoadBalancingFeature(); |
185 | 188 |
|
@@ -603,9 +606,26 @@ private synchronized Answer execute(CreateLoadBalancerApplianceCommand cmd, int |
603 | 606 | ns_obj.set_memory_total(new Double(2048)); |
604 | 607 | ns_obj.set_throughput(new Double(1000)); |
605 | 608 | ns_obj.set_pps(new Double(1000000)); |
606 | | - ns_obj.set_nsroot_profile("NS_nsroot_profile"); |
607 | 609 | ns_obj.set_number_of_ssl_cores(0); |
608 | | - ns_obj.set_image_name("NSVPX-XEN-9.3-52.4_nc.xva"); |
| 610 | + |
| 611 | + // use the first device profile available on the SDX to create an instance of VPX |
| 612 | + device_profile[] profiles = device_profile.get(_netscalerSdxService); |
| 613 | + if (!(profiles != null && profiles.length >= 1)) { |
| 614 | + new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip + |
| 615 | + " as there are no admin profile to use for creating VPX.")); |
| 616 | + } |
| 617 | + String profileName = profiles[0].get_name(); |
| 618 | + ns_obj.set_nsroot_profile(profileName); |
| 619 | + |
| 620 | + // use the first VPX image of the available VPX images on the SDX to create an instance of VPX |
| 621 | + // TODO: should enable the option to choose the template while adding the SDX device in to CloudStack |
| 622 | + xen_vpx_image[] vpxImages = xen_vpx_image.get(_netscalerSdxService); |
| 623 | + if (!(vpxImages != null && vpxImages.length >= 1)) { |
| 624 | + new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip + |
| 625 | + " as there are no VPX images on SDX to use for creating VPX.")); |
| 626 | + } |
| 627 | + String imageName = vpxImages[0].get_file_name(); |
| 628 | + ns_obj.set_image_name(imageName); |
609 | 629 |
|
610 | 630 | String publicIf = _publicInterface; |
611 | 631 | String privateIf = _privateInterface; |
|
0 commit comments