DaanHoogland commented on code in PR #8488: URL: https://github.com/apache/cloudstack/pull/8488#discussion_r1447506058
########## server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java: ########## @@ -695,9 +695,16 @@ private void checkUnmanagedNicIpAndNetworkForImport(String instanceName, Unmanag } // If network is non L2, IP v4 is assigned and not set to auto-assign, check it is available for network if (!network.getGuestType().equals(Network.GuestType.L2) && ipAddresses != null && StringUtils.isNotEmpty(ipAddresses.getIp4Address()) && !ipAddresses.getIp4Address().equals("auto")) { - Set<Long> ips = networkModel.getAvailableIps(network, ipAddresses.getIp4Address()); - if (CollectionUtils.isEmpty(ips) || !ips.contains(NetUtils.ip2Long(ipAddresses.getIp4Address()))) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("IP address %s for NIC(ID: %s) is not available in network(ID: %s)", ipAddresses.getIp4Address(), nic.getNicId(), network.getUuid())); + List<String> usedIps = networkModel.getUsedIpsInNetwork(network); + if (LOGGER.isDebugEnabled() && usedIps != null) { + String s = usedIps.stream().collect(Collectors.joining(", ")); + LOGGER.debug(String.format("available IPs for network(ID: %s) are [%s]",network.getUuid(), s)); + } + for (String usedIp : usedIps) { + // only half witted support for ipv6 here :( + if (usedIp.equals(ipAddresses.getIp4Address()) || usedIp.equals(ipAddresses.getIp6Address())) { Review Comment: splitting out as dragons be there -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org