bug 1443: even adding host failed, return success in api. status 14443: resolved fixed; Reviewed-by: sheng

This commit is contained in:
Edison Su 2012-03-23 18:22:31 -07:00
parent 04312dabc4
commit 1e4893b69c
3 changed files with 16 additions and 1 deletions

View File

@ -274,8 +274,13 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
}
}
s_logger.debug("Timeout, to wait for the host connecting to mgt svr, assuming it is failed");
List<HostVO> hosts = _resourceMgr.findHostByGuid(dcId, guid);
if (hosts.size() == 1) {
return hosts.get(0);
} else {
return null;
}
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {

View File

@ -139,4 +139,6 @@ public interface ResourceManager extends ResourceService{
HypervisorType getAvailableHypervisor(long zoneId);
Discoverer getMatchingDiscover(HypervisorType hypervisorType);
List<HostVO> findHostByGuid(long dcId, String guid);
}

View File

@ -2006,6 +2006,14 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
return sc.list();
}
@Override
public List<HostVO> findHostByGuid(long dcId, String guid) {
SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
sc.addAnd(sc.getEntity().getGuid(), Op.EQ, guid);
return sc.list();
}
@Override
public List<HostVO> listAllHostsInCluster(long clusterId) {
SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);