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/master to d571b49
Date Thu, 01 Aug 2013 08:04:26 GMT
Updated Branches:
  refs/heads/master e25f185e6 -> d571b49d0


CLOUDSTACK-3947: Override getSyncObjType and getSyncObjId in CreateLBStickinessPolicyCmd.java
to prevent concurrent operations on Loadbalancer in a network


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

Branch: refs/heads/master
Commit: d571b49d0004a290dc68697680959397c848c0b8
Parents: e25f185
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Thu Aug 1 10:04:18 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Thu Aug 1 10:04:18 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d571b49d/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 1684430..5efa12c 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;
@@ -32,6 +33,7 @@ import org.apache.cloudstack.context.CallContext;
 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;
@@ -157,5 +159,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();
+    }
 }
 


Mime
View raw message