Skip to content

Commit a8f0297

Browse files
code improvements, and logs
1 parent 343607a commit a8f0297

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long chec
476476
return;
477477
}
478478

479-
logger.info("Scheduling a recurring preferred host checker task with lb algorithm '{}' and host.lb.interval={} ms", lbAlgorithm, checkInterval);
479+
logger.info("Scheduling a recurring preferred host checker task with host.lb.interval={} ms", checkInterval);
480480
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
481481
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
482482
TimeUnit.MILLISECONDS);

core/src/main/java/com/cloud/agent/api/ReadyCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
public class ReadyCommand extends Command {
2727
private String _details;
2828

29-
public ReadyCommand() {
30-
super();
31-
}
32-
3329
private Long dcId;
3430
private Long hostId;
3531
private String hostUuid;
@@ -41,6 +37,10 @@ public ReadyCommand() {
4137
private Boolean enableHumanReadableSizes;
4238
private String arch;
4339

40+
public ReadyCommand() {
41+
super();
42+
}
43+
4444
public ReadyCommand(Long dcId) {
4545
super();
4646
this.dcId = dcId;
@@ -95,7 +95,7 @@ public List<String> getAvoidMsHostList() {
9595
return avoidMsHostList;
9696
}
9797

98-
public void setAvoidMsHostList(List<String> msHostList) {
98+
public void setAvoidMsHostList(List<String> avoidMsHostList) {
9999
this.avoidMsHostList = avoidMsHostList;
100100
}
101101

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -758,15 +758,15 @@ public void notifyMonitorsOfNewlyAddedHost(long hostId) {
758758
}
759759
}
760760

761-
protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, final StartupCommand[] cmd, final boolean forRebalance) throws ConnectionException {
761+
protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, final StartupCommand[] cmds, final boolean forRebalance) throws ConnectionException {
762762
final long hostId = attache.getId();
763763
final HostVO host = _hostDao.findById(hostId);
764764
for (final Pair<Integer, Listener> monitor : _hostMonitors) {
765765
logger.debug("Sending Connect to listener: {}, for rebalance: {}", monitor.second().getClass().getSimpleName(), forRebalance);
766-
for (int i = 0; i < cmd.length; i++) {
766+
for (StartupCommand cmd : cmds) {
767767
try {
768-
logger.debug("process connection to issue: {} for host: {}, forRebalance: {}, connection transferred: {}", ReflectionToStringBuilderUtils.reflectCollection(cmd[i]), hostId, forRebalance, cmd[i].isConnectionTransferred());
769-
monitor.second().processConnect(host, cmd[i], forRebalance);
768+
logger.debug("process connection to issue: {} for host: {}, forRebalance: {}", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(cmd, "id", "type", "msHostList", "connectionTransferred"), hostId, forRebalance);
769+
monitor.second().processConnect(host, cmd, forRebalance);
770770
} catch (final ConnectionException ce) {
771771
if (ce.isSetupError()) {
772772
logger.warn("Monitor {} says there is an error in the connect process for {} due to {}", monitor.second().getClass().getSimpleName(), hostId, ce.getMessage());
@@ -1677,7 +1677,7 @@ protected void processRequest(final Link link, final Request request) {
16771677
logger.debug("Not processing {} for agent id={}; can't find the host in the DB", PingRoutingCommand.class.getSimpleName(), cmdHostId);
16781678
}
16791679
}
1680-
if (host!= null && host.getStatus() != Status.Up && gatewayAccessible) {
1680+
if (host != null && host.getStatus() != Status.Up && gatewayAccessible) {
16811681
requestStartupCommand = true;
16821682
}
16831683
final List<String> avoidMsList = _mshostDao.listNonUpStateMsIPs();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ public synchronized boolean isClosed() {
5454
@Override
5555
public void disconnect(final Status state) {
5656
synchronized (this) {
57-
logger.debug("Processing Disconnect.");
57+
logger.debug("Processing disconnect [id: {}, uuid: {}, name: {}]", _id, _uuid, _name);
58+
5859
if (_link != null) {
60+
logger.debug("Disconnecting from {}, Socket Address: {}", _link.getIpAddress(), _link.getSocketAddress());
5961
_link.close();
6062
_link.terminated();
6163
}

0 commit comments

Comments
 (0)