cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject git commit: updated refs/heads/4.5 to 788fe5a
Date Mon, 22 Dec 2014 07:11:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 c5d3a73c6 -> 788fe5a27


CLOUDSTACK-8103: Vmsync marks VM as stopped even after failing to stop it in HV
During vmsync if StopCommand (issued as part of PowerOff/PowerMissing report) fails to stop
VM (since VM is running on HV),
don't transition VM state to "Stopped" in CS db. Also added a check to throw ConcurrentOperationException
if vm state is not
"Running" after start operation.


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

Branch: refs/heads/4.5
Commit: 788fe5a27365e57508e0c1c967da46da0314e3e4
Parents: c5d3a73
Author: Koushik Das <koushik@apache.org>
Authored: Mon Dec 22 10:52:13 2014 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Mon Dec 22 12:31:34 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java           | 5 ++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java                | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/788fe5a2/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 c87b772..ab5f6a3 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3688,7 +3688,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 
             VirtualMachineGuru vmGuru = getVmGuru(vm);
             VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
-            sendStop(vmGuru, profile, true, true);
+            if (!sendStop(vmGuru, profile, true, true)) {
+                // In case StopCommand fails, don't proceed further
+                return;
+            }
 
             try {
                 stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOffReport, null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/788fe5a2/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 4e64524..3f539b2 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3194,6 +3194,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         try {
             vmParamPair = startVirtualMachine(vmId, hostId, additonalParams, deploymentPlannerToUse);
             vm = vmParamPair.first();
+
+            // At this point VM should be in "Running" state
+            UserVmVO tmpVm = _vmDao.findById(vm.getId());
+            if (!tmpVm.getState().equals(State.Running)) {
+                // Some other thread changed state of VM, possibly vmsync
+                throw new ConcurrentOperationException("VM " + tmpVm + " unexpectedly went
to " + tmpVm.getState() + " state");
+            }
         } finally {
             updateVmStateForFailedVmCreation(vm.getId(), hostId);
         }


Mime
View raw message