Skip to content

Commit 4e95510

Browse files
sureshanapartidhslove
authored andcommitted
Add new config (non-dynamic) for agent connections monitor thread, and keep timeunit to secs (in sync with the earlier Wait config) (apache#10525)
1 parent 01bfa3a commit 4e95510

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

engine/components-api/src/main/java/com/cloud/agent/AgentManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* AgentManager manages hosts. It directly coordinates between the DAOs and the connections it manages.
3838
*/
3939
public interface AgentManager {
40-
static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return",
40+
ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return",
4141
true);
4242
ConfigKey<Boolean> EnableKVMAutoEnableDisable = new ConfigKey<>(Boolean.class,
4343
"enable.kvm.host.auto.enable.disable",
@@ -54,7 +54,7 @@ public interface AgentManager {
5454
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " +
5555
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", false);
5656

57-
public enum TapAgentsAction {
57+
enum TapAgentsAction {
5858
Add, Del, Contains,
5959
}
6060

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
import org.apache.cloudstack.management.ManagementServerHost;
5656
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
5757
import org.apache.cloudstack.utils.identity.ManagementServerNode;
58-
import org.apache.commons.collections.MapUtils;
5958
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
59+
import org.apache.commons.collections.MapUtils;
6060
import org.apache.commons.lang3.BooleanUtils;
6161
import org.apache.commons.lang3.StringUtils;
6262
import org.apache.logging.log4j.ThreadContext;
@@ -223,6 +223,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
223223
"Number of maximum concurrent new connections server allows for remote (indirect) agents. " +
224224
"If set to zero (default value) then no limit will be enforced on concurrent new connections",
225225
false);
226+
protected final ConfigKey<Integer> RemoteAgentNewConnectionsMonitorInterval = new ConfigKey<>("Advanced", Integer.class, "agent.connections.monitor.interval", "1800",
227+
"Time in seconds to monitor the new agent connections and cleanup the expired connections.", false);
226228
protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>("Advanced", Integer.class, "alert.wait", "1800",
227229
"Seconds to wait before alerting on a disconnected agent", true);
228230
protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>("Advanced", Integer.class, "direct.agent.load.size", "16",
@@ -1960,7 +1962,7 @@ protected class AgentNewConnectionsMonitorTask extends ManagedContextRunnable {
19601962
@Override
19611963
protected void runInContext() {
19621964
logger.trace("Agent New Connections Monitor is started.");
1963-
final int cleanupTime = Wait.value();
1965+
final int cleanupTime = RemoteAgentNewConnectionsMonitorInterval.value();
19641966
Set<Map.Entry<String, Long>> entrySet = newAgentConnections.entrySet();
19651967
long cutOff = System.currentTimeMillis() - (cleanupTime * 1000L);
19661968
List<String> expiredConnections = newAgentConnections.entrySet()
@@ -2055,7 +2057,8 @@ public String getConfigComponentName() {
20552057
public ConfigKey<?>[] getConfigKeys() {
20562058
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
20572059
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait,
2058-
GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections };
2060+
GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections,
2061+
RemoteAgentNewConnectionsMonitorInterval };
20592062
}
20602063

20612064
protected class SetHostParamsListener implements Listener {

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
427427
static final ConfigKey<Long> VmOpCleanupInterval = new ConfigKey<Long>("Advanced", Long.class, "vm.op.cleanup.interval", "86400",
428428
"Interval to run the thread that cleans up the vm operations (in seconds)", false);
429429
static final ConfigKey<Long> VmOpCleanupWait = new ConfigKey<Long>("Advanced", Long.class, "vm.op.cleanup.wait", "3600",
430-
"Time (in seconds) to wait before cleanuping up any vm work items", true);
430+
"Time (in seconds) to wait before cleaning up any vm work items", true);
431431
static final ConfigKey<Long> VmOpCancelInterval = new ConfigKey<Long>("Advanced", Long.class, "vm.op.cancel.interval", "3600",
432432
"Time (in seconds) to wait before cancelling a operation", false);
433433
static final ConfigKey<Boolean> VmDestroyForcestop = new ConfigKey<Boolean>("Advanced", Boolean.class, "vm.destroy.forcestop", "false",

utils/src/main/java/com/cloud/utils/nio/NioConnection.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ protected boolean rejectConnectionIfBusy(final SocketChannel socketChannel) thro
251251
return true;
252252
}
253253

254-
255254
protected void accept(final SelectionKey key) throws IOException {
256255
final ServerSocketChannel serverSocketChannel = (ServerSocketChannel)key.channel();
257256
final SocketChannel socketChannel = serverSocketChannel.accept();

0 commit comments

Comments
 (0)