You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LOGGER.debug(String.format("available IPs for network(ID: %s) are [%s]",network.getUuid(), s));
702
702
}
703
-
if (CollectionUtils.isEmpty(ips)) {
704
-
thrownewServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Cannot assign IP address %s to NIC(ID: %s) as no available IP addresses are found for network(ID: %s)", ipAddresses.getIp4Address(), nic.getNicId(), network.getUuid()));
705
-
}
706
-
if (!ips.contains(NetUtils.ip2Long(ipAddresses.getIp4Address()))) {
707
-
thrownewServerApiException(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()));
703
+
for (StringusedIp : usedIps) {
704
+
// only half witted support for ipv6 here :(
705
+
if (usedIp.equals(ipAddresses.getIp4Address()) || usedIp.equals(ipAddresses.getIp6Address())) {
706
+
thrownewServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, String.format("Cannot assign IP address %s to NIC(ID: %s) as it is in use in network(ID: %s)", ipAddresses.getIp4Address(), nic.getNicId(), network.getUuid()));
0 commit comments