Skip to content

Bug: GuestNetworkGuru.allocate() incorrectly calls allocateDirectIp() for Isolated networks with SpecifyIpRanges=true #12772

In review

Description

@rybakovanton-metta
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
  1. Create an Advanced zone with VLAN ranges configured (e.g., 10.1.1.100-10.1.1.200)
  2. Create an Isolated network offering with SpecifyIpRanges=true and Source NAT service enabled
  3. Create an Isolated network using this offering with CIDR like 10.0.0.0/8
  4. Deploy a VM in this network when all IPs in the zone's VLAN pools are already allocated
  5. The VM deployment fails with InsufficientAddressCapacityException
EXPECTED RESULTS
  • For Shared networks with SpecifyIpRanges=true: IP allocation from VLAN pools using allocateDirectIp()
  • For Isolated networks with SpecifyIpRanges=true: IP allocation from the network's CIDR using acquireGuestIpAddress()

The correct behavior should be:

  1. Shared networks → use public IP pool from VLAN ranges
  2. 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

Activity

  1. weizhouapache commented on Mar 9, 2026

    @weizhouapache
    Member

    @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.

                 String guestIp = null;
    -            if (network.getSpecifyIpRanges()) {
    +            if (GuestType.Shared.equals(network.getGuestType()) && network.getSpecifyIpRanges()) {
                     _ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIPv4(), null);
                 } else {
                     if (isGateway) {
    
  2. self-assigned this
    on Mar 9, 2026
  3. rybakovanton-metta commented on Mar 9, 2026

    @rybakovanton-metta
    Author

    yes, it can be. I'm not pretty sure, cause have no a good knowledge of cloudstack and use only one setup

  4. weizhouapache commented on Mar 9, 2026

    @weizhouapache
    Member

    yes, it can be. I'm not pretty sure, cause have no a good knowledge of cloudstack and use only one setup

    @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 ?

  5. rybakovanton-metta commented on Mar 9, 2026

    @rybakovanton-metta
    Author

    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.

    2026-03-09 10:15:50,462 DEBUG [c.c.a.ApiServer] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) CIDRs from which account 'Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}]' is allowed to perform API calls: 0.0.0.0/0,::/0
    2026-03-09 10:15:50,463 INFO  [o.a.c.a.DynamicRoleBasedAPIAccessChecker] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Account for user id d14c8fb4-d9b6-422e-863a-d3125bbcd13e is Root Admin or Domain Admin, all APIs are allowed.
    2026-03-09 10:15:50,466 DEBUG [c.c.u.AccountManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Account [Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}]] has access to resource.
    2026-03-09 10:15:50,466 DEBUG [c.c.u.AccountManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Account [Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}]] has access to resource.
    2026-03-09 10:15:50,472 DEBUG [o.a.c.u.UserDataManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Null/empty base64 encoded user data set
    2026-03-09 10:15:50,473 DEBUG [c.c.u.AccountManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Access granted to Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}] to Service offering {"id":2,"name":"Medium Instance","uuid":"8e41f782-6ec1-42a3-88f1-6d7267821704"}. by AffinityGroupAccessChecker
    2026-03-09 10:15:50,473 DEBUG [c.c.u.AccountManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Access granted to Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}] to null by AffinityGroupAccessChecker
    2026-03-09 10:15:50,474 INFO  [c.c.n.NetworkModelImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Checking permission for account Account [{"accountName":"MY-NETWORK","id":9,"uuid":"efdee525-f2d4-46ff-87ad-391ec7c20827"}] on network Network {"id": 295, "name": "test-john-net", "uuid": "684fff81-853b-4f98-b0a5-65dd69577834", "networkofferingid": 11}
    2026-03-09 10:15:50,483 DEBUG [o.a.c.u.UserDataManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Null/empty base64 encoded user data set
    2026-03-09 10:15:50,484 DEBUG [c.c.n.NetworkModelImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Service SecurityGroup is not supported in the network Network {"id": 295, "name": "test-john-net", "uuid": "684fff81-853b-4f98-b0a5-65dd69577834", "networkofferingid": 11}
    2026-03-09 10:15:50,490 DEBUG [c.c.v.UserVmManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Allocating in the DB for vm
    2026-03-09 10:15:50,494 INFO  [c.c.v.ClusteredVirtualMachineManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) allocating virtual machine from template: Template {"format":"RAW","id":234,"name":"Ubuntu Server 24.04 2025.09.09","uniqueName":"234-2-8f63d045-c3fd-3a0a-a70c-260ffee0b61f","uuid":"4d3ecfdd-8935-4251-89bd-95f238b343d9"} with hostname: i-9-530-VM and 1 networks
    2026-03-09 10:15:50,494 DEBUG [c.c.v.ClusteredVirtualMachineManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Allocating entries for VM: VM instance {"id":530,"instanceName":"i-9-530-VM","state":"Stopped","type":"User","uuid":"4fd2b3e9-e94e-47e3-8b01-064a6ba6ae5a"}
    2026-03-09 10:15:50,495 DEBUG [c.c.v.ClusteredVirtualMachineManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Allocating nics for VM instance {"id":530,"instanceName":"i-9-530-VM","state":"Stopped","type":"User","uuid":"4fd2b3e9-e94e-47e3-8b01-064a6ba6ae5a"}
    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}
    2026-03-09 10:15:50,497 WARN  [c.c.n.IpAddressManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Unable to get ip address in  zone id=1, network id=295
    2026-03-09 10:15:50,498 DEBUG [c.c.u.d.T.Transaction] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) Rolling back the transaction: Time = 1 Name =  qtp478489615-48627; called by -TransactionLegacy.rollback:905-TransactionLegacy.removeUpTo:848-TransactionLegacy.close:672-Transaction.execute:36-IpAddressManagerImpl.allocateDirectIp:2378-GuestNetworkGuru.allocate:446-NetworkOrchestrator.checkForRaceAndAllocateNic:1087-NetworkOrchestrator.allocateNic:1148-NetworkOrchestrator.addRequestedNicToNicListWithDeviceNumberAndRetrieveDefaultDevice:925-NetworkOrchestrator.allocate:898-VirtualMachineManagerImpl.allocate:569-CloudOrchestrator.createVirtualMachine:274
    2026-03-09 10:15:50,500 DEBUG [c.c.c.CapacityManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) VM instance {"id":530,"instanceName":"i-9-530-VM","state":"Error","type":"User","uuid":"4fd2b3e9-e94e-47e3-8b01-064a6ba6ae5a"} state transited from [Stopped] to [Error] with event [OperationFailedToError]. VM's original host: null, new host: null, host before state transition: null
    2026-03-09 10:15:50,501 ERROR [c.c.v.UserVmManagerImpl] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) error during resource reservation and allocation com.cloud.exception.InsufficientAddressCapacityException: Insufficient address capacityScope=interface com.cloud.dc.DataCenter; id=1
    	at com.cloud.network.IpAddressManagerImpl.listAvailablePublicIps(IpAddressManagerImpl.java:1070)
    	at com.cloud.network.IpAddressManagerImpl.fetchNewPublicIp(IpAddressManagerImpl.java:920)
    	at com.cloud.network.IpAddressManagerImpl.fetchNewPublicIp(IpAddressManagerImpl.java:912)
    	at com.cloud.network.IpAddressManagerImpl.assignPublicIpAddress(IpAddressManagerImpl.java:880)
    	at com.cloud.network.IpAddressManagerImpl$10.doInTransactionWithoutResult(IpAddressManagerImpl.java:2398)
    	at com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn.doInTransaction(TransactionCallbackWithExceptionNoReturn.java:25)
    	at com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn.doInTransaction(TransactionCallbackWithExceptionNoReturn.java:21)
    	at com.cloud.utils.db.Transaction.execute(Transaction.java:38)
    	at com.cloud.network.IpAddressManagerImpl.allocateDirectIp(IpAddressManagerImpl.java:2378)
    	at com.cloud.network.guru.GuestNetworkGuru.allocate(GuestNetworkGuru.java:446)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.checkForRaceAndAllocateNic(NetworkOrchestrator.java:1087)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.allocateNic(NetworkOrchestrator.java:1148)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.addRequestedNicToNicListWithDeviceNumberAndRetrieveDefaultDevice(NetworkOrchestrator.java:925)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.allocate(NetworkOrchestrator.java:898)
    	at com.cloud.vm.VirtualMachineManagerImpl.allocate(VirtualMachineManagerImpl.java:569)
    	at org.apache.cloudstack.engine.orchestration.CloudOrchestrator.createVirtualMachine(CloudOrchestrator.java:274)
    	at com.cloud.vm.UserVmManagerImpl.orchestrateVirtualMachineCreate(UserVmManagerImpl.java:4950)
    	at com.cloud.vm.UserVmManagerImpl.commitUserVm(UserVmManagerImpl.java:4908)
    	at com.cloud.vm.UserVmManagerImpl.commitUserVm(UserVmManagerImpl.java:5076)
    	at com.cloud.vm.UserVmManagerImpl.getUncheckedUserVmResource(UserVmManagerImpl.java:4587)
    	at com.cloud.vm.UserVmManagerImpl.getCheckedUserVmResource(UserVmManagerImpl.java:4243)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:4214)
    	at com.cloud.vm.UserVmManagerImpl.createAdvancedVirtualMachine(UserVmManagerImpl.java:3993)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:6484)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:6408)
    	at jdk.internal.reflect.GeneratedMethodAccessor680.invoke(Unknown Source)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    	at jdk.proxy3/jdk.proxy3.$Proxy219.createVirtualMachine(Unknown Source)
    	at org.apache.cloudstack.api.command.user.vm.DeployVMCmd.create(DeployVMCmd.java:139)
    	at com.cloud.api.dispatch.CommandCreationWorker.handle(CommandCreationWorker.java:47)
    	at com.cloud.api.dispatch.DispatchChain.dispatch(DispatchChain.java:37)
    	at com.cloud.api.ApiDispatcher.dispatchCreateCmd(ApiDispatcher.java:95)
    	at com.cloud.api.ApiServer.queueCommand(ApiServer.java:775)
    	at com.cloud.api.ApiServer.handleRequest(ApiServer.java:668)
    	at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:416)
    	at com.cloud.api.ApiServlet$1.run(ApiServlet.java:193)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
    	at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:190)
    	at com.cloud.api.ApiServlet.doPost(ApiServlet.java:149)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
    	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772)
    	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    	at org.eclipse.jetty.server.Server.handle(Server.java:516)
    	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    	at java.base/java.lang.Thread.run(Thread.java:840)
    
    2026-03-09 10:15:50,502 ERROR [c.c.a.ApiServer] (qtp478489615-48627:[ctx-76927a86, ctx-1554197b]) (logid:21cc286d) unhandled exception executing api command: [Ljava.lang.String;@10c74bce com.cloud.utils.exception.CloudRuntimeException: Insufficient address capacity
    	at com.cloud.vm.UserVmManagerImpl.getUncheckedUserVmResource(UserVmManagerImpl.java:4597)
    	at com.cloud.vm.UserVmManagerImpl.getCheckedUserVmResource(UserVmManagerImpl.java:4243)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:4214)
    	at com.cloud.vm.UserVmManagerImpl.createAdvancedVirtualMachine(UserVmManagerImpl.java:3993)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:6484)
    	at com.cloud.vm.UserVmManagerImpl.createVirtualMachine(UserVmManagerImpl.java:6408)
    	at jdk.internal.reflect.GeneratedMethodAccessor680.invoke(Unknown Source)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    	at jdk.proxy3/jdk.proxy3.$Proxy219.createVirtualMachine(Unknown Source)
    	at org.apache.cloudstack.api.command.user.vm.DeployVMCmd.create(DeployVMCmd.java:139)
    	at com.cloud.api.dispatch.CommandCreationWorker.handle(CommandCreationWorker.java:47)
    	at com.cloud.api.dispatch.DispatchChain.dispatch(DispatchChain.java:37)
    	at com.cloud.api.ApiDispatcher.dispatchCreateCmd(ApiDispatcher.java:95)
    	at com.cloud.api.ApiServer.queueCommand(ApiServer.java:775)
    	at com.cloud.api.ApiServer.handleRequest(ApiServer.java:668)
    	at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:416)
    	at com.cloud.api.ApiServlet$1.run(ApiServlet.java:193)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
    	at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
    	at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:190)
    	at com.cloud.api.ApiServlet.doPost(ApiServlet.java:149)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
    	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772)
    	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    	at org.eclipse.jetty.server.Server.handle(Server.java:516)
    	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    	at java.base/java.lang.Thread.run(Thread.java:840)
    Caused by: com.cloud.exception.InsufficientAddressCapacityException: Insufficient address capacityScope=interface com.cloud.dc.DataCenter; id=1
    	at com.cloud.network.IpAddressManagerImpl.listAvailablePublicIps(IpAddressManagerImpl.java:1070)
    	at com.cloud.network.IpAddressManagerImpl.fetchNewPublicIp(IpAddressManagerImpl.java:920)
    	at com.cloud.network.IpAddressManagerImpl.fetchNewPublicIp(IpAddressManagerImpl.java:912)
    	at com.cloud.network.IpAddressManagerImpl.assignPublicIpAddress(IpAddressManagerImpl.java:880)
    	at com.cloud.network.IpAddressManagerImpl$10.doInTransactionWithoutResult(IpAddressManagerImpl.java:2398)
    	at com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn.doInTransaction(TransactionCallbackWithExceptionNoReturn.java:25)
    	at com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn.doInTransaction(TransactionCallbackWithExceptionNoReturn.java:21)
    	at com.cloud.utils.db.Transaction.execute(Transaction.java:38)
    	at com.cloud.network.IpAddressManagerImpl.allocateDirectIp(IpAddressManagerImpl.java:2378)
    	at com.cloud.network.guru.GuestNetworkGuru.allocate(GuestNetworkGuru.java:446)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.checkForRaceAndAllocateNic(NetworkOrchestrator.java:1087)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.allocateNic(NetworkOrchestrator.java:1148)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.addRequestedNicToNicListWithDeviceNumberAndRetrieveDefaultDevice(NetworkOrchestrator.java:925)
    	at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.allocate(NetworkOrchestrator.java:898)
    	at com.cloud.vm.VirtualMachineManagerImpl.allocate(VirtualMachineManagerImpl.java:569)
    	at org.apache.cloudstack.engine.orchestration.CloudOrchestrator.createVirtualMachine(CloudOrchestrator.java:274)
    	at com.cloud.vm.UserVmManagerImpl.orchestrateVirtualMachineCreate(UserVmManagerImpl.java:4950)
    	at com.cloud.vm.UserVmManagerImpl.commitUserVm(UserVmManagerImpl.java:4908)
    	at com.cloud.vm.UserVmManagerImpl.commitUserVm(UserVmManagerImpl.java:5076)
    	at com.cloud.vm.UserVmManagerImpl.getUncheckedUserVmResource(UserVmManagerImpl.java:4587)
    	... 65 more
    
  6. weizhouapache commented on Mar 13, 2026

    @weizhouapache
    Member

    @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 enabled

    // specifyIpRanges should always be true for Shared networks
    // specifyIpRanges can only be true for Isolated networks with no Source
    // Nat service
    if (specifyIpRanges) {
    if (type == GuestType.Isolated) {
    if (serviceProviderMap.containsKey(Service.SourceNat)) {
    throw new InvalidParameterValueException("SpecifyIpRanges can only be true for Shared network offerings and Isolated with no SourceNat service");
    }
    }
    } else {
    if (type == GuestType.Shared) {
    throw new InvalidParameterValueException("SpecifyIpRanges should always be true for Shared network offerings");
    }
    }

  7. added this to the 4.20.4 milestone on May 13, 2026
  8. moved this from Todo to Dev In Progress in Apache CloudStack BugFest - Issueson May 21, 2026
  9. weizhouapache commented on May 21, 2026

    @weizhouapache
    Member

    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 below

    (localcloud) 🐱 > create networkoffering supportedservices=SourceNat,StaticNat specifyipranges=true guestiptype=Isolated name=test traffictype=Guest
    🙈 Error: (HTTP 431, error code 4350) SpecifyIpRanges can only be true for Shared network offerings and Isolated with no SourceNat service
    
  10. weizhouapache commented on May 22, 2026

    @weizhouapache
    Member

    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

  11. github-actions commented on Aug 14, 2026

    @github-actions

    🎯 Triage report

    GuestNetworkGuru.allocate() calls allocateDirectIp() (intended for Shared networks) for Isolated networks configured with SpecifyIpRanges=true, causing InsufficientAddressCapacityException when 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

    Dimension Value Reasoning
    Type type:bug VM deployment failure caused by incorrect IP allocation path selection based on network type
    Component component:networking Guest network IP allocation logic (GuestNetworkGuru)
    Severity Severity:Major Blocks VM deployment entirely in the affected configuration once VLAN pools are exhausted
    Labels type:bug, component:networking, Severity:Major
    Coding agent Needs more info Reporter explicitly states uncertainty about the root cause ("it's a little complicated"); a maintainer is already assigned and discussing the correct fix, so validation/design input is needed before implementation

    🔗 Similar issues

    No duplicate or closely related open issues found.

    💡 Notes and suggestions
    • A maintainer (weizhouapache, assigned) already commented that the check should likely be scoped to Shared networks only (GuestType.Shared), consistent with the reporter's proposed fix — worth confirming there isn't a case where Isolated + SpecifyIpRanges legitimately needs allocateDirectIp().
    • Suggested test coverage: deploy VM in Isolated network with SpecifyIpRanges=true after exhausting VLAN pool IPs, verify IP is now sourced from the network's CIDR via acquireGuestIpAddress().

    Generated by Daily Issue Triage · sonnet50 357.5K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@d7c1dc4b72b00607a67caaffdcc216cb64379cf9
    
  12. added theissue type on Aug 16, 2026
  13. added a commit that references this issue on Dec 2, 2026
    e9bcb59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions