cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject git commit: updated refs/heads/4.1 to 8001e27
Date Sat, 17 Aug 2013 05:25:14 GMT
Updated Branches:
  refs/heads/4.1 ba90fa91d -> 8001e270b


CLOUDSTACK-4379: Reset VM states when host is removed from cluster

   If you shut down the agent while VMs are running, the management
server assumes that the VMs are continuing to run. You can then
delete the host while it is in 'disconnected' state, and those VMs
will be unusable, forever in running state. They can't change state
because the host no longer exists. This patch checks for any VMs
that may have been tied to the removed host and resets their state
so that cloudstack can continue to manage them.


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

Branch: refs/heads/4.1
Commit: 8001e270bb157cd50c252fe5a38ec70c84451ad8
Parents: ba90fa9
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Fri Aug 16 23:22:15 2013 -0600
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Fri Aug 16 23:22:15 2013 -0600

----------------------------------------------------------------------
 server/src/com/cloud/resource/ResourceManagerImpl.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8001e270/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index bd454cb..18ff6d8 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -955,6 +955,16 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         // Delete the associated entries in host ref table
         _storagePoolHostDao.deletePrimaryRecordsForHost(hostId);
 
+
+       // Make sure any VMs that were marked as being on this host are cleaned up
+       List<VMInstanceVO> vms = _vmDao.listByHostId(hostId);
+       for (VMInstanceVO vm : vms) {
+          // this is how VirtualMachineManagerImpl does it when it syncs VM states
+          vm.setState(State.Stopped);
+          vm.setHostId(null);
+          _vmDao.persist(vm);
+       }
+
 		// For pool ids you got, delete local storage host entries in pool table
 		// where
         for (StoragePoolHostVO pool : pools) {


Mime
View raw message