From dce3f9fa3bca63ee8ae79e012b2086fee9c72455 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 29 Nov 2010 11:55:26 -0800 Subject: [PATCH] bug 7344: preventing enabling of static nat on an ip for more than one instance. Check the nat flag, and error out if set status 7344: resolved fixed --- server/src/com/cloud/network/NetworkManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 7e164b7e65e..74548f93537 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -3146,6 +3146,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag throw new PermissionDeniedException("Cannot create a static nat rule for the ip:"+ipAddress.getAddress()+" ,this is already a source nat ip address"); } + //if given ip address is already static nat, return error + if(ipAddress.isOneToOneNat()){ + throw new PermissionDeniedException("Cannot create a static nat rule for the ip:"+ipAddress.getAddress()+" ,this is already a static nat ip address"); + } + newFwRule = new FirewallRuleVO(); newFwRule.setEnabled(true); newFwRule.setForwarding(true);