cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaya...@apache.org
Subject [2/5] git commit: updated refs/heads/master to 1c924e5
Date Fri, 28 Jun 2013 13:37:33 GMT
Updated to show same value in log msg SetFirewallRulesCommand and accessdetails for  egress
default policy


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3096261c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3096261c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3096261c

Branch: refs/heads/master
Commit: 3096261c05df4921c751a336ecff15ceeffcdda5
Parents: 9e474d0
Author: Jayapal <jayapal@apache.org>
Authored: Thu Jun 27 16:21:33 2013 +0530
Committer: Jayapal <jayapal@apache.org>
Committed: Fri Jun 28 19:05:54 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/FirewallRuleTO.java          | 6 ++++++
 .../network/router/VirtualNetworkApplianceManagerImpl.java  | 9 +++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3096261c/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
index 29d9c6f..8c7b552 100644
--- a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
+++ b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
@@ -109,6 +109,12 @@ public class FirewallRuleTO implements InternalIdentity {
         this.trafficType = trafficType;
     }
 
+    public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose
purpose, FirewallRule.TrafficType trafficType, boolean defaultEgressPolicy) {
+        this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(),
rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
+        this.trafficType = trafficType;
+        this.defaultEgressPolicy = defaultEgressPolicy;
+    }
+
     public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose
purpose, boolean revokeState, boolean alreadyAdded) {
         this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(),
rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3096261c/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 5a8cf5d..5327f0b 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -3682,6 +3682,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
     private void createFirewallRulesCommands(List<? extends FirewallRule> rules, VirtualRouter
router, Commands cmds, long guestNetworkId) {
         List<FirewallRuleTO> rulesTO = null;
         String systemRule = null;
+        Boolean defaultEgressPolicy = false;
         if (rules != null) {
             if (rules.size() > 0) {
                 if (rules.get(0).getTrafficType() == FirewallRule.TrafficType.Egress &&
rules.get(0).getType() == FirewallRule.FirewallRuleType.System) {
@@ -3696,17 +3697,17 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase
implements V
                     FirewallRuleTO ruleTO = new FirewallRuleTO(rule, null, sourceIp.getAddress().addr(),Purpose.Firewall,traffictype);
                     rulesTO.add(ruleTO);
                 } else if (rule.getTrafficType() == FirewallRule.TrafficType.Egress){
+                    NetworkVO network = _networkDao.findById(guestNetworkId);
+                    NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
+                    defaultEgressPolicy = offering.getEgressDefaultPolicy();
                     assert (rule.getSourceIpAddressId()==null) : "ipAddressId should be null
for egress firewall rule. ";
-                    FirewallRuleTO ruleTO = new FirewallRuleTO(rule, null,"",Purpose.Firewall,
traffictype);
+                    FirewallRuleTO ruleTO = new FirewallRuleTO(rule, null,"",Purpose.Firewall,
traffictype, defaultEgressPolicy);
                     rulesTO.add(ruleTO);
                 }
             }
         }
 
 
-        NetworkVO network = _networkDao.findById(guestNetworkId);
-        NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
-        Boolean defaultEgressPolicy = offering.getEgressDefaultPolicy();
         SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(rulesTO);
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
         cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(guestNetworkId,
router.getId()));


Mime
View raw message