CLOUDSTACK-2694: Able to configure duplicate firewall rule with protocol and no ports

Signed-off-by: Jayapal <jayapal@apache.org>
This commit is contained in:
namita.chaudhari 2014-08-05 09:16:29 +00:00 committed by Jayapal
parent c76302cdd8
commit fce2880b9f

View File

@ -404,6 +404,12 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
boolean notNullPorts = boolean notNullPorts =
(newRule.getSourcePortStart() != null && newRule.getSourcePortEnd() != null && rule.getSourcePortStart() != null && rule.getSourcePortEnd() != null); (newRule.getSourcePortStart() != null && newRule.getSourcePortEnd() != null && rule.getSourcePortStart() != null && rule.getSourcePortEnd() != null);
boolean nullPorts =
(newRule.getSourcePortStart() == null && newRule.getSourcePortEnd() == null && rule.getSourcePortStart() == null && rule.getSourcePortEnd() == null);
if(nullPorts && duplicatedCidrs && (rule.getProtocol().equalsIgnoreCase(newRule.getProtocol())))
{
throw new NetworkRuleConflictException("There is already a firewall rule specified with protocol = " +newRule.getProtocol()+ " and no ports");
}
if (!notNullPorts) { if (!notNullPorts) {
continue; continue;
} else if (!oneOfRulesIsFirewall && } else if (!oneOfRulesIsFirewall &&