bug 7503: set hypervisor type when we create the cluster, as we already know the hypervisor type in adavnce when adding host.

status 7503: resolved fixed
This commit is contained in:
edison 2010-12-28 17:19:44 -08:00
parent 271b1ee58a
commit 920c7b3dd7
3 changed files with 7 additions and 8 deletions

View File

@ -728,6 +728,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
if (clusterName != null) {
ClusterVO cluster = new ClusterVO(dcId, podId, clusterName);
cluster.setHypervisorType(hypervisorType);
try {
cluster = _clusterDao.persist(cluster);
} catch (Exception e) {
@ -2209,7 +2210,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
HypervisorType hypervisorType = scc.getHypervisorType();
boolean doCidrCheck = true;
ClusterVO clusterVO = _clusterDao.findById(clusterId);
if (clusterVO.getHypervisorType() != scc.getHypervisorType()) {
throw new IllegalArgumentException("Can't add host whose hypervisor type is: " + scc.getHypervisorType() + " into cluster: " + clusterId + " whose hypervisor type is: " + clusterVO.getHypervisorType());
}
/*KVM:Enforcement that all the hosts in the cluster have the same os type, for migration*/
if (scc.getHypervisorType() == HypervisorType.KVM) {

View File

@ -251,10 +251,6 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
return null;
details.put("guid", guidWithTail);
/*set cluster hypervisor type to xenserver*/
ClusterVO clu = _clusterDao.findById(clusterId);
clu.setHypervisorType(HypervisorType.KVM.toString());
_clusterDao.update(clusterId, clu);
return resources;
} catch (Exception e) {
String msg = " can't setup agent, due to " + e.toString() + " - " + e.getMessage();

View File

@ -164,9 +164,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
}
}
poolUuid = clu.getGuid();
if ( HypervisorType.None == clu.getHypervisorType() ) {
clu.setHypervisorType(HypervisorType.XenServer.toString());
}
_clusterDao.update(clusterId, clu);
LinkedHashMap<Host, Host.Record> hosts = new LinkedHashMap<Host, Host.Record>(20);