You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2013/09/02 17:20:31 UTC

[3/3] git commit: updated refs/heads/4.1 to 15b03a2

CLOUDSTACK-2319: fix incorrect account_id in event table for Revoke SecurityGroupRule commands
(cherry picked from commit d9ba234d6c032aeb2ba04d4e6be0502de8a4efd9)


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

Branch: refs/heads/4.1
Commit: 15b03a2d246a6c19eed9f6c3e5bbf4a228800426
Parents: d969769
Author: Wei Zhou <w....@leaseweb.com>
Authored: Fri Aug 30 11:13:59 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon Sep 2 17:17:44 2013 +0200

----------------------------------------------------------------------
 .../user/securitygroup/RevokeSecurityGroupEgressCmd.java  | 10 +++++++---
 .../user/securitygroup/RevokeSecurityGroupIngressCmd.java | 10 +++++++---
 .../api/response/SecurityGroupRuleResponse.java           |  4 ++--
 .../network/security/dao/SecurityGroupRulesDaoImpl.java   |  8 --------
 4 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15b03a2d/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
index 8e7f2ec..9fb5122 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
@@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
 import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.network.security.SecurityGroup;
+import com.cloud.network.security.SecurityRule;
 import com.cloud.user.Account;
 
 @APICommand(name = "revokeSecurityGroupEgress", responseObject = SuccessResponse.class, description = "Deletes a particular egress rule from this security group", since="3.0.0")
@@ -67,9 +68,12 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
 
     @Override
     public long getEntityOwnerId() {
-        SecurityGroup group = _entityMgr.findById(SecurityGroup.class, getId());
-        if (group != null) {
-            return group.getAccountId();
+        SecurityRule rule = _entityMgr.findById(SecurityRule.class, getId());
+        if (rule != null) {
+            SecurityGroup group = _entityMgr.findById(SecurityGroup.class, rule.getSecurityGroupId());
+            if (group != null) {
+                return group.getAccountId();
+            }
         }
 
         return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15b03a2d/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
index 1d45064..c372685 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
@@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
 import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.network.security.SecurityGroup;
+import com.cloud.network.security.SecurityRule;
 import com.cloud.user.Account;
 
 @APICommand(name = "revokeSecurityGroupIngress", responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group")
@@ -67,9 +68,12 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
 
     @Override
     public long getEntityOwnerId() {
-        SecurityGroup group = _entityMgr.findById(SecurityGroup.class, getId());
-        if (group != null) {
-            return group.getAccountId();
+        SecurityRule rule = _entityMgr.findById(SecurityRule.class, getId());
+        if (rule != null) {
+            SecurityGroup group = _entityMgr.findById(SecurityGroup.class, rule.getSecurityGroupId());
+            if (group != null) {
+                return group.getAccountId();
+            }
         }
 
         return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15b03a2d/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java b/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java
index 5aeee6f..798b123 100644
--- a/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java
@@ -20,11 +20,11 @@ import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
 
-import com.cloud.network.security.SecurityGroupRules;
+import com.cloud.network.security.SecurityRule;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 
-@EntityReference(value = SecurityGroupRules.class)
+@EntityReference(value = SecurityRule.class)
 public class SecurityGroupRuleResponse extends BaseResponse {
     @SerializedName("ruleid") @Param(description="the id of the security group rule")
     private String ruleId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15b03a2d/server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java b/server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
index 18ef57f..cb3baac 100644
--- a/server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
+++ b/server/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
@@ -85,12 +85,4 @@ public class SecurityGroupRulesDaoImpl extends GenericDaoBase<SecurityGroupRules
         return listBy(sc, searchFilter);
     }
 
-    @Override
-    public SecurityGroupRulesVO findByUuidIncludingRemoved(final String uuid) {
-        SearchCriteria<SecurityGroupRulesVO> sc = createSearchCriteria();
-        sc.addAnd("ruleUuid", SearchCriteria.Op.EQ, uuid);
-        SecurityGroupRulesVO rule = findOneIncludingRemovedBy(sc);
-        SecurityGroupRulesVO newRule = new SecurityGroupRulesVO(rule.getRuleId());
-        return newRule;
-    }
 }