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

Saksham Srivastava commented on CLOUDSTACK-7538:
------------------------------------------------

A particular case where the fix will not work is when the same vm has 2 nics in 
different networks but the IPs of both the nics are same and one of them is 
configured for PF.

Wei the following query is executed while checking for PF rules :
SELECT firewall_rules.id, firewall_rules.xid, firewall_rules.domain_id, 
firewall_rules.account_id, firewall_rules.ip_address_id, 
firewall_rules.start_port, firewall_rules.end_port, firewall_rules.protocol, 
firewall_rules.purpose, firewall_rules.state, firewall_rules.created, 
firewall_rules.network_id, firewall_rules.icmp_code, firewall_rules.icmp_type, 
firewall_rules.related, firewall_rules.type, firewall_rules.traffic_type, 
firewall_rules.uuid, port_forwarding_rules.dest_ip_address, 
port_forwarding_rules.dest_port_start, port_forwarding_rules.dest_port_end, 
port_forwarding_rules.instance_id FROM port_forwarding_rules INNER JOIN 
firewall_rules ON port_forwarding_rules.id=firewall_rules.id 
WHERE firewall_rules.purpose='PortForwarding' 
AND port_forwarding_rules.dest_ip_address = <IP of NIC to remove>;

So the param that needs to be added should be networkid of the nic,which will 
assure that only the IP of the nic that is being removed is checked for PF 
rules. A network should not have same IP assigned to different nics while a vm 
can still have same IPs in different networks.

> Can not remove the vm nic due to there is another vm with same internal ip 
> having port forwording rule
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-7538
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7538
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.4.0, 4.5.0
>            Reporter: Wei Zhou
>            Assignee: Wei Zhou
>             Fix For: 4.5.0, 4.4.1
>
>
> When I tried to remove a nic from a VM, an exception raised:
> 2014-09-08 10:07:12,847 ERROR [cloud.async.AsyncJobManagerImpl] 
> (Job-Executor-109:job-11939 = [ 5c3c0d5b-6b48-45fe-ad36-a0aea13479c4 ]) 
> Unexpected exception while executing 
> org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd
>  com.cloud.utils.exception.CloudRuntimeException: Failed to remove nic from 
> VM[User|CentOS65] in Ntwk[300|Guest|1], nic has associated Port forwarding or 
> Load balancer or Static NAT rules.
>  at 
> com.cloud.vm.VirtualMachineManagerImpl.removeNicFromVm(VirtualMachineManagerImpl.java:3129)
>  at 
> com.cloud.vm.UserVmManagerImpl.removeNicFromVirtualMachine(UserVmManagerImpl.java:1068)
>  at 
> org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd.execute(RemoveNicFromVMCmd.java:103)
>  at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:158)
>  at com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:531)
>  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>  at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  at java.lang.Thread.run(Thread.java:701)
>  2014-09-08 10:07:12,849 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (Job-Executor-109:job-11939 = [ 5c3c0d5b-6b48-45fe-ad36-a0aea13479c4 ]) 
> Complete async job-11939 = [ 5c3c0d5b-6b48-45fe-ad36-a0aea13479c4 ], 
> jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: Failed to 
> remove nic from VM[User|CentOS65] in Ntwk[300|Guest|1], nic has associated 
> Port forwarding or Load balancer or Static NAT rules.
> This is because there is another vm (with same internal ip) having port 
> forward rules .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to