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 to 2b980ef
Date Tue, 06 Aug 2013 08:54:34 GMT
Updated Branches:
  refs/heads/4.2 7fd71d708 -> 2b980ef88


CLOUDSTACK-3947: Fix similar issues related to getSyncObjType / getSyncObjId
(cherry picked from commit 5cfc69a7aa224fbf9c200a6066c56cd0d19174c7)


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

Branch: refs/heads/4.2
Commit: 2b980ef88fbf10edfb2ce64ec9a6ba41ead7f36c
Parents: 7fd71d7
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Tue Aug 6 10:42:31 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Tue Aug 6 10:49:12 2013 +0200

----------------------------------------------------------------------
 .../firewall/UpdatePortForwardingRuleCmd.java    | 19 +++++++++++++++++++
 .../loadbalancer/CreateLoadBalancerRuleCmd.java  | 10 ++++++++++
 .../loadbalancer/UpdateLoadBalancerRuleCmd.java  | 15 +++++++++++++++
 .../command/user/network/UpdateNetworkCmd.java   | 10 ++++++++++
 .../api/command/user/vpc/DeleteVPCCmd.java       |  9 +++++++++
 .../api/command/user/vpc/RestartVPCCmd.java      | 10 ++++++++++
 .../api/command/user/vpc/UpdateVPCCmd.java       | 10 ++++++++++
 7 files changed, 83 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
index 2a8b900..947c209 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
@@ -26,6 +26,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.network.IpAddress;
 import com.cloud.user.Account;
 
@@ -127,4 +128,22 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
 //            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update
port forwarding rule");
 //        }
     }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getIp().getAssociatedWithNetworkId();
+    }
+
+    private IpAddress getIp() {
+        IpAddress ip = _networkService.getIp(publicIpId);
+        if (ip == null) {
+            throw new InvalidParameterValueException("Unable to find ip address by id " +
publicIpId);
+        }
+        return ip;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index f6cc1f1..e398380 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
 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;
@@ -380,5 +381,14 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd  /*implements
         return AsyncJob.Type.FirewallRule;
     }
 
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getNetworkId();
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
index c296057..9a29c12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
@@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.network.rules.LoadBalancer;
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
@@ -113,4 +114,18 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load
balancer rule");
         }
     }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        LoadBalancer lb = _lbService.findById(getId());
+        if (lb == null) {
+            throw new InvalidParameterValueException("Unable to find load balancer rule "
+ getId());
+        }
+        return lb.getNetworkId();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index fe38124..ae9f35a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -158,4 +158,14 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
     public String getEventType() {
         return EventTypes.EVENT_NETWORK_UPDATE;
     }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return id;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
index 18866be..f62ec5d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
@@ -101,4 +101,13 @@ public class DeleteVPCCmd extends BaseAsyncCmd{
         return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to
SYSTEM so ERROR events are tracked
     }
 
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.vpcSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getId();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
index 714e9e7..8d7f24d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
@@ -106,4 +106,14 @@ public class RestartVPCCmd extends BaseAsyncCmd{
     public String getEventDescription() {
         return "restarting VPC id=" + getId();
     }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.vpcSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getId();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b980ef8/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
index a641021..588333e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java
@@ -105,4 +105,14 @@ public class UpdateVPCCmd extends BaseAsyncCmd{
     public String getEventDescription() {
         return "updating VPC id=" + getId();
     }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.vpcSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return getId();
+    }
 }


Mime
View raw message