fix migration npe when recovering

This commit is contained in:
Alex Huang 2011-07-09 08:31:44 -07:00
parent ccc12793c6
commit 852cf0e6c7

View File

@ -261,9 +261,11 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
@Override
public boolean scheduleMigration(final VMInstanceVO vm) {
final HaWorkVO work = new HaWorkVO(vm.getId(), vm.getType(), WorkType.Migration, Step.Scheduled, vm.getHostId(), vm.getState(), 0, vm.getUpdated());
_haDao.persist(work);
wakeupWorkers();
if (vm.getHostId() != null) {
final HaWorkVO work = new HaWorkVO(vm.getId(), vm.getType(), WorkType.Migration, Step.Scheduled, vm.getHostId(), vm.getState(), 0, vm.getUpdated());
_haDao.persist(work);
wakeupWorkers();
}
return true;
}