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:53:52 UTC
git commit: updated refs/heads/master to a8360e4
Updated Branches:
refs/heads/master c2192808a -> a8360e41c
CLOUDSTACK-3942 NPE from findStoragePool method
Changes:
- Added null checks for podId
Conflicts:
server/src/com/cloud/storage/StorageManagerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a8360e41
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a8360e41
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a8360e41
Branch: refs/heads/master
Commit: a8360e41c0c99793b1f6b0a4e0cb10dbc3d00a9c
Parents: c219280
Author: Prachi Damle <pr...@cloud.com>
Authored: Tue Jul 30 17:14:04 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Tue Jul 30 17:53:31 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/a8360e41/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 a8cfcc0..25ef70b 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -403,6 +403,16 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
@Override
public StoragePool findStoragePool(DiskProfile dskCh, final DataCenterVO dc, Pod 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 profile = new VirtualMachineProfileImpl(vm);
for (StoragePoolAllocator allocator : _storagePoolAllocators) {
@@ -410,7 +420,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()) {