@@ -7400,20 +7400,21 @@ private void removeVMFromAffinityGroups(long vmId) {
74007400 */
74017401 private void postProcessingUnmanageVM (UserVmVO vm ) {
74027402 ServiceOfferingVO offering = _serviceOfferingDao .findById (vm .getServiceOfferingId ());
7403-
7403+ Long cpu = offering .getCpu () != null ? new Long (offering .getCpu ()) : 0L ;
7404+ Long ram = offering .getRamSize () != null ? new Long (offering .getRamSize ()) : 0L ;
74047405 // First generate a VM stop event if the VM was not stopped already
74057406 if (vm .getState () != State .Stopped ) {
74067407 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VM_STOP , vm .getAccountId (), vm .getDataCenterId (),
74077408 vm .getId (), vm .getHostName (), vm .getServiceOfferingId (), vm .getTemplateId (),
74087409 vm .getHypervisorType ().toString (), VirtualMachine .class .getName (), vm .getUuid (), vm .isDisplayVm ());
7409- resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), new Long ( offering . getCpu ()), new Long ( offering . getRamSize ()) );
7410+ resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), cpu , ram );
74107411 }
74117412
74127413 // VM destroy usage event
74137414 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VM_DESTROY , vm .getAccountId (), vm .getDataCenterId (),
74147415 vm .getId (), vm .getHostName (), vm .getServiceOfferingId (), vm .getTemplateId (),
74157416 vm .getHypervisorType ().toString (), VirtualMachine .class .getName (), vm .getUuid (), vm .isDisplayVm ());
7416- resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), new Long ( offering . getCpu ()), new Long ( offering . getRamSize ()) );
7417+ resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), cpu , ram );
74177418 }
74187419
74197420 /*
0 commit comments