bug 12798: when VM is stopped, when sending command to storage pool, make sure last_host is tried first

This commit is contained in:
Kelven Yang 2012-01-06 19:15:15 -08:00
parent bde008ed7e
commit 89d0e29797
1 changed files with 6 additions and 2 deletions

View File

@ -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<Long> hostIdsToAvoid = new ArrayList<Long>();