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/master to 6d75c31
Date Tue, 07 Jan 2014 09:06:18 GMT
Updated Branches:
  refs/heads/master 05df0cb82 -> 6d75c3195


CLOUDSTACK-5002: unable to destroy vm ;VM destroy failed in Stop i-2-59-VM Command due to
You gave an invalid object reference. The object may have recently been deleted.

This is happening as concurrent operations are happening on the same VM. Earlier this was
not seen as all vm operations were synchronized at agent layer. By making execute.in.sequence
global config to false this restriction is no longer there. In the latest code operations
to a single vm are synchronized by maintaining a job queue. In some scenarios the destroy
vm operation
was not going through this job queue mechanism and so was resulting in failures due to simultaneous
operations.


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

Branch: refs/heads/master
Commit: 6d75c319582b17ae76d26c1052d29264a0d22c52
Parents: 05df0cb
Author: Koushik Das <koushik@apache.org>
Authored: Mon Jan 6 18:19:06 2014 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Tue Jan 7 14:23:26 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d75c319/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 2cf8ea2..cd4e327 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -458,7 +458,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             return;
         }
 
-        advanceStop(vm, false);
+        advanceStop(vm.getUuid(), false);
 
         try {
             if (!stateTransitTo(vm, VirtualMachine.Event.ExpungeOperation, vm.getHostId()))
{
@@ -1493,13 +1493,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             s_logger.debug("Destroying vm " + vm);
         }
 
-        advanceStop(vm, VmDestroyForcestop.value());
+        advanceStop(vmUuid, VmDestroyForcestop.value());
 
         if (!_vmSnapshotMgr.deleteAllVMSnapshots(vm.getId(), null)) {
             s_logger.debug("Unable to delete all snapshots for " + vm);
             throw new CloudRuntimeException("Unable to delete vm snapshots for " + vm);
         }
 
+        // reload the vm object from db
+        vm = _vmDao.findByUuid(vmUuid);
         try {
             if (!stateTransitTo(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId()))
{
                 s_logger.debug("Unable to destroy the vm because it is not in the correct
state: " + vm);
@@ -2100,7 +2102,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             }
 
             try {
-                advanceStop(vm, true);
+                advanceStop(vmUuid, true);
                 throw new CloudRuntimeException("Unable to migrate " + vm);
             } catch (ResourceUnavailableException e) {
                 s_logger.debug("Unable to stop VM due to " + e.getMessage());
@@ -2658,7 +2660,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         if (agentState == State.Shutdowned) {
             if (serverState == State.Running || serverState == State.Starting || serverState
== State.Stopping) {
                 try {
-                    advanceStop(vm, true);
+                    advanceStop(vm.getUuid(), true);
                 } catch (AgentUnavailableException e) {
                     assert (false) : "How do we hit this with forced on?";
                     return null;
@@ -4205,7 +4207,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                 _vmDao.lockRow(vm.getId(), true);
 
                 List<VmWorkJobVO> pendingWorkJobs = _workJobDao.listPendingWorkJobs(
-                        VirtualMachine.Type.Instance, vm.getId(),
+                        vm.getType(), vm.getId(),
                         VmWorkStop.class.getName());
 
                 VmWorkJobVO workJob = null;


Mime
View raw message