cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/4.2-forward to d9ba234
Date Fri, 30 Aug 2013 09:17:51 GMT
Updated Branches:
  refs/heads/4.2-forward 420b654ea -> d9ba234d6


CLOUDSTACK-2319: fix incorrect account_id in event table for Revoke SecurityGroupRule commands


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

Branch: refs/heads/4.2-forward
Commit: d9ba234d6c032aeb2ba04d4e6be0502de8a4efd9
Parents: 420b654
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Fri Aug 30 11:13:59 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Fri Aug 30 11:13:59 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/d9ba234d/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 c03d3e4..b30ba1c 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/d9ba234d/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 c2fdb8b..a547fb0 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/d9ba234d/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/d9ba234d/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
b/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
index 18ef57f..cb3baac 100644
--- a/engine/schema/src/com/cloud/network/security/dao/SecurityGroupRulesDaoImpl.java
+++ b/engine/schema/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;
-    }
 }


Mime
View raw message