cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 62b09c9
Date Mon, 02 Sep 2013 14:55:12 GMT
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/62b09c92
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/62b09c92
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/62b09c92

Branch: refs/heads/master
Commit: 62b09c9253a4a942f0e0b6649b87e18d4bc70464
Parents: 87d73e2
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Fri Aug 30 11:13:59 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Mon Sep 2 16:53:55 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/62b09c92/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 0647372..c0a5295 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.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/62b09c92/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 14c8ae7..b96427b9 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.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/62b09c92/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/62b09c92/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