Ejemplo n.º 1
0
  protected PooledResourceOptions getPoolOptions(IpAddress ipAddress, Instance instance) {
    PooledResourceOptions options = new PooledResourceOptions();
    if (instance != null) {
      String ip = DataAccessor.fieldString(instance, InstanceConstants.FIELD_REQUESTED_IP_ADDRESS);
      if (ip != null) {
        options.setRequestedItem(ip);
      }
    }

    return options;
  }
 protected String getServiceVIP(Service service, String requestedVip) {
   if (service.getKind().equalsIgnoreCase(KIND.LOADBALANCERSERVICE.name())
       || service.getKind().equalsIgnoreCase(KIND.SERVICE.name())
       || service.getKind().equalsIgnoreCase(KIND.DNSSERVICE.name())) {
     Subnet vipSubnet = getServiceVipSubnet(service);
     PooledResourceOptions options = new PooledResourceOptions();
     if (requestedVip != null) {
       options.setRequestedItem(requestedVip);
     }
     PooledResource resource = poolManager.allocateOneResource(vipSubnet, service, options);
     if (resource != null) {
       return resource.getName();
     }
   }
   return null;
 }