Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 27961106A0 for ; Tue, 3 Sep 2013 23:41:34 +0000 (UTC) Received: (qmail 82670 invoked by uid 500); 3 Sep 2013 23:41:31 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 82613 invoked by uid 500); 3 Sep 2013 23:41:31 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 82423 invoked by uid 99); 3 Sep 2013 23:41:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Sep 2013 23:41:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D24B28C7745; Tue, 3 Sep 2013 23:41:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: animesh@apache.org To: commits@cloudstack.apache.org Date: Tue, 03 Sep 2013 23:41:37 -0000 Message-Id: In-Reply-To: <70c85572ec594afbb63603832c9ce052@git.apache.org> References: <70c85572ec594afbb63603832c9ce052@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/21] git commit: updated refs/heads/4.2 to 51707d8 CLOUDSTACK-2319: fix incorrect account_id in event table for Revoke SecurityGroupRule commands (cherry picked from commit d9ba234d6c032aeb2ba04d4e6be0502de8a4efd9) Signed-off-by: animesh Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6ed8a206 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6ed8a206 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6ed8a206 Branch: refs/heads/4.2 Commit: 6ed8a206977e7b1dfd80871e4d39cc9c7493a99e Parents: 1b684ac Author: Wei Zhou Authored: Fri Aug 30 11:13:59 2013 +0200 Committer: animesh Committed: Tue Sep 3 16:21:18 2013 -0700 ---------------------------------------------------------------------- .../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/6ed8a206/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/6ed8a206/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/6ed8a206/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/6ed8a206/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 sc = createSearchCriteria(); - sc.addAnd("ruleUuid", SearchCriteria.Op.EQ, uuid); - SecurityGroupRulesVO rule = findOneIncludingRemovedBy(sc); - SecurityGroupRulesVO newRule = new SecurityGroupRulesVO(rule.getRuleId()); - return newRule; - } }