pass NULL host when performing state transition to follow-up with VM power-off 
report


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/38a13001
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/38a13001
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/38a13001

Branch: refs/heads/master
Commit: 38a13001419cdd7e454b52bd2b26c568771cf980
Parents: 9f0d1ce
Author: Kelven Yang <[email protected]>
Authored: Fri Feb 7 11:49:39 2014 -0800
Committer: Kelven Yang <[email protected]>
Committed: Fri Feb 28 15:35:58 2014 -0800

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38a13001/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index fa0540e..246b43a 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1559,11 +1559,15 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
     @Override
     public boolean stateTransitTo(VirtualMachine vm1, VirtualMachine.Event e, 
Long hostId) throws NoTransitionException {
         VMInstanceVO vm = (VMInstanceVO)vm1;
-        // if there are active vm snapshots task, state change is not allowed
-        if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) {
-            s_logger.error("State transit with event: " + e + " failed due to: 
" + vm.getInstanceName() + " has active VM snapshots tasks");
-            return false;
-        }
+
+        /*
+         *  Remove the hacking logic here.
+                // if there are active vm snapshots task, state change is not 
allowed
+                if (_vmSnapshotMgr.hasActiveVMSnapshotTasks(vm.getId())) {
+                    s_logger.error("State transit with event: " + e + " failed 
due to: " + vm.getInstanceName() + " has active VM snapshots tasks");
+                    return false;
+                }
+        */
 
         State oldState = vm.getState();
         if (oldState == State.Starting) {
@@ -4172,7 +4176,7 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
         case Migrating:
             s_logger.info("VM " + vm.getInstanceName() + " is at " + 
vm.getState() + " and we received a power-off report while there is no pending 
jobs on it");
             try {
-                stateTransitTo(vm, 
VirtualMachine.Event.FollowAgentPowerOffReport, vm.getPowerHostId());
+                stateTransitTo(vm, 
VirtualMachine.Event.FollowAgentPowerOffReport, null);
             } catch (NoTransitionException e) {
                 s_logger.warn("Unexpected VM state transition exception, 
race-condition?", e);
             }

Reply via email to