mirror of https://github.com/apache/cloudstack.git
bug 10503: Skip usage events when StopAnswer details is Vm does not exist
status 10503: resolved fixed
This commit is contained in:
parent
12068f957c
commit
9a6c567269
|
|
@ -3003,7 +3003,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
synchronized (_vms) {
|
||||
_vms.remove(vmName);
|
||||
}
|
||||
return new StopAnswer(cmd, "VM does not exist");
|
||||
return new StopAnswer(cmd, "VM does not exist", 0 , 0L, 0L);
|
||||
}
|
||||
Long bytesSent = 0L;
|
||||
Long bytesRcvd = 0L;
|
||||
|
|
|
|||
|
|
@ -2807,6 +2807,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<UserVmVO> profile, StopAnswer answer) {
|
||||
if("VM does not exist".equals(answer.getDetails())){
|
||||
// Stop answer returns true when Vm does not exist.
|
||||
// This is a hack to avoid logging usage events
|
||||
return;
|
||||
}
|
||||
VMInstanceVO vm = profile.getVirtualMachine();
|
||||
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_STOP, vm.getAccountId(), vm.getDataCenterIdToDeployIn(), vm.getId(), vm.getHostName());
|
||||
_usageEventDao.persist(usageEvent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue