You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2015/09/14 06:16:23 UTC

[1/6] git commit: updated refs/heads/master to f888e93

Repository: cloudstack
Updated Branches:
  refs/heads/master 120e1cc93 -> f888e93e4


CLOUDSTACK-8816 Fixed entityUuid missing in some cases is events

context parameters is Map<object,Object>. This has been used
interchangeably with String and class object resulting the param value
not being available in some cases if its put with object and get with
class.forName()

made the put and get consistent by using Object as key everywhere.


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

Branch: refs/heads/master
Commit: 37c3451aaee5ca8ae385cd62a1b9f37cc44ad3fe
Parents: 28d18dc
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Mon Sep 7 17:12:49 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 9 14:23:27 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java         | 15 ++++----
 .../cloud/api/dispatch/ParamProcessWorker.java  |  4 +--
 .../src/com/cloud/event/ActionEventUtils.java   | 38 ++++----------------
 .../storage/snapshot/SnapshotManagerImpl.java   |  2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |  2 +-
 5 files changed, 18 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37c3451a/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 4da8b1e..1459dc2 100644
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -277,11 +277,10 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
             }
         }
         // For some reason, the instanceType / instanceId are not abstract, which means we may get null values.
-        org.apache.cloudstack.framework.events.Event event = new org.apache.cloudstack.framework.events.Event(
-                "management-server",
-                EventCategory.ASYNC_JOB_CHANGE_EVENT.getName(),
-                jobEvent,
-                (job.getInstanceType() != null ? job.getInstanceType().toString() : "unknown"), null);
+        String instanceType = job.getInstanceType() != null ? job.getInstanceType() : "unknown";
+        String instanceUuid = job.getInstanceId() != null ? ApiDBUtils.findJobInstanceUuid(job) : "";
+        org.apache.cloudstack.framework.events.Event event = new org.apache.cloudstack.framework.events.Event("management-server", EventCategory.ASYNC_JOB_CHANGE_EVENT.getName(),
+                jobEvent, instanceType, instanceUuid);
 
         Map<String, String> eventDescription = new HashMap<String, String>();
         eventDescription.put("command", job.getCmd());
@@ -289,8 +288,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
         eventDescription.put("account", jobOwner.getUuid());
         eventDescription.put("processStatus", "" + job.getProcessStatus());
         eventDescription.put("resultCode", "" + job.getResultCode());
-        eventDescription.put("instanceUuid", (job.getInstanceId() != null ? ApiDBUtils.findJobInstanceUuid(job) : "" ) );
-        eventDescription.put("instanceType", (job.getInstanceType() != null ? job.getInstanceType().toString() : "unknown"));
+        eventDescription.put("instanceUuid", instanceUuid);
+        eventDescription.put("instanceType", instanceType);
         eventDescription.put("commandEventType", cmdEventType);
         eventDescription.put("jobId", job.getUuid());
         eventDescription.put("jobResult", job.getResult());
@@ -638,7 +637,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 params.put("id", objectId.toString());
                 Class entityClass = EventTypes.getEntityClassForEvent(createCmd.getEventType());
                 if (entityClass != null)
