bug 5191: incremental checkin

This commit is contained in:
abhishek 2010-09-27 11:10:25 -07:00
parent 4a305631f9
commit 72243c8382
6 changed files with 17 additions and 7 deletions

View File

@ -30,15 +30,21 @@ public class ConsoleProxyInfo {
this.proxyUrlPort = proxyUrlPort;
}
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort) {
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort, String consoleProxyUrlDomain) {
this.sslEnabled = sslEnabled;
if(sslEnabled) {
StringBuffer sb = new StringBuffer(proxyIpAddress);
for(int i = 0; i < sb.length(); i++)
if(sb.charAt(i) == '.')
sb.setCharAt(i, '-');
sb.append(".realhostip.com");
sb.setCharAt(i, '-');
if(consoleProxyUrlDomain!=null && consoleProxyUrlDomain.length()>0)
{
sb.append(".");
sb.append(consoleProxyUrlDomain);
}
else
sb.append(".realhostip.com");
proxyAddress = sb.toString();
proxyPort = port;
this.proxyUrlPort = proxyUrlPort;

View File

@ -75,6 +75,7 @@ public enum Config {
ConsoleProxyCapacityScanInterval("Console Proxy", AgentManager.class, String.class, "consoleproxy.capacityscan.interval", "30000", "The time interval(in millisecond) to scan whether or not system needs more console proxy to ensure minimal standby capacity", null),
ConsoleProxyCmdPort("Console Proxy", AgentManager.class, Integer.class, "consoleproxy.cmd.port", "8001", "Console proxy command port that is used to communicate with management server", null),
ConsoleProxyRestart("Console Proxy", AgentManager.class, Boolean.class, "consoleproxy.restart", "true", "Console proxy restart flag, defaulted to true", null),
ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "realhostip.com", "Console proxy url domain", null),
// obselete
//ConsoleProxyDomPEnable("Console Proxy", ManagementServer.class, Boolean.class, "consoleproxy.domP.enable", null, null, null),

View File

@ -68,6 +68,7 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
@Inject
protected UserVmDao _userVmDao;
private String _instance;
protected String _consoleProxyUrlDomain;
@Inject
private VMInstanceDao _instanceDao;
private ConsoleProxyListener _listener;
@ -115,6 +116,8 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
_instance = configs.get("instance.name");
_consoleProxyUrlDomain = configs.get("consoleproxy.url.domain");
_listener = new ConsoleProxyListener(this);
_agentMgr.registerForHostEvents(_listener, true, true, false);
@ -169,7 +172,7 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
if (host.getProxyPort() != null && host.getProxyPort().intValue() > 0)
urlPort = host.getProxyPort().intValue();
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort, _consoleProxyUrlDomain);
} else {
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
}

View File

@ -85,7 +85,7 @@ AgentBasedConsoleProxyManager {
if(allocatedHost.getProxyPort() != null && allocatedHost.getProxyPort().intValue() > 0)
urlPort = allocatedHost.getProxyPort().intValue();
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort, _consoleProxyUrlDomain);
} else {
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
}

View File

@ -316,7 +316,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
if (proxy == null)
return null;
return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort());
return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort(), _configDao.getValue("consoleproxy.url.domain"));
}
public ConsoleProxyVO doAssignProxy(long dataCenterId, long vmId) {

View File

@ -48,7 +48,7 @@ public class StaticConsoleProxyManager extends AgentBasedConsoleProxyManager imp
@Override
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
return new ConsoleProxyInfo(false, _ip, _consoleProxyPort, _consoleProxyUrlPort);
return new ConsoleProxyInfo(false, _ip, _consoleProxyPort, _consoleProxyUrlPort, _consoleProxyUrlDomain);
}
@Override