[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14113481#comment-14113481
 ] 

Jayapal Reddy commented on CLOUDSTACK-7218:
-------------------------------------------

Problem:
------------
Two public ips are set for static nat of vm ips. 
IP1 -->vm1Ip1, IP2-->vm1Ip2 (vm secondary ip).

Reproducing steps:

1) Create network.
2) Deploy the vm. Create a secondary ip address for vm. So the vm has 2 ips 
now: vIp1 and vIp2
3) Associate 2 public ip addresses to the network: IP1 and IP2
4) Enable 2 static nats: one for vIp1/IP1, another for vIp2/IP2
5) Delete the VM, Delete the network.

You will hit the NPE. Because during the vm expunge static nat will get 
disabled just for one of the public ip addresses.
 And the second one will still have the vmId assigned; and NPE will happen when 
we try to access the vm that no longer exists.


Root Cause Analysis:
--------------------
VM is set to static nat, IP1-->vm1Ip1, IP2-->vm1Ip2.
While expunging the vm we deleted only one public ip static nat associated with 
the vm.
The below method _ipAddressDao.findByAssociatedVmId(vmId)  is getting the 
public ip and it returns only one ip.

Due to this on vm expunge only one ip static nat is removed and during the 
destroy network second public
ip trying to access deleted vm details caused the NPE.

Proposed solution:
------------------
In cleanup VM resources deleting all static nats associated with this vm.
Added findAllByAssociatedVmId method get all public ips associated static nat 
with this vm.

QA Verification steps:
-------------------
1) Create network.
2) Deploy the vm. Create a secondary ip address for vm. So the vm has 2 ips 
now: vIp1 and vIp2
3) Associate 2 public ip addresses to the network: IP1 and IP2
4) Enable 2 static nats: one for vIp1/IP1, another for vIp2/IP2
5) Delete the VM, Delete the network.

Restart network should successful.

test_multiple_ips_per_nic.py:test_add_static_nat_rule test should pass.


> [Automation] NPE observed while deleting account in automation run
> ------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7218
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7218
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.5.0
>         Environment: KVM (RHEL 6.3)
>            Reporter: Rayees Namathponnan
>            Assignee: Jayapal Reddy
>            Priority: Critical
>             Fix For: 4.5.0
>
>
> This issue is observed in automation log, NPE thrown while deleting account
> 2014-07-31 02:20:56,102 DEBUG [c.c.n.r.RulesManagerImpl] 
> (API-Job-Executor-2:ctx-523291d6 job-5302 ctx-28b51397) There are no static 
> nat
>  rules to apply for ip id=28
> 2014-07-31 02:20:56,105 WARN  [c.c.u.AccountManagerImpl] 
> (API-Job-Executor-2:ctx-523291d6 job-5302 ctx-28b51397) Failed to cleanup 
> accou
> nt 
> Acct[b1cf2381-ab36-4ebc-90ff-f08acaf5e02d-test-account-TestVmNetworkOperations-test_add_static_nat_rule_1_ISOLATED-YI0OCS]
>  due to
> java.lang.NullPointerException
>         at 
> com.cloud.network.rules.RulesManagerImpl.createStaticNatForIp(RulesManagerImpl.java:1391)
>         at 
> com.cloud.network.rules.RulesManagerImpl.applyStaticNatForIp(RulesManagerImpl.java:1321)
>         at 
> com.cloud.network.rules.RulesManagerImpl.revokeAllPFAndStaticNatRulesForIp(RulesManagerImpl.java:1104)
>         at sun.reflect.GeneratedMethodAccessor524.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>         at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com.sun.proxy.$Proxy105.revokeAllPFAndStaticNatRulesForIp(Unknown 
> Source)
>         at 
> com.cloud.network.IpAddressManagerImpl.cleanupIpResources(IpAddressManagerImpl.java:540)
>         at 
> com.cloud.network.IpAddressManagerImpl.applyIpAssociations(IpAddressManagerImpl.java:936)
>         at 
> org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.cleanupNetworkResources(NetworkOrchestrator.java:2650)
>         at 
> org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.destroyNetwork(NetworkOrchestrator.java:2196)
>         at 
> com.cloud.user.AccountManagerImpl.cleanupAccount(AccountManagerImpl.java:793)
>         at 
> com.cloud.user.AccountManagerImpl.deleteAccount(AccountManagerImpl.java:667)
>         at 
> com.cloud.user.AccountManagerImpl.deleteUserAccount(AccountManagerImpl.java:1441)
>         at sun.reflect.GeneratedMethodAccessor542.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>         at 
> org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:106)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>         at 
> com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:51)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>         at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>         at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>         at com.sun.proxy.$Proxy102.deleteUserAccount(Unknown Source)
>         at 
> org.apache.cloudstack.region.RegionManagerImpl.deleteUserAccount(RegionManagerImpl.java:187)
>         at 
> org.apache.cloudstack.region.RegionServiceImpl.deleteUserAccount(RegionServiceImpl.java:121)
>         at 
> org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd.execute(DeleteAccountCmd.java:104)
>         at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:141)
>         at 
> com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:108)
>         at 
> org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:503)
>         at 
> org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
>         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 
> org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
>         at 
> org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:460)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to