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


##########
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:
   `new Long(null)` also throws a NPE. So, this is not really relevant to this 
PR but a minor code improvement.



-- 
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