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 9c4de764f7)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/vm/UserVmStateListener.java
This commit is contained in:
jeff 2014-04-21 14:47:12 +00:00 committed by Rohit Yadav
parent 7e5c7d488a
commit af79d6aaf7
1 changed files with 5 additions and 4 deletions

View File

@ -72,12 +72,12 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
if(!status){
return false;
}
if(vo.getType() != VirtualMachine.Type.User){
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);
@ -135,6 +135,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);