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
This commit is contained in:
Spaceman1984 2020-09-01 12:23:52 +02:00 committed by GitHub
parent d5acabdbf7
commit cb717741fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1658,6 +1658,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
guru.finalizeStop(profile, answer);
final UserVmVO userVm = _userVmDao.findById(vm.getId());
userVm.setPowerState(PowerState.PowerOff);
_userVmDao.update(userVm.getId(), userVm);
} else {
s_logger.error("Invalid answer received in response to a StopCommand for " + vm.getInstanceName());
return false;