CLOUDSTACK-3545: NPE in listStoragePoolsForMigration api. The volume table no longer holds

the pod id, the column is null now. Made a change to get the pod id from the storage pool
on which the volume resides.
This commit is contained in:
Devdeep Singh 2013-07-16 12:01:28 +05:30
parent 2f85c80655
commit c59c736f98
1 changed files with 2 additions and 3 deletions

View File

@ -1254,11 +1254,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
// Get all the pools available. Only shared pools are considered because only a volume on a shared pools
// can be live migrated while the virtual machine stays on the same host.
List<StoragePoolVO> storagePools = null;
if (srcVolumePool.getClusterId() == null) {
storagePools = _poolDao.findZoneWideStoragePoolsByTags(volume.getDataCenterId(), null);
} else {
storagePools = _poolDao.findPoolsByTags(volume.getDataCenterId(), volume.getPodId(), srcVolumePool.getClusterId(), null);
storagePools = _poolDao.findPoolsByTags(volume.getDataCenterId(), srcVolumePool.getPodId(), srcVolumePool.getClusterId(), null);
}
storagePools.remove(srcVolumePool);
@ -1274,7 +1273,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
avoid.addPool(srcVolumePool.getId());
// Volume stays in the same cluster after migration.
DataCenterDeployment plan = new DataCenterDeployment(volume.getDataCenterId(), volume.getPodId(),
DataCenterDeployment plan = new DataCenterDeployment(volume.getDataCenterId(), srcVolumePool.getPodId(),
srcVolumePool.getClusterId(), null, null, null);
VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);