You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/07/31 02:09:21 UTC
git commit: updated refs/heads/4.2 to af95cfe
Updated Branches:
refs/heads/4.2 32d076ebc -> af95cfe98
CLOUDSTACK-3942 NPE from findStoragePool method
Changes:
- Added null checks for podId
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/af95cfe9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/af95cfe9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/af95cfe9
Branch: refs/heads/4.2
Commit: af95cfe98e5e17f86ae6d0df3cf363b3ba210e0a
Parents: 32d076e
Author: Prachi Damle <pr...@cloud.com>
Authored: Tue Jul 30 16:55:32 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Tue Jul 30 16:56:21 2013 -0700
----------------------------------------------------------------------
server/src/com/cloud/storage/StorageManagerImpl.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af95cfe9/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 5cf2b54..f49d20d 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -406,6 +406,16 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
public StoragePool findStoragePool(DiskProfile dskCh, final DataCenterVO dc, HostPodVO pod, Long clusterId, Long hostId, VMInstanceVO vm,
final Set<StoragePool> avoid) {
+ Long podId = null;
+ if (pod != null) {
+ podId = pod.getId();
+ } else if (clusterId != null) {
+ ClusterVO cluster = _clusterDao.findById(clusterId);
+ if (cluster != null) {
+ podId = cluster.getPodId();
+ }
+ }
+
VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
for (StoragePoolAllocator allocator : _storagePoolAllocators) {
@@ -413,7 +423,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
for (StoragePool pool : avoid) {
avoidList.addPool(pool.getId());
}
- DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), clusterId, hostId, null, null);
+ DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), podId, clusterId, hostId, null, null);
final List<StoragePool> poolList = allocator.allocateToPool(dskCh, profile, plan, avoidList, 1);
if (poolList != null && !poolList.isEmpty()) {