CLOUDSTACK-2940

Allowing Replacement of realhostip.com with a customized domain for SSVM. Though the config variable was there we were always hardcoding to realhostip.com
Reviewed-by: Abhi
This commit is contained in:
Nitin Mehta 2012-10-11 19:38:32 +05:30
parent d21e064724
commit e73aafc09a
2 changed files with 21 additions and 13 deletions

View File

@ -178,6 +178,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
protected AccountManager _accountMgr;
private Boolean _sslCopy = new Boolean(false);
String _ssvmUrlDomain;
private String _copyAuthPasswd;
private String _proxy = null;
protected SearchBuilder<VMTemplateHostVO> ReadyTemplateStatesSearch;
@ -198,11 +199,8 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
_sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy"));
_proxy = configs.get(Config.SecStorageProxy.key());
String cert = configs.get("secstorage.ssl.cert.domain");
if (!"realhostip.com".equalsIgnoreCase(cert)) {
s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
}
_ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain");
_copyAuthPasswd = configs.get("secstorage.copy.password");
_agentMgr.registerForHostEvents(new DownloadListener(this), true, false, false);
@ -318,9 +316,15 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
String hostname = ipAddress;
String scheme = "http";
if (_sslCopy) {
hostname = ipAddress.replace(".", "-");
hostname = hostname + ".realhostip.com";
scheme = "https";
hostname = ipAddress.replace(".", "-");
scheme = "https";
// Code for putting in custom certificates.
if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){
hostname = hostname + "." + _ssvmUrlDomain;
}else{
hostname = hostname + ".realhostip.com";
}
}
return scheme + "://" + hostname + "/copy/SecStorage/" + dir + "/" + path;
}

View File

@ -106,6 +106,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
private String _name;
private Boolean _sslCopy = new Boolean(false);
private String _ssvmUrlDomain;
private ScheduledExecutorService _executor = null;
Timer _timer;
@ -329,8 +330,14 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
String scheme = "http";
if (_sslCopy) {
hostname = ipAddress.replace(".", "-");
hostname = hostname + ".realhostip.com";
scheme = "https";
// Code for putting in custom certificates.
if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){
hostname = hostname + "." + _ssvmUrlDomain;
}else{
hostname = hostname + ".realhostip.com";
}
}
return scheme + "://" + hostname + "/userdata/" + uuid;
}
@ -347,10 +354,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
final Map<String, String> configs = _configDao.getConfiguration("ManagementServer", params);
_sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy"));
String cert = configs.get("secstorage.secure.copy.cert");
if ("realhostip.com".equalsIgnoreCase(cert)) {
s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
}
_ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain");
_agentMgr.registerForHostEvents(new UploadListener(this), true, false, false);
String cleanupInterval = configs.get("extract.url.cleanup.interval");