Package com.cloud.utils.exception

Examples of com.cloud.utils.exception.ExecutionException


        vlans.add(vlan);
      }

      return vlans;
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here


  private void login() throws ExecutionException {
    try {     
      _interfaces = new Interfaces();
     
      if (!_interfaces.initialize(_ip, _username, _password)) {
        throw new ExecutionException("Failed to log in to BigIp appliance");
      }

      // iControl.Interfaces.initialize always return true so make a call to force connect to F5 to validate credentials
      _interfaces.getSystemSystemInfo().get_system_information();

      _virtualServerApi = _interfaces.getLocalLBVirtualServer();
      _loadbalancerApi = _interfaces.getLocalLBPool();   
      _nodeApi = _interfaces.getLocalLBNodeAddress();
      _vlanApi = _interfaces.getNetworkingVLAN();
      _selfIpApi = _interfaces.getNetworkingSelfIP();
      _routeDomainApi = _interfaces.getNetworkingRouteDomain();
      _configSyncApi = _interfaces.getSystemConfigSync();
      _persistenceProfileApi = _interfaces.getLocalLBProfilePersistence();
    } catch (Exception e) {
        throw new ExecutionException("Failed to log in to BigIp appliance due to " + e.getMessage());
    }
  }
View Full Code Here

      if (!virtualServerExists(virtualServerName)) {
        s_logger.debug("Adding virtual server " + virtualServerName);
        _virtualServerApi.create(genVirtualServerDefinition(virtualServerName, protocol, srcIp, srcPort), new String[]{"255.255.255.255"}, genVirtualServerResource(virtualServerName), genVirtualServerProfile(protocol));
        _virtualServerApi.set_snat_automap(genStringArray(virtualServerName));
        if (!virtualServerExists(virtualServerName)) {
          throw new ExecutionException("Failed to add virtual server " + virtualServerName);
        }
      }

            if ((stickyPolicies != null) && (stickyPolicies.length > 0) && (stickyPolicies[0] != null)){
                StickinessPolicyTO stickinessPolicy = stickyPolicies[0];
                if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName())) {

                    String[] profileNames = genStringArray("Cookie-profile-" + virtualServerName);
                    if (!persistenceProfileExists(profileNames[0])) {
                        LocalLBPersistenceMode[] lbPersistenceMode = new iControl.LocalLBPersistenceMode[1];
                        lbPersistenceMode[0] = iControl.LocalLBPersistenceMode.PERSISTENCE_MODE_COOKIE;
                        _persistenceProfileApi.create(profileNames, lbPersistenceMode);
                        _virtualServerApi.add_persistence_profile(genStringArray(virtualServerName), genPersistenceProfile(profileNames[0]));
                    }

                    List<Pair<String, String>> paramsList = stickinessPolicy.getParams();
                    for(Pair<String,String> param : paramsList) {
                        if ("holdtime".equalsIgnoreCase(param.first())) {
                            long timeout = 180; //F5 default
                            if (param.second() != null) {
                                timeout = Long.parseLong(param.second());
                            }
                            LocalLBProfileULong[] cookieTimeout =  new LocalLBProfileULong[1];
                            cookieTimeout[0] = new LocalLBProfileULong();
                            cookieTimeout[0].setValue(timeout);
                            _persistenceProfileApi.set_cookie_expiration(profileNames, cookieTimeout);
                        }
                    }
                }
            } else {
                _virtualServerApi.remove_all_persistence_profiles(genStringArray(virtualServerName));
            }

    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

        // Delete the virtual server
        s_logger.debug("Deleting virtual server " + virtualServerName);
        _virtualServerApi.delete_virtual_server(genStringArray(virtualServerName));

        if (getVirtualServers().contains(virtualServerName)) {
          throw new ExecutionException("Failed to delete virtual server " + virtualServerName);
       

        // Delete the default pool
        deletePool(virtualServerName)
      }
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

        virtualServers.add(virtualServer);
      }

      return virtualServers;
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

                    return true;
                }
            }
            return false;
        } catch (RemoteException e) {
            throw new ExecutionException(e.getMessage());
        }
    }
View Full Code Here

        s_logger.debug("Adding pool for virtual server " + virtualServerName + " with algorithm " + algorithm);
        _loadbalancerApi.create(genStringArray(virtualServerName), genLbMethod(algorithm), genEmptyMembersArray());

        if (!poolExists(virtualServerName)) {
          throw new ExecutionException("Failed to create new pool for virtual server " + virtualServerName);
        }             
      }
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

      if (poolExists(virtualServerName) && getMembers(virtualServerName).size() == 0) {
        s_logger.debug("Deleting pool for virtual server " + virtualServerName);
        _loadbalancerApi.delete_pool(genStringArray(virtualServerName));
       
        if (poolExists(virtualServerName)) {
          throw new ExecutionException("Failed to delete pool for virtual server " + virtualServerName);
        }
      }
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  } 
View Full Code Here

      if (poolExists(virtualServerName) && !memberExists(virtualServerName, memberIdentifier)) {
        s_logger.debug("Adding member " + memberIdentifier + " into pool for virtual server " + virtualServerName);
        _loadbalancerApi.add_member(genStringArray(virtualServerName), genMembers(destIp, destPort));

        if (!memberExists(virtualServerName, memberIdentifier)) {
          throw new ExecutionException("Failed to add new member " + memberIdentifier + " into pool for virtual server " + virtualServerName);
        }
      }
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

      if (lbPools.contains(virtualServerName) && memberExists(virtualServerName, memberIdentifier)) {
        s_logger.debug("Deleting member "  + memberIdentifier + " from pool for virtual server " + virtualServerName);
        _loadbalancerApi.remove_member(genStringArray(virtualServerName), genMembers(destIp, destPort));

        if (memberExists(virtualServerName, memberIdentifier)) {
          throw new ExecutionException("Failed to delete member " + memberIdentifier + " from pool for virtual server " + virtualServerName);
        }

        if (nodeExists(destIp)) {
          boolean nodeNeeded = false;
          done:
            for (String poolToCheck : lbPools) {
              for (String memberInPool : getMembers(poolToCheck)) {
                if (getIpAndPort(memberInPool)[0].equals(destIp)) {
                  nodeNeeded = true;
                  break done;
                }
              }   
            }           

          if (!nodeNeeded) {
            s_logger.debug("Deleting node " + destIp);
            _nodeApi.delete_node_address(genStringArray(destIp));

            if (nodeExists(destIp)) {
              throw new ExecutionException("Failed to delete node " + destIp);
            }
          }
        }
      }     
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.cloud.utils.exception.ExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.