CLOUDSTACK-4627: fix NPE in vm migration

This commit is contained in:
Edison Su 2013-09-09 15:58:22 -07:00
parent 37c87a84fa
commit cb170d6afd
1 changed files with 2 additions and 1 deletions

View File

@ -2657,7 +2657,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
public boolean canVmRestartOnAnotherServer(long vmId) {
List<VolumeVO> vols = _volsDao.findCreatedByInstance(vmId);
for (VolumeVO vol : vols) {
if (!vol.isRecreatable() && !vol.getPoolType().isShared()) {
StoragePoolVO storagePoolVO = _storagePoolDao.findById(vol.getPoolId());
if (!vol.isRecreatable() && storagePoolVO != null && storagePoolVO.getPoolType() != null && !(storagePoolVO.getPoolType().isShared())) {
return false;
}
}