Repository navigation
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
GuestNetworkGuru
CLOUDSTACK VERSION
main (4.22)
CONFIGURATION
- Advanced zone
- Network with
SpecifyIpRanges=true - Isolated network type with CIDR (e.g., 10.0.0.0/8 - private address space)
- All IPs in the zone's public pools are already allocated
SUMMARY
GuestNetworkGuru.allocate() incorrectly calls allocateDirectIp() for Isolated networks with SpecifyIpRanges=true. The allocateDirectIp() method is designed for Shared networks only and attempts to allocate IPs from zone-wide VLAN pools. For Isolated networks with SpecifyIpRanges=true, this causes InsufficientAddressCapacityException because Isolated networks should allocate IPs from their own CIDR, not from VLAN pools.
STEPS TO REPRODUCE
- Create an Advanced zone with VLAN ranges configured (e.g., 10.1.1.100-10.1.1.200)
- Create an Isolated network offering with
SpecifyIpRanges=trueand Source NAT service enabled - Create an Isolated network using this offering with CIDR like 10.0.0.0/8
- Deploy a VM in this network when all IPs in the zone's VLAN pools are already allocated
- The VM deployment fails with
InsufficientAddressCapacityException
EXPECTED RESULTS
- For Shared networks with
SpecifyIpRanges=true: IP allocation from VLAN pools usingallocateDirectIp() - For Isolated networks with
SpecifyIpRanges=true: IP allocation from the network's CIDR usingacquireGuestIpAddress()
The correct behavior should be:
- Shared networks → use public IP pool from VLAN ranges
- Isolated networks → use network's own CIDR for IP allocation
ACTUAL RESULTS
GuestNetworkGuru.allocate() at line 445-446:
if (network.getSpecifyIpRanges()) {
_ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIPv4(), null);
}This unconditionally calls allocateDirectIp() for ANY network with SpecifyIpRanges=true, regardless of network type.
The stack trace shows:
WARN [c.c.n.IpAddressManagerImpl] Unable to get ip address in zone id=1, network id=295
ERROR [c.c.v.UserVmManagerImpl] error during resource reservation and allocation com.cloud.exception.InsufficientAddressCapacityException: Insufficient address capacityScope=interface com.cloud.dc.DataCenter; id=1
ROOT CAUSE
GuestNetworkGuru.allocate() does not check the network type (getGuestType()) before calling allocateDirectIp(). The method is only valid for Shared networks (GuestType.Shared), but it's being called for Isolated networks as well.
The fix should add a network type check:
if (network.getSpecifyIpRanges()) {
if (network.getGuestType() == GuestType.Shared) {
_ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIPv4(), null);
} else {
// For Isolated/L2 networks, use acquireGuestIpAddress() to get IP from network CIDR
}
}FILES AFFECTED
server/src/main/java/com/cloud/network/guru/GuestNetworkGuru.java- lines 445-446
ps:
actually I'm not sure for root cause. it's a little complicated
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDev In Progress
Activity
weizhouapache commentedon Mar 9, 2026
@rybakovanton-metta
it seem to be a bug
however, I think it should be set to false, or ignored if it is set to true for isolated networks.
rybakovanton-metta commentedon Mar 9, 2026
yes, it can be. I'm not pretty sure, cause have no a good knowledge of cloudstack and use only one setup
weizhouapache commentedon Mar 9, 2026
@rybakovanton-metta
in another word, the property should make no affection on isolated network.
as a quick workaround, you can create a new network offering, or update db manually.
can you explain what want to achieve ?
rybakovanton-metta commentedon Mar 9, 2026
sorry forgot to add logs.
actually it was one of colleagues and he can't explain it really. but in logs I saw stacktrace because cloudstack cant allocate the address and this is why I started research. to my mind it should verify resource and not run the flow with request for resources which not available and even it happened not to generate stack trace but handle the error and say - hey friend, you have no ip address available in you public network for this zone.
yes, this is true, available ip addresses ran out, at that moment.
weizhouapache commentedon Mar 13, 2026
@rybakovanton-metta
from the source code, it seems impossible to create isolate network offering in the reproduce step 2:
Create an Isolated network offering with SpecifyIpRanges=true and Source NAT service enabledcloudstack/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
Lines 7118 to 7131 in faaf766
weizhouapache commentedon May 21, 2026
I tried to create a network offering in step 2:
Create an Isolated network offering with SpecifyIpRanges=true and Source NAT service enabled, and got the error belowweizhouapache commentedon May 22, 2026
from the error log , it seems the network offering with id=11 (DefaultIsolatedNetworkOffering) is used.
2026-03-09 10:15:50,496 DEBUG [o.a.c.e.o.NetworkOrchestrator] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Allocating nic for vm VM instance {"id":530,"instanceName":"i-9-530-VM","state":"Stopped","type":"User","uuid":"4fd2b3e9-e94e-47e3-8b01-064a6ba6ae5a"} in network Network {"id": 295, "name": "test-john-net", "uuid": "684fff81-853b-4f98-b0a5-65dd69577834", "networkofferingid": 11} with requested profile NicProfile {"broadcastUri":null,"deviceId":null,"iPv4Address":null,"id":0,"reservationId":null,"uuid":null,"vmId":0}I will test it
github-actions commentedon Aug 14, 2026
🎯 Triage report
GuestNetworkGuru.allocate()callsallocateDirectIp()(intended for Shared networks) for Isolated networks configured withSpecifyIpRanges=true, causingInsufficientAddressCapacityExceptionwhen the zone's VLAN pools are exhausted even though the isolated network's own CIDR still has capacity. Issue includes detailed repro steps, stack trace, and a proposed code fix, though the reporter admits the root cause analysis may be incomplete.📊 Assessment
GuestNetworkGuru)🔗 Similar issues
No duplicate or closely related open issues found.
💡 Notes and suggestions
GuestType.Shared), consistent with the reporter's proposed fix — worth confirming there isn't a case where Isolated +SpecifyIpRangeslegitimately needsallocateDirectIp().SpecifyIpRanges=trueafter exhausting VLAN pool IPs, verify IP is now sourced from the network's CIDR viaacquireGuestIpAddress().Add this agentic workflows to your repo
To install this agentic workflow, run
network: do not use direct IP allocation for isolated networks