cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to 145b4a1
Date Tue, 23 Dec 2014 15:08:21 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 79fc9d268 -> 145b4a1f2


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.

(cherry picked from commit 788fe5a27365e57508e0c1c967da46da0314e3e4)


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

Branch: refs/heads/4.4
Commit: 145b4a1f2c46aa6c50c8abf191d6d08a78f3a1fb
Parents: 79fc9d2
Author: Koushik Das <koushik@apache.org>
Authored: Mon Dec 22 10:52:13 2014 +0530
Committer: Daan Hoogland <daan@onecht.net>
Committed: Tue Dec 23 16:04:46 2014 +0100

----------------------------------------------------------------------
 .../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/145b4a1f/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 91af527..ecdffa6 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -4288,7 +4288,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/145b4a1f/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 712aa19..93e99eb 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3122,6 +3122,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