Skip to content

Commit 310a9fd

Browse files
Murali reddyMurali reddy
authored andcommitted
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
1 parent b6eff02 commit 310a9fd

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

‎core/src/com/cloud/network/resource/NetscalerResource.java‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@
6161
import com.citrix.netscaler.nitro.resource.config.ns.*;
6262
import com.citrix.netscaler.nitro.resource.config.basic.server_service_binding;
6363
import com.citrix.netscaler.nitro.resource.stat.lb.lbvserver_stats;
64+
import com.citrix.sdx.nitro.resource.config.device_profile;
6465
import com.citrix.sdx.nitro.resource.config.ns;
6566
import com.citrix.sdx.nitro.resource.config.mps;
67+
import com.citrix.sdx.nitro.resource.config.xen_vpx_image;
68+
6669
import org.apache.log4j.Logger;
6770

6871
class NitroError {
@@ -179,7 +182,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
179182
login();
180183
validateDeviceType(_deviceName);
181184
validateInterfaces(_publicInterface, _privateInterface);
182-
185+
183186
//enable load balancing feature
184187
enableLoadBalancingFeature();
185188

@@ -603,9 +606,26 @@ private synchronized Answer execute(CreateLoadBalancerApplianceCommand cmd, int
603606
ns_obj.set_memory_total(new Double(2048));
604607
ns_obj.set_throughput(new Double(1000));
605608
ns_obj.set_pps(new Double(1000000));
606-
ns_obj.set_nsroot_profile("NS_nsroot_profile");
607609
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);
609629

610630
String publicIf = _publicInterface;
611631
String privateIf = _privateInterface;

0 commit comments

Comments
 (0)