more changes

This commit is contained in:
abhishek 2010-10-26 18:32:36 -07:00
parent d9ebb7147c
commit 9c80911e52
3 changed files with 10 additions and 28 deletions

View File

@ -111,7 +111,7 @@ public interface HostDao extends GenericDao<HostVO, Long> {
* @param type
* @return
*/
List<HostVO> listByType(Type type, boolean routingCapable);
List<HostVO> listByType(Type type);
/**
* Find hosts that have not responded to a ping regardless of state
@ -137,9 +137,5 @@ public interface HostDao extends GenericDao<HostVO, Long> {
void loadDetails(HostVO host);
HostVO findConsoleProxyHost(String name, Type type);
List<HostVO> listAllConsoleProxyHosts(Type type);
HostVO findConsoleProxyHost(String name, Type type);
}

View File

@ -80,7 +80,6 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
protected final SearchBuilder<HostVO> MaintenanceCountSearch;
protected final SearchBuilder<HostVO> ClusterSearch;
protected final SearchBuilder<HostVO> ConsoleProxyHostSearch;
protected final SearchBuilder<HostVO> ConsoleProxyHostsListSearch;
protected final Attribute _statusAttr;
protected final Attribute _msIdAttr;
@ -161,10 +160,6 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
ConsoleProxyHostSearch.and("name", ConsoleProxyHostSearch.entity().getName(), SearchCriteria.Op.EQ);
ConsoleProxyHostSearch.and("type", ConsoleProxyHostSearch.entity().getType(), SearchCriteria.Op.EQ);
ConsoleProxyHostSearch.done();
ConsoleProxyHostsListSearch = createSearchBuilder();
ConsoleProxyHostsListSearch.and("type", ConsoleProxyHostsListSearch.entity().getType(), SearchCriteria.Op.EQ);
ConsoleProxyHostsListSearch.done();
PodSearch = createSearchBuilder();
PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
@ -466,13 +461,6 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
else
return hostList.get(0);
}
@Override
public List<HostVO> listAllConsoleProxyHosts(Type type) {
SearchCriteria<HostVO> sc = ConsoleProxyHostSearch.create();
sc.setParameters("type", type);
return listBy(sc);
}
public List<HostVO> listByHostPod(long podId) {
SearchCriteria<HostVO> sc = PodSearch.create("pod", podId);
@ -496,15 +484,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
}
@Override
public List<HostVO> listByType(Type type, boolean routingCapable) {
public List<HostVO> listByType(Type type) {
SearchCriteria<HostVO> sc = TypeSearch.create();
sc.setParameters("type", type.toString());
if (routingCapable) {
sc.addAnd("routing_capbable", SearchCriteria.Op.EQ, Integer.valueOf(1));
}
return listIncludingRemovedBy(sc);
return listBy(sc);
}
protected void saveDetails(HostVO host) {

View File

@ -5881,9 +5881,12 @@ public class ManagementServerImpl implements ManagementServer {
//get a list of all Console proxies from the cp table
List<ConsoleProxyVO> cpList = _consoleProxyDao.listAll();
//get a list of all hosts in host table for type cp
List<HostVO> cpHosts = _hostDao.listAllConsoleProxyHosts(com.cloud.host.Host.Type.ConsoleProxy);
List<HostVO> cpHosts = _hostDao.listByType(com.cloud.host.Host.Type.ConsoleProxy);
//create a hashmap for fast lookup
Map<String,Long> hostNameToHostIdMap = new HashMap<String, Long>();
//updated console proxies list
List<ConsoleProxyVO> updatedCpList = new ArrayList<ConsoleProxyVO>();
for(HostVO cpHost : cpHosts){
hostNameToHostIdMap.put(cpHost.getName(), cpHost.getId());
}
@ -5903,9 +5906,9 @@ public class ManagementServerImpl implements ManagementServer {
//when cp reboots, the context will be reinit with the new cert
}
} catch (AgentUnavailableException e) {
s_logger.warn("Unable to send update certificate command to the console proxy resource", e);
s_logger.warn("Unable to send update certificate command to the console proxy resource as agent is unavailable", e);
} catch (OperationTimedoutException e) {
s_logger.warn("Unable to send update certificate command to the console proxy resource", e);
s_logger.warn("Unable to send update certificate command to the console proxy resource as there was a timeout", e);
}
}
return true;