Skip to content

Commit 305f954

Browse files
committed
update host logs
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent e36c6a5 commit 305f954

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,10 @@ private void scanDirectAgentToLoad() {
215215
continue;
216216
}
217217
}
218-
219-
logger.debug("Loading directly connected host {}({})", host.getId(), host.getName());
218+
logger.debug("Loading directly connected {}", host);
220219
loadDirectlyConnectedHost(host, false);
221220
} catch (final Throwable e) {
222-
logger.warn(" can not load directly connected host {}({}) due to ", host.getId(), host.getName(), e);
221+
logger.warn(" can not load directly connected {} due to ", host, e);
223222
}
224223
}
225224
}
@@ -245,7 +244,7 @@ public Task create(final Task.Type type, final Link link, final byte[] data) {
245244

246245

247246
protected AgentAttache createAttache(final Host host) {
248-
logger.debug("create forwarding ClusteredAgentAttache for {}", host.getId());
247+
logger.debug("create forwarding ClusteredAgentAttache for {}", host);
249248
final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getName());
250249
AgentAttache old = null;
251250
synchronized (_agents) {
@@ -261,7 +260,7 @@ protected AgentAttache createAttache(final Host host) {
261260

262261
@Override
263262
protected AgentAttache createAttacheForConnect(final HostVO host, final Link link) {
264-
logger.debug("create ClusteredAgentAttache for {}", host.getId());
263+
logger.debug("create ClusteredAgentAttache for {}", host);
265264
final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getName(), link, host.isInMaintenanceStates());
266265
link.attach(attache);
267266
AgentAttache old = null;
@@ -1027,18 +1026,18 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi
10271026
} else if (futureOwnerId == _nodeId) {
10281027
final HostVO host = _hostDao.findById(hostId);
10291028
try {
1030-
logger.debug("Disconnecting host {}({}) as a part of rebalance process without notification", host.getId(), host.getName());
1029+
logger.debug("Disconnecting {} as a part of rebalance process without notification", host);
10311030

10321031
final AgentAttache attache = findAttache(hostId);
10331032
if (attache != null) {
10341033
result = handleDisconnect(attache, Event.AgentDisconnected, false, false, true);
10351034
}
10361035

10371036
if (result) {
1038-
logger.debug("Loading directly connected host {}({}) to the management server {} as a part of rebalance process", host.getId(), host.getName(), _nodeId);
1037+
logger.debug("Loading directly connected {} to the management server {} as a part of rebalance process", host, _nodeId);
10391038
result = loadDirectlyConnectedHost(host, true);
10401039
} else {
1041-
logger.warn("Failed to disconnect {}({}) as a part of rebalance process without notification" + host.getId(), host.getName());
1040+
logger.warn("Failed to disconnect {} as a part of rebalance process without notification", host);
10421041
}
10431042

10441043
} catch (final Exception ex) {
@@ -1047,9 +1046,9 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi
10471046
}
10481047

10491048
if (result) {
1050-
logger.debug("Successfully loaded directly connected host {}({}) to the management server {} a part of rebalance process without notification", host.getId(), host.getName(), _nodeId);
1049+
logger.debug("Successfully loaded directly connected {} to the management server {} a part of rebalance process without notification", host, _nodeId);
10511050
} else {
1052-
logger.warn("Failed to load directly connected host {}({}) to the management server {} a part of rebalance process without notification", host.getId(), host.getName(), _nodeId);
1051+
logger.warn("Failed to load directly connected {} to the management server {} a part of rebalance process without notification", host, _nodeId);
10531052
}
10541053
}
10551054

server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ public boolean checkIfHostHasCpuCapability(Host host, Integer cpuNum, Integer cp
420420
boolean isCpuNumGood = host.getCpus().intValue() >= cpuNum;
421421
boolean isCpuSpeedGood = host.getSpeed().intValue() >= cpuSpeed;
422422
if (isCpuNumGood && isCpuSpeedGood) {
423-
logger.debug("Host: {} has cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
424-
host.getId(), host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
423+
logger.debug("{} has cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
424+
host, host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
425425
return true;
426-
} else {logger.debug("Host: {} doesn't have cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
427-
host.getId(), host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
426+
} else {logger.debug("{} doesn't have cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
427+
host, host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
428428
return false;
429429
}
430430
}
@@ -684,10 +684,10 @@ public void updateCapacityForHost(final Host host) {
684684
final CapacityState capacityState = (host.getResourceState() == ResourceState.Enabled) ? CapacityState.Enabled : CapacityState.Disabled;
685685

686686
List<VMInstanceVO> vms = _vmDao.listIdServiceOfferingForUpVmsByHostId(host.getId());
687-
logger.debug("Found {} VMs on host {}", vms.size(), host.getId());
687+
logger.debug("Found {} VMs on {}", vms.size(), host);
688688

689689
final List<VMInstanceVO> vosMigrating = _vmDao.listIdServiceOfferingForVmsMigratingFromHost(host.getId());
690-
logger.debug("Found {} VMs are Migrating from host {}", vosMigrating.size(), host.getId());
690+
logger.debug("Found {} VMs are Migrating from {}", vosMigrating.size(), host);
691691
vms.addAll(vosMigrating);
692692

693693
Pair<String, String> clusterValues =
@@ -729,7 +729,7 @@ public void updateCapacityForHost(final Host host) {
729729
}
730730

731731
List<VMInstanceVO> vmsByLastHostId = _vmDao.listIdServiceOfferingForVmsByLastHostId(host.getId());
732-
logger.debug("Found {} VM, not running on host {}", vmsByLastHostId.size(), host.getId());
732+
logger.debug("Found {} VM, not running on {}", vmsByLastHostId.size(), host);
733733

734734
for (VMInstanceVO vm : vmsByLastHostId) {
735735
Float cpuOvercommitRatio = 1.0f;

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ public HostStats getHostStatistics(final Host host) {
33103310
}
33113311

33123312
if (answer == null || !answer.getResult()) {
3313-
logger.warn("Unable to obtain host {} statistics.", host.getId());
3313+
logger.warn("Unable to obtain {} statistics.", host);
33143314
return null;
33153315
} else {
33163316

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ protected void runInContext() {
12341234

12351235
metrics.clear();
12361236
} catch (Exception e) {
1237-
logger.debug("Failed to get VM stats for host with ID: " + host.getId());
1237+
logger.debug("Failed to get VM stats for : {}", host);
12381238
continue;
12391239
}
12401240
}

0 commit comments

Comments
 (0)