Fix a NPE in AbstractStoragePoolAllocator.java when creating standalone volume

This commit is contained in:
Kelven Yang 2010-09-15 13:38:22 -07:00 committed by edison
parent 72e8b767fe
commit 2337a9d99f
1 changed files with 3 additions and 1 deletions

View File

@ -146,9 +146,11 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
}
/*hypervisor type is correct*/
// TODO : when creating a standalone volume, offering is passed as NULL, need to
// refine the logic of checking hypervisorType based on offering info
Long clusterId = pool.getClusterId();
ClusterVO cluster = _clusterDao.findById(clusterId);
if (!cluster.getHypervisorType().equalsIgnoreCase(offering.gethypervisorType())) {
if (offering != null && !cluster.getHypervisorType().equalsIgnoreCase(offering.gethypervisorType())) {
return false;
}
// check the used size against the total size, skip this host if it's greater than the configured