CLOUDSTACK-6467: Add pre/post-state transition status to messages published on

... event bus by UserVmStateListener. Allow system VM resource state
post-transitions to be published.

(cherry picked from commit 9c4de764f74bffd5cd547f8514d4a6897fb961c2)
Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>

Conflicts:
        server/src/com/cloud/vm/UserVmStateListener.java

Conflicts:
        server/src/com/cloud/vm/UserVmStateListener.java


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

Branch: refs/heads/4.4
Commit: e9d079ace107f3de4d8260b9397b0fd11764944a
Parents: 6455a69
Author: jeff <j...@greenqloud.com>
Authored: Mon Apr 21 14:47:12 2014 +0000
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Thu Dec 11 20:45:40 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmStateListener.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9d079ac/server/src/com/cloud/vm/UserVmStateListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmStateListener.java 
b/server/src/com/cloud/vm/UserVmStateListener.java
index 202391f..6631ca3 100644
--- a/server/src/com/cloud/vm/UserVmStateListener.java
+++ b/server/src/com/cloud/vm/UserVmStateListener.java
@@ -77,12 +77,12 @@ public class UserVmStateListener implements 
StateListener<State, VirtualMachine.
             return false;
         }
 
+        pubishOnEventBus(event.name(), "postStateTransitionEvent", vo, 
oldState, newState);
+
         if (vo.getType() != VirtualMachine.Type.User) {
             return true;
         }
 
-        pubishOnEventBus(event.name(), "postStateTransitionEvent", vo, 
oldState, newState);
-
         if (VirtualMachine.State.isVmCreated(oldState, event, newState)) {
             generateUsageEvent(vo.getServiceOfferingId(), vo, 
EventTypes.EVENT_VM_CREATE);
         } else if (VirtualMachine.State.isVmStarted(oldState, event, 
newState)) {
@@ -128,6 +128,7 @@ public class UserVmStateListener implements 
StateListener<State, VirtualMachine.
         eventDescription.put("id", vo.getUuid());
         eventDescription.put("old-state", oldState.name());
         eventDescription.put("new-state", newState.name());
+        eventDescription.put("status", status);
 
         String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss 
Z").format(new Date());
         eventDescription.put("eventDateTime", eventDate);

Reply via email to