From 0c4191bb753743ad4c6d09fca9328f33f0bc227d Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Mon, 19 Mar 2012 17:14:03 +0000 Subject: [PATCH] Bug 14370 - addSecondaryStorage always fails: "Can't find pod with specificied podId null" status 14370: resolved fixed --- .../com/cloud/resource/ResourceManagerImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index a4f5e9dde40..a88778b7a38 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -568,15 +568,12 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma throw ex; } - HostPodVO pod = _podDao.findById(podId); - if (pod == null) { - throw new InvalidParameterValueException("Can't find pod with specified podId " + podId); - } // Check if the pod exists in the system if (podId != null) { - if (_podDao.findById(podId) == null) { - throw new InvalidParameterValueException("Can't find pod by id " + podId); + HostPodVO pod = _podDao.findById(podId); + if (pod == null) { + throw new InvalidParameterValueException("Can't find pod by id " + podId); } // check if pod belongs to the zone if (!Long.valueOf(pod.getDataCenterId()).equals(dcId)) { @@ -626,7 +623,11 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma } if (clusterName != null) { - ClusterVO cluster = new ClusterVO(dcId, podId, clusterName); + HostPodVO pod = _podDao.findById(podId); + if (pod == null) { + throw new InvalidParameterValueException("Can't find pod by id " + podId); + } + ClusterVO cluster = new ClusterVO(dcId, podId, clusterName); cluster.setHypervisorType(hypervisorType); try { cluster = _clusterDao.persist(cluster);