Skip to content

Commit 2d05bd9

Browse files
author
Glover, Rene (rg9975)
committed
fixes for agent.send peer disconnect issues during command execution
1 parent 0b9eb15 commit 2d05bd9

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
238238
false);
239239
protected final ConfigKey<Integer> RemoteAgentNewConnectionsMonitorInterval = new ConfigKey<>("Advanced", Integer.class, "agent.connections.monitor.interval", "1800",
240240
"Time in seconds to monitor the new agent connections and cleanup the expired connections.", false);
241+
242+
protected final ConfigKey<Integer> PeerLookupRetryCount = new ConfigKey<>(Integer.class,
243+
"cluster.agent.peer.lookup.retry.count", "Advanced", "1",
244+
"Number of retries (in addition to the initial attempt) to resolve the peer management server for a host when forwarding agent commands in a management server cluster.", true);
245+
246+
protected final ConfigKey<Integer> PeerLookupRetryIntervalMs = new ConfigKey<>(Integer.class,
247+
"cluster.agent.peer.lookup.retry.interval.ms", "Advanced", "200",
248+
"Sleep interval in milliseconds between peer lookup retries when forwarding agent commands in a management server cluster.", true);
241249
protected final ConfigKey<Integer> AlertWait = new ConfigKey<>("Advanced", Integer.class, "alert.wait", "1800",
242250
"Seconds to wait before alerting on a disconnected agent", true);
243251
protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<>("Advanced", Integer.class, "direct.agent.load.size", "16",
@@ -790,11 +798,13 @@ public long send(final Long hostId, final Commands commands, final Listener list
790798
}
791799

792800
protected int getAgentSendRetryCount() {
793-
return 0;
801+
final String value = _configDao != null ? _configDao.getValue("cluster.agent.peer.lookup.retry.count") : null;
802+
return NumbersUtil.parseInt(value, 1);
794803
}
795804

796805
protected int getAgentSendRetryIntervalMs() {
797-
return 0;
806+
final String value = _configDao != null ? _configDao.getValue("cluster.agent.peer.lookup.retry.interval.ms") : null;
807+
return NumbersUtil.parseInt(value, 200);
798808
}
799809

800810
protected AgentAttache resolveAttacheForRetry(final Long hostId, final AgentAttache current, final boolean forceReload)
@@ -2271,7 +2281,7 @@ public ConfigKey<?>[] getConfigKeys() {
22712281
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
22722282
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait,
22732283
GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections,
2274-
RemoteAgentNewConnectionsMonitorInterval };
2284+
RemoteAgentNewConnectionsMonitorInterval, PeerLookupRetryCount, PeerLookupRetryIntervalMs };
22752285
}
22762286

22772287
protected class SetHostParamsListener implements Listener {

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ protected ClusteredAgentManagerImpl() {
162162
protected final ConfigKey<Integer> ScanInterval = new ConfigKey<>(Integer.class, "direct.agent.scan.interval", "Advanced", "90", "Interval between scans to load direct agents", false,
163163
ConfigKey.Scope.Global, 1000);
164164

165-
protected final ConfigKey<Integer> PeerLookupRetryCount = new ConfigKey<>(Integer.class,
166-
"cluster.agent.peer.lookup.retry.count", "Advanced", "0",
167-
"Number of retries (in addition to the initial attempt) to resolve the peer management server for a host when forwarding agent commands in a management server cluster.", true);
168-
169-
protected final ConfigKey<Integer> PeerLookupRetryIntervalMs = new ConfigKey<>(Integer.class,
170-
"cluster.agent.peer.lookup.retry.interval.ms", "Advanced", "200",
171-
"Sleep interval in milliseconds between peer lookup retries when forwarding agent commands in a management server cluster.", true);
172-
173165
@Override
174166
public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException {
175167
_peers = new HashMap<>(7);
@@ -1676,8 +1668,6 @@ public ConfigKey<?>[] getConfigKeys() {
16761668
keysLst.add(ConnectedAgentThreshold);
16771669
keysLst.add(LoadSize);
16781670
keysLst.add(ScanInterval);
1679-
keysLst.add(PeerLookupRetryCount);
1680-
keysLst.add(PeerLookupRetryIntervalMs);
16811671
return keysLst.toArray(new ConfigKey<?>[keysLst.size()]);
16821672
}
16831673
}

0 commit comments

Comments
 (0)