CLOUDSTACK-215 CPVM load balance didn't work, VNC console sessions go to one CPVM and ignore other CPVMs

This commit is contained in:
Mice Xia 2012-09-27 13:03:09 +08:00
parent 77520e0bc8
commit daeac9ec57
2 changed files with 9 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
@ -658,6 +659,13 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
assert (allocator != null);
List<ConsoleProxyVO> runningList = _consoleProxyDao.getProxyListInStates(dataCenterId, State.Running);
if (runningList != null && runningList.size() > 0) {
Iterator<ConsoleProxyVO> it = runningList.iterator();
while (it.hasNext()) {
ConsoleProxyVO proxy = it.next();
if(proxy.getActiveSession() >= _capacityPerProxy){
it.remove();
}
}
if (s_logger.isTraceEnabled()) {
s_logger.trace("Running proxy pool size : " + runningList.size());
for (ConsoleProxyVO proxy : runningList) {

View File

@ -90,7 +90,7 @@ public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> im
private static final String GET_PROXY_ACTIVE_LOAD =
"SELECT active_session AS count" +
" FROM console_proxy" +
" WHERE proxy_id=?";
" WHERE id=?";
private static final String STORAGE_POOL_HOST_INFO =
"SELECT p.data_center_id, count(ph.host_id) " +