Package com.cloud.agent.manager.authn

Examples of com.cloud.agent.manager.authn.AgentAuthnException


            final Host.Type type) throws AgentAuthnException {

        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
          s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
          throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
          zone = _zoneDao.findByName(zoneToken);
          if(zone == null){
              try {
                  long zoneId = Long.parseLong(zoneToken);
                  zone = _zoneDao.findById(zoneId);
              if (zone == null) {
                throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
              } catch (NumberFormatException nfe) {
                  throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
          }
        }
      if(s_logger.isDebugEnabled()){
        s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
      }
       
        long zoneId = zone.getId();
        DcDetailVO maxHostsInZone = _zoneDetailsDao.findDetail(zoneId, ZoneConfig.MaxHosts.key());
        if(maxHostsInZone != null){
          long maxHosts = new Long(maxHostsInZone.getValue()).longValue();
          long currentCountOfHosts = _hostDao.countRoutingHostsByDataCenter(zoneId);
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Number of hosts in Zone:"+ currentCountOfHosts + ", max hosts limit: "+ maxHosts);
          }
          if(currentCountOfHosts >= maxHosts){
            throw new AgentAuthnException("Number of running Routing hosts in the Zone:"+ zone.getName() +" is already at the max limit:"+maxHosts+", cannot start one more host");
          }
        }
       
        HostPodVO pod = null;
       
      if(startup.getPrivateIpAddress() == null){
           s_logger.warn("No private IP address passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No private IP address passed in for the agent, cannot not find pod for agent");
      }
     
      if(startup.getPrivateNetmask() == null){
           s_logger.warn("No netmask passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No netmask passed in for the agent, cannot not find pod for agent");
      }
             
        if(host.getPodId() != null){
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Pod is already created for this agent, looks like agent is reconnecting...");
          }
          pod = _podDao.findById(host.getPodId());
          if(!checkCIDR(type, pod, startup.getPrivateIpAddress(),
          startup.getPrivateNetmask())){
            pod = null;
              if(s_logger.isDebugEnabled()){
                s_logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: "+host.getPodId());
              }           
          }else{
            updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          }
        }
       
        if(pod == null){
        if(s_logger.isDebugEnabled()){
          s_logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in ");
        }
       
          //deduce pod
        boolean podFound = false;
          List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
      for (HostPodVO hostPod : podsInZone) {
        if (checkCIDR(type, hostPod, startup.getPrivateIpAddress(),
            startup.getPrivateNetmask())) {
          pod = hostPod;
         
          //found the default POD having the same subnet.
          updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          podFound = true;
          break;
        }
      }

       
          if (!podFound) {
            if(s_logger.isDebugEnabled()){
              s_logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in ");
            }
           
            if(startup.getGatewayIpAddress() == null){
                 s_logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
              throw new AgentAuthnException("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
            }
            //auto-create a new pod, since pod matching the agent's ip is not found
            String podName = "POD-"+ (podsInZone.size()+1);
            try{
              String gateway = startup.getGatewayIpAddress();
View Full Code Here


            final Host.Type type) throws AgentAuthnException {
   
        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
            s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
            throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
            zone = _zoneDao.findByName(zoneToken);
            if(zone == null){
                try {
                    long zoneId = Long.parseLong(zoneToken);
                    zone = _zoneDao.findById(zoneId);
                    if (zone == null) {
                        throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                    }
                } catch (NumberFormatException nfe) {
                    throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                }
            }
        }
        if(s_logger.isDebugEnabled()){
            s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
View Full Code Here

    protected void updateComputeHost(final HostVO host, final StartupCommand startup, final Host.Type type) throws AgentAuthnException {

        String zoneToken = startup.getDataCenter();
        if (zoneToken == null) {
            s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
            throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }

        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
            zone = _zoneDao.findByName(zoneToken);
            if (zone == null) {
                try {
                    long zoneId = Long.parseLong(zoneToken);
                    zone = _zoneDao.findById(zoneId);
                    if (zone == null) {
                        throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                    }
                } catch (NumberFormatException nfe) {
                    throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                }
            }
        }
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
        }

        long zoneId = zone.getId();
        ResourceDetail maxHostsInZone = _zoneDetailsDao.findDetail(zoneId, ZoneConfig.MaxHosts.key());
        if (maxHostsInZone != null) {
            long maxHosts = new Long(maxHostsInZone.getValue()).longValue();
            long currentCountOfHosts = _hostDao.countRoutingHostsByDataCenter(zoneId);
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Number of hosts in Zone:" + currentCountOfHosts + ", max hosts limit: " + maxHosts);
            }
            if (currentCountOfHosts >= maxHosts) {
                throw new AgentAuthnException("Number of running Routing hosts in the Zone:" + zone.getName() + " is already at the max limit:" + maxHosts +
                    ", cannot start one more host");
            }
        }

        HostPodVO pod = null;

        if (startup.getPrivateIpAddress() == null) {
            s_logger.warn("No private IP address passed in for the agent, cannot not find pod for agent");
            throw new AgentAuthnException("No private IP address passed in for the agent, cannot not find pod for agent");
        }

        if (startup.getPrivateNetmask() == null) {
            s_logger.warn("No netmask passed in for the agent, cannot not find pod for agent");
            throw new AgentAuthnException("No netmask passed in for the agent, cannot not find pod for agent");
        }

        if (host.getPodId() != null) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Pod is already created for this agent, looks like agent is reconnecting...");
            }
            pod = _podDao.findById(host.getPodId());
            if (!checkCIDR(type, pod, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) {
                pod = null;
                if (s_logger.isDebugEnabled()) {
                    s_logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: " + host.getPodId());
                }
            } else {
                updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
            }
        }

        if (pod == null) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in ");
            }

            //deduce pod
            boolean podFound = false;
            List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
            for (HostPodVO hostPod : podsInZone) {
                if (checkCIDR(type, hostPod, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) {
                    pod = hostPod;

                    //found the default POD having the same subnet.
                    updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
                    podFound = true;
                    break;
                }
            }

            if (!podFound) {
                if (s_logger.isDebugEnabled()) {
                    s_logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in ");
                }

                if (startup.getGatewayIpAddress() == null) {
                    s_logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
                    throw new AgentAuthnException("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
                }
                //auto-create a new pod, since pod matching the agent's ip is not found
                String podName = "POD-" + (podsInZone.size() + 1);
                try {
                    String gateway = startup.getGatewayIpAddress();
View Full Code Here

    protected void updateSecondaryHost(final HostVO host, final StartupStorageCommand startup, final Host.Type type) throws AgentAuthnException {

        String zoneToken = startup.getDataCenter();
        if (zoneToken == null) {
            s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
            throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }

        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
            zone = _zoneDao.findByName(zoneToken);
            if (zone == null) {
                try {
                    long zoneId = Long.parseLong(zoneToken);
                    zone = _zoneDao.findById(zoneId);
                    if (zone == null) {
                        throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                    }
                } catch (NumberFormatException nfe) {
                    throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                }
            }
        }
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
View Full Code Here

            final Host.Type type) throws AgentAuthnException {

        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
          s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
          throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
          zone = _zoneDao.findByName(zoneToken);
          if(zone == null){
              try {
                  long zoneId = Long.parseLong(zoneToken);
                  zone = _zoneDao.findById(zoneId);
              if (zone == null) {
                throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
              } catch (NumberFormatException nfe) {
                  throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
          }
        }
      if(s_logger.isDebugEnabled()){
        s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
      }
       
        long zoneId = zone.getId();
        DcDetailVO maxHostsInZone = _zoneDetailsDao.findDetail(zoneId, ZoneConfig.MaxHosts.key());
        if(maxHostsInZone != null){
          long maxHosts = new Long(maxHostsInZone.getValue()).longValue();
          long currentCountOfHosts = _hostDao.countRoutingHostsByDataCenter(zoneId);
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Number of hosts in Zone:"+ currentCountOfHosts + ", max hosts limit: "+ maxHosts);
          }
          if(currentCountOfHosts >= maxHosts){
            throw new AgentAuthnException("Number of running Routing hosts in the Zone:"+ zone.getName() +" is already at the max limit:"+maxHosts+", cannot start one more host");
          }
        }
       
        HostPodVO pod = null;
       
      if(startup.getPrivateIpAddress() == null){
           s_logger.warn("No private IP address passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No private IP address passed in for the agent, cannot not find pod for agent");
      }
     
      if(startup.getPrivateNetmask() == null){
           s_logger.warn("No netmask passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No netmask passed in for the agent, cannot not find pod for agent");
      }
             
        if(host.getPodId() != null){
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Pod is already created for this agent, looks like agent is reconnecting...");
          }
          pod = _podDao.findById(host.getPodId());
          if(!checkCIDR(type, pod, startup.getPrivateIpAddress(),
          startup.getPrivateNetmask())){
            pod = null;
              if(s_logger.isDebugEnabled()){
                s_logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: "+host.getPodId());
              }           
          }else{
            updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          }
        }
       
        if(pod == null){
        if(s_logger.isDebugEnabled()){
          s_logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in ");
        }
       
          //deduce pod
        boolean podFound = false;
          List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
      for (HostPodVO hostPod : podsInZone) {
        if (checkCIDR(type, hostPod, startup.getPrivateIpAddress(),
            startup.getPrivateNetmask())) {
          pod = hostPod;
         
          //found the default POD having the same subnet.
          updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          podFound = true;
          break;
        }
      }

       
          if (!podFound) {
            if(s_logger.isDebugEnabled()){
              s_logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in ");
            }
           
            if(startup.getGatewayIpAddress() == null){
                 s_logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
              throw new AgentAuthnException("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
            }
            //auto-create a new pod, since pod matching the agent's ip is not found
            String podName = "POD-"+ (podsInZone.size()+1);
            try{
              String gateway = startup.getGatewayIpAddress();
View Full Code Here

            final Host.Type type) throws AgentAuthnException {
   
        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
            s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
            throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
            zone = _zoneDao.findByName(zoneToken);
            if(zone == null){
                try {
                    long zoneId = Long.parseLong(zoneToken);
                    zone = _zoneDao.findById(zoneId);
                    if (zone == null) {
                        throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                    }
                } catch (NumberFormatException nfe) {
                    throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                }
            }
        }
        if(s_logger.isDebugEnabled()){
            s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
View Full Code Here

            final Host.Type type) throws AgentAuthnException {

        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
          s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
          throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
          zone = _zoneDao.findByName(zoneToken);
          if(zone == null){
              try {
                  long zoneId = Long.parseLong(zoneToken);
                  zone = _zoneDao.findById(zoneId);
              if (zone == null) {
                throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
              } catch (NumberFormatException nfe) {
                  throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
              }
          }
        }
      if(s_logger.isDebugEnabled()){
        s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
      }
       
        long zoneId = zone.getId();
        ResourceDetail maxHostsInZone = _zoneDetailsDao.findDetail(zoneId, ZoneConfig.MaxHosts.key());
        if(maxHostsInZone != null){
          long maxHosts = new Long(maxHostsInZone.getValue()).longValue();
          long currentCountOfHosts = _hostDao.countRoutingHostsByDataCenter(zoneId);
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Number of hosts in Zone:"+ currentCountOfHosts + ", max hosts limit: "+ maxHosts);
          }
          if(currentCountOfHosts >= maxHosts){
            throw new AgentAuthnException("Number of running Routing hosts in the Zone:"+ zone.getName() +" is already at the max limit:"+maxHosts+", cannot start one more host");
          }
        }
       
        HostPodVO pod = null;
       
      if(startup.getPrivateIpAddress() == null){
           s_logger.warn("No private IP address passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No private IP address passed in for the agent, cannot not find pod for agent");
      }
     
      if(startup.getPrivateNetmask() == null){
           s_logger.warn("No netmask passed in for the agent, cannot not find pod for agent");
        throw new AgentAuthnException("No netmask passed in for the agent, cannot not find pod for agent");
      }
             
        if(host.getPodId() != null){
          if(s_logger.isDebugEnabled()){
            s_logger.debug("Pod is already created for this agent, looks like agent is reconnecting...");
          }
          pod = _podDao.findById(host.getPodId());
          if(!checkCIDR(type, pod, startup.getPrivateIpAddress(),
          startup.getPrivateNetmask())){
            pod = null;
              if(s_logger.isDebugEnabled()){
                s_logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: "+host.getPodId());
              }           
          }else{
            updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          }
        }
       
        if(pod == null){
        if(s_logger.isDebugEnabled()){
          s_logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in ");
        }
       
          //deduce pod
        boolean podFound = false;
          List<HostPodVO> podsInZone = _podDao.listByDataCenterId(zoneId);
      for (HostPodVO hostPod : podsInZone) {
        if (checkCIDR(type, hostPod, startup.getPrivateIpAddress(),
            startup.getPrivateNetmask())) {
          pod = hostPod;
         
          //found the default POD having the same subnet.
          updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask());
          podFound = true;
          break;
        }
      }

       
          if (!podFound) {
            if(s_logger.isDebugEnabled()){
              s_logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in ");
            }
           
            if(startup.getGatewayIpAddress() == null){
                 s_logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
              throw new AgentAuthnException("No Gateway IP address passed in for the agent, cannot create a new pod for the agent");
            }
            //auto-create a new pod, since pod matching the agent's ip is not found
            String podName = "POD-"+ (podsInZone.size()+1);
            try{
              String gateway = startup.getGatewayIpAddress();
View Full Code Here

            final Host.Type type) throws AgentAuthnException {
   
        String zoneToken = startup.getDataCenter();
        if(zoneToken == null){
            s_logger.warn("No Zone Token passed in, cannot not find zone for the agent");
            throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent");
        }
       
        DataCenterVO zone = _zoneDao.findByToken(zoneToken);
        if (zone == null) {
            zone = _zoneDao.findByName(zoneToken);
            if(zone == null){
                try {
                    long zoneId = Long.parseLong(zoneToken);
                    zone = _zoneDao.findById(zoneId);
                    if (zone == null) {
                        throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                    }
                } catch (NumberFormatException nfe) {
                    throw new AgentAuthnException("Could not find zone for agent with token " + zoneToken);
                }
            }
        }
        if(s_logger.isDebugEnabled()){
            s_logger.debug("Successfully loaded the DataCenter from the zone token passed in ");
View Full Code Here

TOP

Related Classes of com.cloud.agent.manager.authn.AgentAuthnException

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.