mirror of https://github.com/apache/cloudstack.git
Add sanity check to allow only adding the right hypervisor hosts to the matched cluster
This commit is contained in:
parent
8ec1a329bf
commit
4be13ee8a4
File diff suppressed because it is too large
Load Diff
|
|
@ -185,6 +185,14 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
|
|||
public Map<? extends ServerResource, Map<String, String>> find(long dcId,
|
||||
Long podId, Long clusterId, URI uri, String username,
|
||||
String password) throws DiscoveryException {
|
||||
|
||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||
if(cluster == null || cluster.getHypervisorType() != HypervisorType.KVM) {
|
||||
if(s_logger.isInfoEnabled())
|
||||
s_logger.info("invalid cluster id or cluster is not for KVM hypervisors");
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<KvmDummyResourceBase, Map<String, String>> resources = new HashMap<KvmDummyResourceBase, Map<String, String>>();
|
||||
Map<String, String> details = new HashMap<String, String>();
|
||||
if (!uri.getScheme().equals("http")) {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,13 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
throw new RuntimeException(msg);
|
||||
}
|
||||
|
||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||
if(cluster == null || (cluster.getHypervisorType() != HypervisorType.XenServer && cluster.getHypervisorType() != HypervisorType.Xen)) {
|
||||
if(s_logger.isInfoEnabled())
|
||||
s_logger.info("invalid cluster id or cluster is not for Xen/XenServer hypervisors");
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
List<HostVO> eHosts = _hostDao.listByCluster(clusterId);
|
||||
if( eHosts.size() > 0 ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue