Search in sources :

Example 1 with F5BigIpResource

use of com.cloud.network.resource.F5BigIpResource in project cloudstack by apache.

the class F5ExternalLoadBalancerElement method addExternalLoadBalancer.

@Override
@Deprecated
public Host addExternalLoadBalancer(AddExternalLoadBalancerCmd cmd) {
    Long zoneId = cmd.getZoneId();
    DataCenterVO zone = null;
    PhysicalNetworkVO pNetwork = null;
    ExternalLoadBalancerDeviceVO lbDeviceVO = null;
    HostVO lbHost = null;
    zone = _dcDao.findById(zoneId);
    if (zone == null) {
        throw new InvalidParameterValueException("Could not find zone with ID: " + zoneId);
    }
    List<PhysicalNetworkVO> physicalNetworks = _physicalNetworkDao.listByZone(zoneId);
    if ((physicalNetworks == null) || (physicalNetworks.size() > 1)) {
        throw new InvalidParameterValueException("There are no physical networks or multiple physical networks configured in zone with ID: " + zoneId + " to add this device.");
    }
    pNetwork = physicalNetworks.get(0);
    String deviceType = NetworkDevice.F5BigIpLoadBalancer.getName();
    lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, new F5BigIpResource(), false, false, null, null);
    if (lbDeviceVO != null) {
        lbHost = _hostDao.findById(lbDeviceVO.getHostId());
    }
    return lbHost;
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) ExternalLoadBalancerDeviceVO(com.cloud.network.dao.ExternalLoadBalancerDeviceVO) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) F5BigIpResource(com.cloud.network.resource.F5BigIpResource) HostVO(com.cloud.host.HostVO)

Aggregations

DataCenterVO (com.cloud.dc.DataCenterVO)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 HostVO (com.cloud.host.HostVO)1 ExternalLoadBalancerDeviceVO (com.cloud.network.dao.ExternalLoadBalancerDeviceVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 F5BigIpResource (com.cloud.network.resource.F5BigIpResource)1