bug 8124: log VM.STOP usage event for user Vms only

status 8124: resolved fixed
This commit is contained in:
kishan 2011-01-25 16:54:58 +05:30
parent 00ebbbed6d
commit e5b2b396ec
1 changed files with 4 additions and 2 deletions

View File

@ -824,8 +824,10 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager {
if (!stopped) {
throw new CloudRuntimeException("Unable to stop the virtual machine due to " + answer.getDetails());
} else {
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_STOP, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), vm.getName(), vm.getServiceOfferingId(), vm.getTemplateId(), null);
_usageEventDao.persist(usageEvent);
if(vm.getType() == VirtualMachine.Type.User){
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_STOP, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), vm.getName(), vm.getServiceOfferingId(), vm.getTemplateId(), null);
_usageEventDao.persist(usageEvent);
}
}
vmGuru.finalizeStop(profile, answer);