DaanHoogland commented on code in PR #8545:
URL: https://github.com/apache/cloudstack/pull/8545#discussion_r1492238305


##########
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java:
##########
@@ -2208,9 +2208,11 @@ private void advanceStop(final VMInstanceVO vm, final 
boolean cleanUpEvenIfUnabl
 
             boolean result = stateTransitTo(vm, Event.OperationSucceeded, 
null);
             if (result) {
+                vm.setPowerState(PowerState.PowerOff);
+                _vmDao.update(vm.getId(), vm);
                 if (VirtualMachine.Type.User.equals(vm.type) && 
ResourceCountRunningVMsonly.value()) {
                     ServiceOfferingVO offering = 
_offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
-                    resourceCountDecrement(vm.getAccountId(),new 
Long(offering.getCpu()), new Long(offering.getRamSize()));
+                    resourceCountDecrement(vm.getAccountId(), 
offering.getCpu().longValue(), offering.getRamSize().longValue());

Review Comment:
   ok, guys, I agree i think, if we get an NPE a check would not help us take 
measure against it. decreasing by 0 (zero) does not make sense either.
   
   Any improvement on this would be out of scope for this PR and I think it 
might not be high prio (just good to keep in mind)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to