Add pre/post-state transition status to messages published on event bus by UserVmStateListener. Allow system VM resource state post-transitions to be published.

This commit is contained in:
jeff 2014-04-21 14:47:12 +00:00 committed by Murali Reddy
parent 06d510abcc
commit 9c4de764f7
1 changed files with 3 additions and 2 deletions

View File

@ -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);