Package com.cloud.exception

Examples of com.cloud.exception.InsufficientAddressCapacityException


    @Override
    public String getNextAvailableMacAddressInNetwork(long networkId) throws InsufficientAddressCapacityException {
        String mac = _networksDao.getNextAvailableMacAddress(networkId);
        if (mac == null) {
            throw new InsufficientAddressCapacityException("Unable to create another mac address", Network.class, networkId);
        }
        return mac;
    }
View Full Code Here


            }
        }

        String ip = _dcDao.allocateLinkLocalIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());
        if (ip == null) {
            throw new InsufficientAddressCapacityException("Insufficient link local address capacity", DataCenter.class, dest.getDataCenter().getId());
        }
        nic.setIp4Address(ip);
        nic.setMacAddress(NetUtils.long2Mac(NetUtils.ip2Long(ip) | (14l << 40)));
        nic.setNetmask("255.255.0.0");
        nic.setFormat(AddressFormat.Ip4);
View Full Code Here

    @Override
    public String getNextAvailableMacAddressInNetwork(long networkId) throws InsufficientAddressCapacityException {
        String mac = _networksDao.getNextAvailableMacAddress(networkId);
        if (mac == null) {
            throw new InsufficientAddressCapacityException("Unable to create another mac address", Network.class, networkId);           
        }
        return mac;
    }
View Full Code Here

        nic.setStrategy(ReservationStrategy.Create);

        if (nic.getMacAddress() == null) {
            nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
            if (nic.getMacAddress() == null) {
                throw new InsufficientAddressCapacityException("Unable to allocate more mac addresses", Network.class, network.getId());
            }
        }

        return nic;
    }
View Full Code Here

            InsufficientAddressCapacityException {
        Pod pod = dest.getPod();
       
        Pair<String, Long> ip = _dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());
        if (ip == null) {
            throw new InsufficientAddressCapacityException("Unable to get a management ip address", Pod.class, pod.getId());
        }
       
        nic.setIp4Address(ip.first());
        nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.second())));
        nic.setGateway(pod.getGateway());
View Full Code Here

        nic.setStrategy(ReservationStrategy.Start);

        if (nic.getMacAddress() == null) {
            nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
            if (nic.getMacAddress() == null) {
                throw new InsufficientAddressCapacityException("Unable to allocate more mac addresses", Network.class, network.getId());
            }
        }

        return nic;
    }
View Full Code Here

    @Override
    public String getNextAvailableMacAddressInNetwork(long networkId) throws InsufficientAddressCapacityException {
        String mac = _networksDao.getNextAvailableMacAddress(networkId);
        if (mac == null) {
            throw new InsufficientAddressCapacityException("Unable to create another mac address", Network.class, networkId);           
        }
        return mac;
    }
View Full Code Here

      }
      String ip = null;
      Vlan ipVlan = null;
      if (requestedIp6 == null) {
        if (!_networkModel.isIP6AddressAvailableInNetwork(networkId)) {
          throw new InsufficientAddressCapacityException("There is no more address available in the network " + network.getName(), DataCenter.class, network.getDataCenterId());
        }
        for (Vlan vlan : vlans) {
          if (!_networkModel.isIP6AddressAvailableInVlan(vlan.getId())) {
            continue;
          }
          ip = NetUtils.getIp6FromRange(vlan.getIp6Range());
          int count = 0;
          while (_ipv6Dao.findByNetworkIdAndIp(networkId, ip) != null) {
            ip = NetUtils.getNextIp6InRange(ip, vlan.getIp6Range());
            count ++;
            // It's an arbitrate number to prevent the infinite loop
            if (count > _ipv6RetryMax) {
              ip = null;
              break;
            }
          }
          if (ip != null) {
            ipVlan = vlan;
          }
        }
        if (ip == null) {
          throw new InsufficientAddressCapacityException("Cannot find a usable IP in the network " + network.getName() + " after " + _ipv6RetryMax + "(network.ipv6.search.retry.max) times retry!",
                DataCenter.class, network.getDataCenterId());
        }
      } else {
        for (Vlan vlan : vlans) {
          if (NetUtils.isIp6InRange(requestedIp6, vlan.getIp6Range())) {
View Full Code Here

    @Override
    public String getNextAvailableMacAddressInNetwork(long networkId) throws InsufficientAddressCapacityException {
        String mac = _networksDao.getNextAvailableMacAddress(networkId);
        if (mac == null) {
            throw new InsufficientAddressCapacityException("Unable to create another mac address", Network.class, networkId);
        }
        return mac;
    }
View Full Code Here

            }
        }

        String ip = _dcDao.allocateLinkLocalIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());
        if (ip == null) {
            throw new InsufficientAddressCapacityException("Insufficient link local address capacity", DataCenter.class, dest.getDataCenter().getId());
        }
        nic.setIp4Address(ip);
        nic.setMacAddress(NetUtils.long2Mac(NetUtils.ip2Long(ip) | (14l << 40)));
        nic.setNetmask("255.255.0.0");
        nic.setFormat(AddressFormat.Ip4);
View Full Code Here

TOP

Related Classes of com.cloud.exception.InsufficientAddressCapacityException

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.