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


##########
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:
   yes, the method has been used in many places, it works well.
   No need to add a null check I think.
   
   anyway , good question @DaanHoogland 



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