@@ -8208,22 +8208,16 @@ private void postProcessingUnmanageVM(UserVmVO vm) {
82088208 Long cpu = offering .getCpu () != null ? new Long (offering .getCpu ()) : 0L ;
82098209 Long ram = offering .getRamSize () != null ? new Long (offering .getRamSize ()) : 0L ;
82108210 // First generate a VM stop event if the VM was not stopped already
8211- boolean resourceCountNotDecremented = true ;
82128211 if (vm .getState () != State .Stopped ) {
82138212 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VM_STOP , vm .getAccountId (), vm .getDataCenterId (),
82148213 vm .getId (), vm .getHostName (), vm .getServiceOfferingId (), vm .getTemplateId (),
82158214 vm .getHypervisorType ().toString (), VirtualMachine .class .getName (), vm .getUuid (), vm .isDisplayVm ());
8216- resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), cpu , ram );
8217- resourceCountNotDecremented = false ;
82188215 }
8219-
82208216 // VM destroy usage event
82218217 UsageEventUtils .publishUsageEvent (EventTypes .EVENT_VM_DESTROY , vm .getAccountId (), vm .getDataCenterId (),
82228218 vm .getId (), vm .getHostName (), vm .getServiceOfferingId (), vm .getTemplateId (),
82238219 vm .getHypervisorType ().toString (), VirtualMachine .class .getName (), vm .getUuid (), vm .isDisplayVm ());
8224- if (resourceCountNotDecremented ) {
8225- resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), cpu , ram );
8226- }
8220+ resourceCountDecrement (vm .getAccountId (), vm .isDisplayVm (), cpu , ram );
82278221 }
82288222
82298223 /*
0 commit comments