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.3 to 2b2d599
Date Mon, 06 Jan 2014 12:57:01 GMT
Updated Branches:
  refs/heads/4.3 7fc3c4fd1 -> 2b2d5998d


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/2b2d5998
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2b2d5998
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2b2d5998

Branch: refs/heads/4.3
Commit: 2b2d5998d7735d8c01ba015629e56a2034673c87
Parents: 7fc3c4f
Author: Koushik Das <koushik@apache.org>
Authored: Mon Jan 6 18:19:06 2014 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Mon Jan 6 18:19:06 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/2b2d5998/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 9ac549c..d069c01 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -456,7 +456,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()))
{
@@ -1525,13 +1525,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);
@@ -2132,7 +2134,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());
@@ -2693,7 +2695,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;
@@ -4207,7 +4209,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