Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete shared network (specifyVlan=false and no services) #10261

Open
sureshanaparti opened this issue Jan 24, 2025 · 2 comments
Open
Milestone

Comments

@sureshanaparti
Copy link
Contributor

sureshanaparti commented Jan 24, 2025

Unable to delete shared network (with specifyVlan=false and no services)

ISSUE TYPE
  • Bug Report
COMPONENT NAME
Networks
CLOUDSTACK VERSION
4.19.1
CONFIGURATION
OS / ENVIRONMENT

Agnostic of OS

STEPS TO REPRODUCE
  1. Create a VM, say testvm.
  2. Create a network offering for Shared network with specifyVlan = false and no services ; enable the network offering.
  3. Create a shared network using this offering and provide only IPv4 gateway and netmask (no IP range provided).
    Ex: create network acltype=domain name=test-shared-network displaytext=test-shared-network networkofferingid=3dc6968e-6503-4fa3-8a38-09da72d7a846 gateway=1.1.1.1 netmask=255.255.255.0 physicalnetworkid=7691b1b8-2438-4843-9802-cb7f458d7757 zoneid=5b53d47b-d56a-4e6d-927c-3b61a58edf9f
  4. Stop the VM testvm and attach network created (addNicToVirtualMachine) in step3, to the VM.
  5. Start the VM - this will fail.
  6. Remove the network (removeNicFromVirtualMachine) in step3, from the VM. Now, start the VM.
  7. Delete the network created in step 3 - It fails with below exception.
2025-01-24 05:00:13,653 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-37:ctx-c898771c job-126) (logid:65c35a14) Unexpected exception while executing org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd
java.lang.NullPointerException
        at com.cloud.network.Networks$BroadcastDomainType.getSchemeValue(Networks.java:178)
        at com.cloud.network.Networks$BroadcastDomainType.getValue(Networks.java:232)
        at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.deleteVlansInNetwork(NetworkOrchestrator.java:3452)
        at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator$13.doInTransaction(NetworkOrchestrator.java:3352)
        at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator$13.doInTransaction(NetworkOrchestrator.java:3344)
        at com.cloud.utils.db.Transaction$2.doInTransaction(Transaction.java:50)
        at com.cloud.utils.db.Transaction.execute(Transaction.java:40)
        at com.cloud.utils.db.Transaction.execute(Transaction.java:47)
        at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.destroyNetwork(NetworkOrchestrator.java:3344)
        at com.cloud.network.NetworkServiceImpl.deleteNetwork(NetworkServiceImpl.java:2695)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        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.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
        at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:52)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
        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 com.sun.proxy.$Proxy168.deleteNetwork(Unknown Source)
        at org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd.execute(DeleteNetworkCmd.java:72)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
        at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:112)
        at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:654)

  1. Also, List VM (listVirtualMachines) with networkid (of network in Step 3) list the VM testvm, but doesn't show the nic
EXPECTED RESULTS
List VM with the network shouldn't show the VM when not attached to the network, and Network has to be deleted without any issues.
ACTUAL RESULTS
List VM with the network shows the VM when it is not attached to the network, and delete network fails with an NPE.
@Pearl1594
Copy link
Contributor

does this: #10168 address the issue? basically, the PR prevents creation of shared networks without an ip range

@bernardodemarco
Copy link
Collaborator

does this: #10168 address the issue? basically, the PR prevents creation of shared networks without an ip range

@Pearl1594, yes, I think so. The NPE is thrown when the broadcast_uri is NULL. If, at least the startip of a shared network is specified, then the broadcast_uri won't be NULL. Therefore, I believe that adding this validation will be enough to solve this issue.

Regarding this bug List VM with the network shouldn't show the VM when not attached to the network, it was fixed in #10204.

@bernardodemarco bernardodemarco removed their assignment Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants