mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 14379: don't enable 8096 port by default (set global config variable to null by default, and don't create a listener on this port unless its set to valid integer)
This commit is contained in:
parent
20acc4d315
commit
e53cfeceb6
@ -278,14 +278,16 @@ public class ApiServer implements HttpRequestHandler {
|
||||
_dispatcher = ApiDispatcher.getInstance();
|
||||
_domainMgr = locator.getManager(DomainManager.class);
|
||||
|
||||
int apiPort = 8096; // default port
|
||||
Integer apiPort = null; // api port, null by default
|
||||
ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
|
||||
SearchCriteria<ConfigurationVO> sc = configDao.createSearchCriteria();
|
||||
sc.addAnd("name", SearchCriteria.Op.EQ, "integration.api.port");
|
||||
List<ConfigurationVO> values = configDao.search(sc, null);
|
||||
if ((values != null) && (values.size() > 0)) {
|
||||
ConfigurationVO apiPortConfig = values.get(0);
|
||||
apiPort = Integer.parseInt(apiPortConfig.getValue());
|
||||
if (apiPortConfig.getValue() != null) {
|
||||
apiPort = Integer.parseInt(apiPortConfig.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key()));
|
||||
@ -295,8 +297,10 @@ public class ApiServer implements HttpRequestHandler {
|
||||
jsonContentType = jsonType;
|
||||
}
|
||||
|
||||
ListenerThread listenerThread = new ListenerThread(this, apiPort);
|
||||
listenerThread.start();
|
||||
if (apiPort != null) {
|
||||
ListenerThread listenerThread = new ListenerThread(this, apiPort);
|
||||
listenerThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
|
||||
@ -154,7 +154,7 @@ public enum Config {
|
||||
ExtractURLExpirationInterval("Advanced", ManagementServer.class, Integer.class, "extract.url.expiration.interval", "14400", "The life of an extract URL after which it is deleted ", null),
|
||||
HostStatsInterval("Advanced", ManagementServer.class, Integer.class, "host.stats.interval", "60000", "The interval (in milliseconds) when host stats are retrieved from agents.", null),
|
||||
HostRetry("Advanced", AgentManager.class, Integer.class, "host.retry", "2", "Number of times to retry hosts for creating a volume", null),
|
||||
IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", "8096", "Defaul API port", null),
|
||||
IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", null, "Defaul API port", null),
|
||||
InvestigateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "investigate.retry.interval", "60", "Time (in seconds) between VM pings when agent is disconnected", null),
|
||||
MigrateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "migrate.retry.interval", "120", "Time (in seconds) between migration retries", null),
|
||||
PingInterval("Advanced", AgentManager.class, Integer.class, "ping.interval", "60", "Ping interval in seconds", null),
|
||||
|
||||
@ -45,7 +45,7 @@ public interface TemplateAdapter extends Adapter {
|
||||
Boolean isExtractable, String format, Long guestOSId, Long zoneId, HypervisorType hypervisorType,
|
||||
String accountName, Long domainId, String chksum, Boolean bootable, Map details) throws ResourceAllocationException;
|
||||
|
||||
public TemplateProfile prepare(boolean isIso, Long userId, String name, String displayText, Integer bits,
|
||||
public TemplateProfile prepare(boolean isIso, long userId, String name, String displayText, Integer bits,
|
||||
Boolean passwordEnabled, Boolean requiresHVM, String url, Boolean isPublic, Boolean featured,
|
||||
Boolean isExtractable, String format, Long guestOSId, Long zoneId, HypervisorType hypervisorType,
|
||||
String chksum, Boolean bootable, String templateTag, Account templateOwner, Map details, Boolean sshKeyEnabled) throws ResourceAllocationException;
|
||||
|
||||
@ -96,7 +96,7 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
|
||||
chksum, bootable, null, null, details, false);
|
||||
}
|
||||
|
||||
public TemplateProfile prepare(boolean isIso, Long userId, String name, String displayText, Integer bits,
|
||||
public TemplateProfile prepare(boolean isIso, long userId, String name, String displayText, Integer bits,
|
||||
Boolean passwordEnabled, Boolean requiresHVM, String url, Boolean isPublic, Boolean featured,
|
||||
Boolean isExtractable, String format, Long guestOSId, Long zoneId, HypervisorType hypervisorType,
|
||||
String chksum, Boolean bootable, String templateTag, Account templateOwner, Map details, Boolean sshkeyEnabled) throws ResourceAllocationException {
|
||||
@ -159,12 +159,6 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
|
||||
if (!isAdmin || featured == null) {
|
||||
featured = Boolean.FALSE;
|
||||
}
|
||||
|
||||
// If command is executed via 8096 port, set userId to the id of System
|
||||
// account (1)
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(1);
|
||||
}
|
||||
|
||||
ImageFormat imgfmt = ImageFormat.valueOf(format.toUpperCase());
|
||||
if (imgfmt == null) {
|
||||
@ -258,7 +252,7 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
|
||||
}
|
||||
|
||||
|
||||
private Long accountAndUserValidation(Account account, Long userId, UserVmVO vmInstanceCheck, VMTemplateVO template, String msg)
|
||||
private Long accountAndUserValidation(Account account, long userId, UserVmVO vmInstanceCheck, VMTemplateVO template, String msg)
|
||||
throws PermissionDeniedException {
|
||||
|
||||
if (account != null) {
|
||||
@ -287,11 +281,6 @@ public abstract class TemplateAdapterBase implements TemplateAdapter {
|
||||
}
|
||||
}
|
||||
}
|
||||
// If command is executed via 8096 port, set userId to the id of System
|
||||
// account (1)
|
||||
if (userId == null) {
|
||||
userId = new Long(1);
|
||||
}
|
||||
|
||||
return userId;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user