CLOUDSTACK-3759 [Automation] Failed to attach volume to VM, while vm are in stopped state Fix the null pointer.

Signed-off-by: Edison Su <sudison@gmail.com>
This commit is contained in:
Fang Wang 2013-07-25 16:03:56 -07:00 committed by Edison Su
parent 2e0f11f15f
commit 8f7b90badf
1 changed files with 4 additions and 0 deletions

View File

@ -1543,6 +1543,10 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
}
private boolean needMoveVolume(VolumeVO rootVolumeOfVm, VolumeInfo volume) {
if (rootVolumeOfVm.getPoolId() == null || volume.getPoolId() == null) {
return false;
}
DataStore storeForRootVol = dataStoreMgr.getPrimaryDataStore(rootVolumeOfVm.getPoolId());
DataStore storeForDataVol = dataStoreMgr.getPrimaryDataStore(volume.getPoolId());