From 89d0e2979780751471b4166dab419e270c9ee53a Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 6 Jan 2012 19:15:15 -0800 Subject: [PATCH] bug 12798: when VM is stopped, when sending command to storage pool, make sure last_host is tried first --- .../com/cloud/storage/snapshot/SnapshotManagerImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index abe167d7111..6ee569d3ca0 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -232,8 +232,12 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma VMInstanceVO vm = _vmDao.findById(vol.getInstanceId()); long[] hostIdsToTryFirst = null; - if (vm != null && vm.getHostId() != null) { - hostIdsToTryFirst = new long[] { vm.getHostId() }; + if (vm != null) { + if(vm.getHostId() != null) { + hostIdsToTryFirst = new long[] { vm.getHostId() }; + } else if(vm.getLastHostId() != null) { + hostIdsToTryFirst = new long[] { vm.getLastHostId() }; + } } List hostIdsToAvoid = new ArrayList();