bug 13179: Netscaler - Admin is allowed to delete the SDX instance when there are existing vpx instances that was created

status 13179: resolved fixed
This commit is contained in:
Murali reddy 2012-02-07 14:18:43 +05:30
parent 207f0db318
commit 5f8936eb2f

View File

@ -288,10 +288,23 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
DetailVO lbHostDetails = _hostDetailDao.findDetail(hostId, ApiConstants.LOAD_BALANCER_DEVICE_ID);
long lbDeviceId = Long.parseLong(lbHostDetails.getValue());
// check if any networks are using this load balancer device
List<NetworkExternalLoadBalancerVO> networks = _networkLBDao.listByLoadBalancerDeviceId(lbDeviceId);
if ((networks != null) && !networks.isEmpty()) {
throw new CloudRuntimeException("Delete can not be done as there are networks using this load balancer device ");
ExternalLoadBalancerDeviceVO lbDeviceVo = _externalLoadBalancerDeviceDao.findById(lbDeviceId);
if (lbDeviceVo.getAllocationState() == LBDeviceAllocationState.Provider) {
// check if cloudstack has provisioned any load balancer appliance on the device before deleting
List<ExternalLoadBalancerDeviceVO> lbDevices = _externalLoadBalancerDeviceDao.listAll();
if (lbDevices != null) {
for (ExternalLoadBalancerDeviceVO lbDevice : lbDevices) {
if (lbDevice.getParentHostId() == hostId) {
throw new CloudRuntimeException("This load balancer device can not be deleted as there are one or more load balancers applainces provisioned by cloudstack on the device.");
}
}
}
} else {
// check if any networks are using this load balancer device
List<NetworkExternalLoadBalancerVO> networks = _networkLBDao.listByLoadBalancerDeviceId(lbDeviceId);
if ((networks != null) && !networks.isEmpty()) {
throw new CloudRuntimeException("Delete can not be done as there are networks using this load balancer device ");
}
}
try {