cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/2] git commit: updated refs/heads/4.4 to d387460
Date Wed, 30 Jul 2014 11:12:06 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 f657de540 -> d387460f4


CLOUDSTACK-6895: 1. Populate firstclass entities as uuids in the context instead of dbids
for performance.
2. Add ctxDetails in the ParamGenericValidationWorker to avoid warning for api validation
3. Add some missing events.
4. Correcting mapping for ResourceObjectType.NetworkACL and ResourceObjectType.NetworkACLItem

(cherry picked from commit 8a9092c3cd4e3c034f9f4d0a7491875dc080e9dc)


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

Branch: refs/heads/4.4
Commit: 745ba5cd4915595da7d74fa80ed74af993daea8f
Parents: f657de5
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Wed Jun 11 15:22:13 2014 -0700
Committer: Daan Hoogland <daan@onecht.net>
Committed: Wed Jul 30 13:10:34 2014 +0200

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java        | 16 +++++++------
 api/src/org/apache/cloudstack/api/BaseCmd.java | 26 ++++++++++++++-------
 2 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/745ba5cd/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 70b656c..4cc5b8f 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -20,12 +20,14 @@ import java.util.HashMap;
 import java.util.Map;
 
 import com.cloud.network.IpAddress;
+import com.cloud.network.Site2SiteCustomerGateway;
 import com.cloud.network.Site2SiteVpnGateway;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.HealthCheckPolicy;
 import com.cloud.network.rules.StickinessPolicy;
 import com.cloud.network.vpc.NetworkACL;
 import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.Site2SiteVpnConnection;
 import com.cloud.server.ResourceTag;
 import com.cloud.vm.ConsoleProxy;
 import com.cloud.vm.SecondaryStorageVm;
@@ -572,7 +574,7 @@ public class EventTypes {
         entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, FirewallRule.class);
         entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, FirewallRule.class);
         entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class);
-        entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, FirewallRule.class);
         entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, StickinessPolicy.class);
         entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_UPDATE, StickinessPolicy.class);
         entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, StickinessPolicy.class);
@@ -720,12 +722,12 @@ public class EventTypes {
         entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class);
         entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, Site2SiteVpnGateway.class);
         entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, Site2SiteVpnGateway.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class);
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, Site2SiteCustomerGateway.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, Site2SiteCustomerGateway.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, Site2SiteCustomerGateway.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, Site2SiteVpnConnection.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, Site2SiteVpnConnection.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, Site2SiteVpnConnection.class);
 
         // Custom certificates
         entityEventDetails.put(EVENT_UPLOAD_CUSTOM_CERTIFICATE, "Certificate");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/745ba5cd/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index ed7e983..ac9a208 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -371,7 +371,7 @@ public abstract class BaseCmd {
                 Object key = entry.getKey();
                 Class clz = Class.forName((String)key);
                 if(Displayable.class.isAssignableFrom(clz)){
-                    final Object objVO = _entityMgr.findById(clz, getInternalId(entry.getValue()));
+                    final Object objVO = getEntityVO(clz, entry.getValue());
                     isDisplay = ((Displayable) objVO).isDisplay();
                 }
 
@@ -388,17 +388,25 @@ public abstract class BaseCmd {
 
     }
 
-    private static Long getInternalId(Object internalIdObj){
-        Long internalId = null;
+    private Object getEntityVO(Class entityType, Object entityId){
 
-        // In case its an async job the value would be a string because of json deserialization
-        if(internalIdObj instanceof String){
-            internalId = Long.valueOf((String) internalIdObj);
-        }else if (internalIdObj instanceof Long){
-            internalId = (Long) internalIdObj;
+        // entityId can be internal db id or UUID so accordingly call findbyId or findByUUID
+
+        if (entityId instanceof Long){
+            // Its internal db id - use findById
+            return _entityMgr.findById(entityType, (Long)entityId);
+        } else if(entityId instanceof String){
+            try{
+                // In case its an async job the internal db id would be a string because
of json deserialization
+                Long internalId = Long.valueOf((String) entityId);
+                return _entityMgr.findById(entityType, internalId);
+            } catch (NumberFormatException e){
+               // It is uuid - use findByUuid`
+               return _entityMgr.findByUuid(entityType, (String)entityId);
+            }
         }
 
-        return internalId;
+        return null;
     }
 
 }


Mime
View raw message