Skip to content

Commit 72243c8

Browse files
author
abhishek
committed
bug 5191: incremental checkin
1 parent 4a30563 commit 72243c8

6 files changed

Lines changed: 17 additions & 7 deletions

File tree

‎core/src/com/cloud/info/ConsoleProxyInfo.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,21 @@ public ConsoleProxyInfo(int proxyUrlPort) {
3030
this.proxyUrlPort = proxyUrlPort;
3131
}
3232

33-
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort) {
33+
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort, String consoleProxyUrlDomain) {
3434
this.sslEnabled = sslEnabled;
3535

3636
if(sslEnabled) {
3737
StringBuffer sb = new StringBuffer(proxyIpAddress);
3838
for(int i = 0; i < sb.length(); i++)
3939
if(sb.charAt(i) == '.')
40-
sb.setCharAt(i, '-');
41-
sb.append(".realhostip.com");
40+
sb.setCharAt(i, '-');
41+
if(consoleProxyUrlDomain!=null && consoleProxyUrlDomain.length()>0)
42+
{
43+
sb.append(".");
44+
sb.append(consoleProxyUrlDomain);
45+
}
46+
else
47+
sb.append(".realhostip.com");
4248
proxyAddress = sb.toString();
4349
proxyPort = port;
4450
this.proxyUrlPort = proxyUrlPort;

‎server/src/com/cloud/configuration/Config.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public enum Config {
7575
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),
7676
ConsoleProxyCmdPort("Console Proxy", AgentManager.class, Integer.class, "consoleproxy.cmd.port", "8001", "Console proxy command port that is used to communicate with management server", null),
7777
ConsoleProxyRestart("Console Proxy", AgentManager.class, Boolean.class, "consoleproxy.restart", "true", "Console proxy restart flag, defaulted to true", null),
78+
ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "realhostip.com", "Console proxy url domain", null),
7879

7980
// obselete
8081
//ConsoleProxyDomPEnable("Console Proxy", ManagementServer.class, Boolean.class, "consoleproxy.domP.enable", null, null, null),

‎server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
6868
@Inject
6969
protected UserVmDao _userVmDao;
7070
private String _instance;
71+
protected String _consoleProxyUrlDomain;
7172
@Inject
7273
private VMInstanceDao _instanceDao;
7374
private ConsoleProxyListener _listener;
@@ -115,6 +116,8 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
115116

116117
_instance = configs.get("instance.name");
117118

119+
_consoleProxyUrlDomain = configs.get("consoleproxy.url.domain");
120+
118121
_listener = new ConsoleProxyListener(this);
119122
_agentMgr.registerForHostEvents(_listener, true, true, false);
120123

@@ -169,7 +172,7 @@ public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
169172
if (host.getProxyPort() != null && host.getProxyPort().intValue() > 0)
170173
urlPort = host.getProxyPort().intValue();
171174

172-
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
175+
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort, _consoleProxyUrlDomain);
173176
} else {
174177
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
175178
}

‎server/src/com/cloud/consoleproxy/AgentBasedStandaloneConsoleProxyManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
8585
if(allocatedHost.getProxyPort() != null && allocatedHost.getProxyPort().intValue() > 0)
8686
urlPort = allocatedHost.getProxyPort().intValue();
8787

88-
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
88+
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort, _consoleProxyUrlDomain);
8989
} else {
9090
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
9191
}

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public void run() {
316316
if (proxy == null)
317317
return null;
318318

319-
return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort());
319+
return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort(), _configDao.getValue("consoleproxy.url.domain"));
320320
}
321321

322322
public ConsoleProxyVO doAssignProxy(long dataCenterId, long vmId) {

‎server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected HostVO findHost(VMInstanceVO vm) {
4848

4949
@Override
5050
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
51-
return new ConsoleProxyInfo(false, _ip, _consoleProxyPort, _consoleProxyUrlPort);
51+
return new ConsoleProxyInfo(false, _ip, _consoleProxyPort, _consoleProxyUrlPort, _consoleProxyUrlDomain);
5252
}
5353

5454
@Override

0 commit comments

Comments
 (0)