-                    ctx.putContextParameter(entityClass.getName(), objectUuid);
+                    ctx.putContextParameter(entityClass, objectUuid);
             } else {
                 // Extract the uuid before params are processed and id reflects internal db id
                 objectUuid = params.get(ApiConstants.ID);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37c3451a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
index eb3b77a..3c81ff6 100644
--- a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
@@ -410,7 +410,7 @@ public class ParamProcessWorker implements DispatchWorker {
             if (internalId != null){
                 // Populate CallContext for each of the entity.
                 for (final Class<?> entity : entities) {
-                    CallContext.current().putContextParameter(entity.getName(), internalId);
+                    CallContext.current().putContextParameter(entity, internalId);
                 }
                 return internalId;
             }
@@ -434,7 +434,7 @@ public class ParamProcessWorker implements DispatchWorker {
             }
             // Return on first non-null Id for the uuid entity
             if (internalId != null){
-                CallContext.current().putContextParameter(entity.getName(), uuid);
+                CallContext.current().putContextParameter(entity, uuid);
                 break;
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37c3451a/server/src/com/cloud/event/ActionEventUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java
index 2ac4303..29eade2 100644
--- a/server/src/com/cloud/event/ActionEventUtils.java
+++ b/server/src/com/cloud/event/ActionEventUtils.java
@@ -37,7 +37,6 @@ import org.apache.cloudstack.framework.events.EventBus;
 import org.apache.cloudstack.framework.events.EventBusException;
 
 import com.cloud.configuration.Config;
-import com.cloud.domain.Domain;
 import com.cloud.event.dao.EventDao;
 import com.cloud.server.ManagementService;
 import com.cloud.user.Account;
@@ -204,20 +203,15 @@ public class ActionEventUtils {
         String entityType = null;
         String entityUuid = null;
         CallContext context = CallContext.current();
-        Class<?> entityKey = getEntityKey(eventType);
-        if (entityKey != null){
-            //FIXME - Remove this since it should be covered by the else if condition below.
-            entityUuid = (String)context.getContextParameter(entityKey);
-            if (entityUuid != null)
-                entityType = entityKey.getName();
-        }else if (EventTypes.getEntityClassForEvent(eventType) != null){
-            //Get entity Class(Example - VirtualMachine.class) from the event Type eg. - VM.CREATE
-            Class<?> entityClass = EventTypes.getEntityClassForEvent(eventType);
-
+        //Get entity Class(Example - VirtualMachine.class) from the event Type eg. - VM.CREATE
+        Class<?> entityClass = EventTypes.getEntityClassForEvent(eventType);
+        if (entityClass != null){
             //Get uuid from id
-            if(context.getContextParameter(entityClass.getName()) != null){
+            Object param = context.getContextParameter(entityClass);
+            if(param != null){
                 try {
-                    entityUuid = getEntityUuid(entityClass, context.getContextParameter(entityClass.getName()));
+                    entityUuid = getEntityUuid(entityClass, param);
+                    entityType = entityClass.getName();
                 } catch (Exception e){
                     s_logger.debug("Caught exception while finding entityUUID, moving on");
                 }
@@ -312,22 +306,4 @@ public class ActionEventUtils {
 
     }
 
-    private static Class<?> getEntityKey(String eventType)
-    {
-        // FIXME - Remove this
-        if (eventType.startsWith("DOMAIN."))
-        {
-            return Domain.class;
-        }
-        else if (eventType.startsWith("ACCOUNT."))
-        {
-            return Account.class;
-        }
-        else if (eventType.startsWith("USER."))
-        {
-            return User.class;
-        }
-
-        return null;
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37c3451a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index c622c55..8a21014 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -777,7 +777,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
 
         }
         // TODO - Make createSnapshotPolicy - BaseAsyncCreate and remove this.
-        CallContext.current().putContextParameter(SnapshotPolicy.class.getName(), policy.getUuid());
+        CallContext.current().putContextParameter(SnapshotPolicy.class, policy.getUuid());
         return policy;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/37c3451a/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index ee87ab4..97eceaf 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1212,7 +1212,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         if (guestNic == null) {
             throw new CloudRuntimeException("Unable to add NIC to " + vmInstance);
         }
-        CallContext.current().putContextParameter(Nic.class.getName(), guestNic.getUuid());
+        CallContext.current().putContextParameter(Nic.class, guestNic.getUuid());
         s_logger.debug("Successful addition of " + network + " from " + vmInstance);
         return _vmDao.findById(vmInstance.getId());
     }


[2/6] git commit: updated refs/heads/master to f888e93

Posted by ra...@apache.org.
CLOUDSTACK-8816: Project UUID is not showing for some of operations in RabbitMQ.


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

Branch: refs/heads/master
Commit: 3bd53521e8944db447bfa69494d7f01f73727808
Parents: b12d473
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Wed Sep 9 12:18:08 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 9 14:23:28 2015 +0530

----------------------------------------------------------------------
 api/src/org/apache/cloudstack/context/CallContext.java | 10 ++++++++++
 server/src/com/cloud/api/ApiDispatcher.java            |  9 +++++++++
 server/src/com/cloud/event/ActionEventInterceptor.java |  2 +-
 server/src/com/cloud/event/ActionEventUtils.java       |  2 +-
 server/src/com/cloud/projects/ProjectManagerImpl.java  |  1 +
 5 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bd53521/api/src/org/apache/cloudstack/context/CallContext.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java
index 73da826..2619f4a 100644
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.Stack;
 import java.util.UUID;
 
+import com.cloud.projects.Project;
 import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
@@ -59,6 +60,7 @@ public class CallContext {
     private User user;
     private long userId;
     private final Map<Object, Object> context = new HashMap<Object, Object>();
+    private Project project;
 
     static EntityManager s_entityMgr;
 
@@ -314,6 +316,14 @@ public class CallContext {
         this.eventDescription = eventDescription;
     }
 
+    public Project getProject() {
+        return this.project;
+    }
+
+    public void setProject(Project project) {
+        this.project = project;
+    }
+
     /**
      * Whether to display the event to the end user.
      * @return true - if the event is to be displayed to the end user, false otherwise.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bd53521/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 0dc1164..7375588 100644
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -21,6 +21,8 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import com.cloud.projects.Project;
+import com.cloud.utils.db.EntityManager;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.acl.ControlledEntity;
@@ -54,6 +56,9 @@ public class ApiDispatcher {
     @Inject
     AccountManager _accountMgr;
 
+    @Inject
+    EntityManager _entityMgr;
+
     @Inject()
     protected DispatchChainFactory dispatchChainFactory;
 
@@ -102,6 +107,10 @@ public class ApiDispatcher {
 
         final CallContext ctx = CallContext.current();
         ctx.setEventDisplayEnabled(cmd.isDisplay());
+        if(params.get(ApiConstants.PROJECT_ID) != null) {
+            Project project = _entityMgr.findByUuidIncludingRemoved(Project.class, params.get(ApiConstants.PROJECT_ID));
+            ctx.setProject(project);
+        }
 
         // TODO This if shouldn't be here. Use polymorphism and move it to validateSpecificParameters
         if (cmd instanceof BaseAsyncCmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bd53521/server/src/com/cloud/event/ActionEventInterceptor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventInterceptor.java b/server/src/com/cloud/event/ActionEventInterceptor.java
index 5d2d51a..d2dacd9 100644
--- a/server/src/com/cloud/event/ActionEventInterceptor.java
+++ b/server/src/com/cloud/event/ActionEventInterceptor.java
@@ -84,7 +84,7 @@ public class ActionEventInterceptor implements ComponentMethodInterceptor, Metho
         for (ActionEvent actionEvent : getActionEvents(method)) {
             CallContext ctx = CallContext.current();
             long userId = ctx.getCallingUserId();
-            long accountId = ctx.getCallingAccountId();
+            long accountId = ctx.getProject() != null ? ctx.getProject().getProjectAccountId() : ctx.getCallingAccountId();    //This should be the entity owner id rather than the Calling User Account Id.
             long startEventId = ctx.getStartEventId();
             String eventDescription = getEventDescription(actionEvent, ctx);
             String eventType = getEventType(actionEvent, ctx);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bd53521/server/src/com/cloud/event/ActionEventUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java
index 29eade2..0ca41cc 100644
--- a/server/src/com/cloud/event/ActionEventUtils.java
+++ b/server/src/com/cloud/event/ActionEventUtils.java
@@ -120,7 +120,7 @@ public class ActionEventUtils {
     public static void onStartedActionEventFromContext(String eventType, String eventDescription, boolean eventDisplayEnabled) {
         CallContext ctx = CallContext.current();
         long userId = ctx.getCallingUserId();
-        long accountId = ctx.getCallingAccountId();
+        long accountId = ctx.getProject() != null ? ctx.getProject().getProjectAccountId() : ctx.getCallingAccountId();    //This should be the entity owner id rather than the Calling User Account Id.
         long startEventId = ctx.getStartEventId();
 
         if (!eventType.equals(""))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3bd53521/server/src/com/cloud/projects/ProjectManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/projects/ProjectManagerImpl.java b/server/src/com/cloud/projects/ProjectManagerImpl.java
index 510b55c..95cf68a 100644
--- a/server/src/com/cloud/projects/ProjectManagerImpl.java
+++ b/server/src/com/cloud/projects/ProjectManagerImpl.java
@@ -222,6 +222,7 @@ public class ProjectManagerImpl extends ManagerBase implements ProjectManager {
 
         if (project != null) {
             CallContext.current().setEventDetails("Project id=" + project.getId());
+            CallContext.current().putContextParameter(Project.class, project.getUuid());
         }
 
         //Increment resource count


[5/6] git commit: updated refs/heads/master to f888e93

Posted by ra...@apache.org.
CLOUDSTACK-8816 Systemvm reboot event doesnt have uuids. Fixed the same

Also removed duplicate console proxy event thats generated both for ssvm
and console proxy reboot.


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

Branch: refs/heads/master
Commit: 358846492a2b7b65683d8b0c4c4bdec78792dc50
Parents: 3bd5352
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Wed Sep 9 14:21:44 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 9 14:23:29 2015 +0530

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java         | 28 +++++++++-----------
 .../com/cloud/server/ManagementServerImpl.java  |  1 -
 2 files changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35884649/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 870c7e7..9a264a5 100644
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -63,10 +63,8 @@ import com.cloud.storage.snapshot.SnapshotPolicy;
 import com.cloud.template.VirtualMachineTemplate;
 import com.cloud.user.Account;
 import com.cloud.user.User;
-import com.cloud.vm.ConsoleProxy;
 import com.cloud.vm.Nic;
 import com.cloud.vm.NicSecondaryIp;
-import com.cloud.vm.SecondaryStorageVm;
 import com.cloud.vm.VirtualMachine;
 import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.usage.Usage;
@@ -557,13 +555,13 @@ public class EventTypes {
         entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class);
         entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class);
 
-        entityEventDetails.put(EVENT_PROXY_CREATE, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_PROXY_DESTROY, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_PROXY_START, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_PROXY_STOP, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_PROXY_REBOOT, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_ROUTER_HA, ConsoleProxy.class);
-        entityEventDetails.put(EVENT_PROXY_HA, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_CREATE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_PROXY_DESTROY, VirtualMachine.class);
+        entityEventDetails.put(EVENT_PROXY_START, VirtualMachine.class);
+        entityEventDetails.put(EVENT_PROXY_STOP, VirtualMachine.class);
+        entityEventDetails.put(EVENT_PROXY_REBOOT, VirtualMachine.class);
+        entityEventDetails.put(EVENT_ROUTER_HA, VirtualMachine.class);
+        entityEventDetails.put(EVENT_PROXY_HA, VirtualMachine.class);
 
         entityEventDetails.put(EVENT_VNC_CONNECT, "VNC");
         entityEventDetails.put(EVENT_VNC_DISCONNECT, "VNC");
@@ -668,12 +666,12 @@ public class EventTypes {
         entityEventDetails.put(EVENT_ISO_UPLOAD, "Iso");
 
         // SSVM
-        entityEventDetails.put(EVENT_SSVM_CREATE, SecondaryStorageVm.class);
-        entityEventDetails.put(EVENT_SSVM_DESTROY, SecondaryStorageVm.class);
-        entityEventDetails.put(EVENT_SSVM_START, SecondaryStorageVm.class);
-        entityEventDetails.put(EVENT_SSVM_STOP, SecondaryStorageVm.class);
-        entityEventDetails.put(EVENT_SSVM_REBOOT, SecondaryStorageVm.class);
-        entityEventDetails.put(EVENT_SSVM_HA, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_CREATE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_SSVM_DESTROY, VirtualMachine.class);
+        entityEventDetails.put(EVENT_SSVM_START, VirtualMachine.class);
+        entityEventDetails.put(EVENT_SSVM_STOP, VirtualMachine.class);
+        entityEventDetails.put(EVENT_SSVM_REBOOT, VirtualMachine.class);
+        entityEventDetails.put(EVENT_SSVM_HA, VirtualMachine.class);
 
         // Service Offerings
         entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35884649/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 8483018..25071a2 100644
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3250,7 +3250,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
     }
 
     @Override
-    @ActionEvent(eventType = EventTypes.EVENT_PROXY_REBOOT, eventDescription = "", async = true)
     public VMInstanceVO rebootSystemVM(final RebootSystemVmCmd cmd) {
         final VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
 


[6/6] git commit: updated refs/heads/master to f888e93

Posted by ra...@apache.org.
Merge pull request #782 from karuturi/CLOUDSTACK-8816

Cloudstack 8816 entityuuid missing in some of the eventsIn some of the events generated, entity uuid was missing making it difficult to find the entity. Fixed the same.

Tested it on rabbitmq instance.
There are the events before after the fix:

Before
--------------------------------------------------------------------------------

routing_key: management-server.ActionEvent.ACCOUNT-DELETE.Account.*
exchange: cloudstack-events
message_count: 2
payload:
{"eventDateTime":"2015-09-04 17:59:24 +0530","status":"Scheduled","description":"deleting User test4 (id: 28) and accountId \u003d 28","event":"ACCOUNT.DELETE","Account":"c09e2e81-8edc-4c27-b072-25005b522b63","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"}

payload_bytes: 304
payload_encoding: string
redelivered: False

--------------------------------------------------------------------------------

routing_key: management-server.AsyncJobEvent.complete.Account.*
exchange: cloudstack-events
message_count: 0
payload: {"cmdInfo":"{\"id\":\"9dd3abc2-3f8b-4852-aa60-a74b234acb13\",\"response\":\"json\",\"sessionkey\":\"5ig1ItP2_5v-mgY4cVJbJN5hw_w\",\"ctxDetails\":\"
{\\\"interface com.cloud.user.Account\\\":\\\"9dd3abc2-3f8b-4852-aa60-a74b234acb13\\\"}

\",\"cmdEventType\":\"ACCOUNT.DELETE\",\"expires\":\"2015-09-07T11:11:56+0000\",\"ctxUserId\":\"2\",\"signatureversion\":\"3\",\"httpmethod\":\"GET\",\"uuid\":\"9dd3abc2-3f8b-4852-aa60-a74b234acb13\",\"ctxAccountId\":\"2\",\"ctxStartEventId\":\"447\"}","instanceType":"Account","jobId":"5004989d-0cde-4922-8afa-66bf38b75ea7","status":"SUCCEEDED","processStatus":"0","commandEventType":"ACCOUNT.DELETE","resultCode":"0","command":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","jobResult":"org.apache.cloudstack.api.response.SuccessResponse/null/
{\"success\":true}

","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"}
payload_bytes: 914
payload_encoding: string
redelivered: False

--------------------------------------------------------------------------------

After
--------------------------------------------------------------------------------

 routing_key: management-server.ActionEvent.ACCOUNT-DELETE.Account.e5e2db91-414d-484c-99d5-c4e265c14ad8
exchange: cloudstack-events
message_count: 13
payload: {"eventDateTime":"2015-09-07 17:32:26 +0530","status":"Completed","description":"Successfully completed deleting account. Account Id: 45","event":"ACCOUNT.DELETE","entityuuid":"e5e2db91-414d-484c-99d5-c4e265c14ad8","entity":"com.cloud.user.Account","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"}
payload_bytes: 344
payload_encoding: string
redelivered: True

--------------------------------------------------------------------------------

routing_key: management-server.AsyncJobEvent.complete.Account.e5e2db91-414d-484c-99d5-c4e265c14ad8
exchange: cloudstack-events
message_count: 12
payload: {"cmdInfo":"{\"id\":\"e5e2db91-414d-484c-99d5-c4e265c14ad8\",\"response\":\"json\",\"sessionkey\":\"8AJVbn8HIpg5LZ_VaVfSPs_QN2k\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"e5e2db91-414d-484c-99d5-c4e265c14ad8\\\"}\",\"cmdEventType\":\"ACCOUNT.DELETE\",\"expires\":\"2015-09-07T12:17:42+0000\",\"ctxUserId\":\"2\",\"signatureversion\":\"3\",\"httpmethod\":\"GET\",\"uuid\":\"e5e2db91-414d-484c-99d5-c4e265c14ad8\",\"ctxAccountId\":\"2\",\"ctxStartEventId\":\"465\"}","instanceType":"Account","instanceUuid":"e5e2db91-414d-484c-99d5-c4e265c14ad8","jobId":"0bb08486-6d9f-4e9f-bfef-b7463c42e71b","status":"SUCCEEDED","processStatus":"0","commandEventType":"ACCOUNT.DELETE","resultCode":"0","command":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","jobResult":"org.apache.cloudstack.api.response.SuccessResponse/null/{\"success\":true}","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"}
payload_bytes: 968
payload_encoding: string
redelivered: True

--------------------------------------------------------------------------------

* pr/782:
  CLOUDSTACK-8816 Systemvm reboot event doesnt have uuids. Fixed the same
  CLOUDSTACK-8816: Project UUID is not showing for some of operations in RabbitMQ.
  CLOUDSTACK-8816: entity uuid missing in create network event
  CLOUDSTACK-8816: instance uuid is missing in events for delete account
  CLOUDSTACK-8816 Fixed entityUuid missing in some cases is events

Signed-off-by: Rajani Karuturi <ra...@citrix.com>


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

Branch: refs/heads/master
Commit: f888e93e440589756f4cf41b6c9b8a9facbfa471
Parents: 120e1cc 3588464
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Mon Sep 14 09:42:42 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Mon Sep 14 09:42:44 2015 +0530

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java         | 28 +++++++-------
 .../command/admin/account/DeleteAccountCmd.java |  5 +++
 .../apache/cloudstack/context/CallContext.java  | 10 +++++
 .../orchestration/NetworkOrchestrator.java      |  1 +
 server/src/com/cloud/api/ApiDispatcher.java     |  9 +++++
 server/src/com/cloud/api/ApiServer.java         | 15 ++++----
 .../cloud/api/dispatch/ParamProcessWorker.java  |  4 +-
 .../com/cloud/event/ActionEventInterceptor.java |  2 +-
 .../src/com/cloud/event/ActionEventUtils.java   | 40 ++++----------------
 .../com/cloud/projects/ProjectManagerImpl.java  |  1 +
 .../com/cloud/server/ManagementServerImpl.java  |  1 -
 .../storage/snapshot/SnapshotManagerImpl.java   |  2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |  2 +-
 13 files changed, 59 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f888e93e/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------


[4/6] git commit: updated refs/heads/master to f888e93

Posted by ra...@apache.org.
CLOUDSTACK-8816: instance uuid is missing in events for delete account

instance uuid is populated from the getInstanceId of the command which
is returning null. returning the correct value now.


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

Branch: refs/heads/master
Commit: 0d1266648214cb0a007046916bd5af2ea1f692bf
Parents: 37c3451
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Mon Sep 7 17:18:01 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 9 14:23:28 2015 +0530

----------------------------------------------------------------------
 .../cloudstack/api/command/admin/account/DeleteAccountCmd.java  | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0d126664/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index 5754ec5..2a2e16d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -114,4 +114,9 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
     public ApiCommandJobType getInstanceType() {
         return ApiCommandJobType.Account;
     }
+
+    @Override
+    public Long getInstanceId() {
+        return id;
+    }
 }


[3/6] git commit: updated refs/heads/master to f888e93

Posted by ra...@apache.org.
CLOUDSTACK-8816: entity uuid missing in create network event

*Before*

|                      routing_key                       |     exchange      | message_count |                                                                                                                               payload                                                                                                                               | payload_bytes | payload_encoding | redelivered |
| management-server.ActionEvent.NETWORK-CREATE.Network.* | cloudstack-events | 0             | {"eventDateTime":"2015-09-09 09:35:02 +0530","status":"Completed","description":"Successfully completed creating network. Network Id: 206","event":"NETWORK.CREATE","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"} | 259           | string           | False       |

*After*

|                                                    routing_key                                                    |     exchange      | message_count |                                                                                                                                                                           payload                                                                                                                                                                            | payload_bytes | payload_encoding | redelivered |
| management-server.ActionEvent.NETWORK-CREATE.Network.c9ed8d0d-6e58-456e-be58-28bb809f0b3a                         | cloudstack-events | 52            | {"eventDateTime":"2015-09-09 10:12:37 +0530","status":"Completed","description":"Successfully completed creating network. Network Id: 210","event":"NETWORK.CREATE","entityuuid":"c9ed8d0d-6e58-456e-be58-28bb809f0b3a","entity":"com.cloud.network.Network","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"} | 348           | string           | False       |


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

Branch: refs/heads/master
Commit: b12d4730a6a3b0654c52a6ea3f0b5b75cd37d841
Parents: 0d12666
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Wed Sep 9 10:34:04 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Wed Sep 9 14:23:28 2015 +0530

----------------------------------------------------------------------
 .../apache/cloudstack/engine/orchestration/NetworkOrchestrator.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b12d4730/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 50ddc59..2a87bf5 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -2083,6 +2083,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         });
 
         CallContext.current().setEventDetails("Network Id: " + network.getId());
+        CallContext.current().putContextParameter(Network.class, network.getUuid());
         return network;
     }