|
27 | 27 | import javax.inject.Inject; |
28 | 28 | import javax.naming.ConfigurationException; |
29 | 29 |
|
| 30 | +import org.apache.log4j.Logger; |
| 31 | + |
30 | 32 | import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; |
31 | 33 | import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; |
32 | 34 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
33 | 35 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
34 | | -import org.apache.log4j.Logger; |
35 | 36 |
|
36 | 37 | import com.cloud.dc.ClusterVO; |
37 | 38 | import com.cloud.dc.dao.ClusterDao; |
@@ -171,10 +172,17 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, |
171 | 172 | } |
172 | 173 |
|
173 | 174 | Long clusterId = pool.getClusterId(); |
174 | | - ClusterVO cluster = _clusterDao.findById(clusterId); |
175 | | - if (!(cluster.getHypervisorType() == dskCh.getHypervisorType())) { |
| 175 | + if (clusterId != null) { |
| 176 | + ClusterVO cluster = _clusterDao.findById(clusterId); |
| 177 | + if (!(cluster.getHypervisorType() == dskCh.getHypervisorType())) { |
| 178 | + if (s_logger.isDebugEnabled()) { |
| 179 | + s_logger.debug("StoragePool's Cluster does not have required hypervisorType, skipping this pool"); |
| 180 | + } |
| 181 | + return false; |
| 182 | + } |
| 183 | + } else if (pool.getHypervisor() != null && !(pool.getHypervisor() == dskCh.getHypervisorType())) { |
176 | 184 | if (s_logger.isDebugEnabled()) { |
177 | | - s_logger.debug("StoragePool's Cluster does not have required hypervisorType, skipping this pool"); |
| 185 | + s_logger.debug("StoragePool does not have required hypervisorType, skipping this pool"); |
178 | 186 | } |
179 | 187 | return false; |
180 | 188 | } |
|
0 commit comments