You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/09/01 10:24:16 UTC

[cloudstack] branch master updated: server: Fixed delayed power state update after vm shutdown (#4284)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new cb71774  server: Fixed delayed power state update after vm shutdown (#4284)
cb71774 is described below

commit cb717741fc26662551458f9aa5ceb459884b7a6f
Author: Spaceman1984 <49...@users.noreply.github.com>
AuthorDate: Tue Sep 1 12:23:52 2020 +0200

    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
---
 .../src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java          | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index 7ffd023..b8342b4 100755
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -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;