Skip to content

Commit cb71774

Browse files
authored
server: Fixed delayed power state update after vm shutdown (#4284)
After a vm is shutdown, the power state isn't updated immediately. This prevents changing the service offering. This PR updates the power state immediately after the vm is confirmed to be shutdown. Fixes: #3159
1 parent d5acabd commit cb71774

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,9 @@ protected boolean sendStop(final VirtualMachineGuru guru, final VirtualMachinePr
16581658
}
16591659

16601660
guru.finalizeStop(profile, answer);
1661+
final UserVmVO userVm = _userVmDao.findById(vm.getId());
1662+
userVm.setPowerState(PowerState.PowerOff);
1663+
_userVmDao.update(userVm.getId(), userVm);
16611664
} else {
16621665
s_logger.error("Invalid answer received in response to a StopCommand for " + vm.getInstanceName());
16631666
return false;

0 commit comments

Comments
 (0)