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/08/01 10:04:59 UTC

git commit: updated refs/heads/4.2 to 478eae8

Updated Branches:
  refs/heads/4.2 698253576 -> 478eae828


CLOUDSTACK-3947: Override getSyncObjType and getSyncObjId in CreateLBStickinessPolicyCmd.java to prevent concurrent operations on Loadbalancer in a network
(cherry picked from commit d571b49d0004a290dc68697680959397c848c0b8)


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

Branch: refs/heads/4.2
Commit: 478eae8287cb6b34e38eff06199153424f4e2a15
Parents: 6982535
Author: Wei Zhou <w....@leaseweb.com>
Authored: Thu Aug 1 10:04:18 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Thu Aug 1 10:04:48 2013 +0200

----------------------------------------------------------------------
 .../loadbalancer/CreateLBStickinessPolicyCmd.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/478eae82/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
index 02b253a..7a2283e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
@@ -30,6 +31,7 @@ import org.apache.cloudstack.api.response.LBStickinessResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
@@ -156,5 +158,18 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
         return "creating a Load Balancer Stickiness policy: " + getLBStickinessPolicyName();
     }
 
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        LoadBalancer lb = _lbService.findById(getLbRuleId());
+        if (lb == null) {
+            throw new InvalidParameterValueException("Unable to find load balancer rule " + getLbRuleId() + " to create stickiness rule");
+        }
+        return lb.getNetworkId();
+    }
 }