Skip to content

Commit

Permalink
update host logs
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Kumar <[email protected]>
  • Loading branch information
shwstppr committed Nov 12, 2024
1 parent e36c6a5 commit 305f954
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,10 @@ private void scanDirectAgentToLoad() {
continue;
}
}

logger.debug("Loading directly connected host {}({})", host.getId(), host.getName());
logger.debug("Loading directly connected {}", host);
loadDirectlyConnectedHost(host, false);
} catch (final Throwable e) {
logger.warn(" can not load directly connected host {}({}) due to ", host.getId(), host.getName(), e);
logger.warn(" can not load directly connected {} due to ", host, e);
}
}
}
Expand All @@ -245,7 +244,7 @@ public Task create(final Task.Type type, final Link link, final byte[] data) {


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

@Override
protected AgentAttache createAttacheForConnect(final HostVO host, final Link link) {
logger.debug("create ClusteredAgentAttache for {}", host.getId());
logger.debug("create ClusteredAgentAttache for {}", host);
final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getName(), link, host.isInMaintenanceStates());
link.attach(attache);
AgentAttache old = null;
Expand Down Expand Up @@ -1027,18 +1026,18 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi
} else if (futureOwnerId == _nodeId) {
final HostVO host = _hostDao.findById(hostId);
try {
logger.debug("Disconnecting host {}({}) as a part of rebalance process without notification", host.getId(), host.getName());
logger.debug("Disconnecting {} as a part of rebalance process without notification", host);

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

if (result) {
logger.debug("Loading directly connected host {}({}) to the management server {} as a part of rebalance process", host.getId(), host.getName(), _nodeId);
logger.debug("Loading directly connected {} to the management server {} as a part of rebalance process", host, _nodeId);
result = loadDirectlyConnectedHost(host, true);
} else {
logger.warn("Failed to disconnect {}({}) as a part of rebalance process without notification" + host.getId(), host.getName());
logger.warn("Failed to disconnect {} as a part of rebalance process without notification", host);
}

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

if (result) {
logger.debug("Successfully loaded directly connected host {}({}) to the management server {} a part of rebalance process without notification", host.getId(), host.getName(), _nodeId);
logger.debug("Successfully loaded directly connected {} to the management server {} a part of rebalance process without notification", host, _nodeId);
} else {
logger.warn("Failed to load directly connected host {}({}) to the management server {} a part of rebalance process without notification", host.getId(), host.getName(), _nodeId);
logger.warn("Failed to load directly connected {} to the management server {} a part of rebalance process without notification", host, _nodeId);
}
}

Expand Down
14 changes: 7 additions & 7 deletions server/src/main/java/com/cloud/capacity/CapacityManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,11 @@ public boolean checkIfHostHasCpuCapability(Host host, Integer cpuNum, Integer cp
boolean isCpuNumGood = host.getCpus().intValue() >= cpuNum;
boolean isCpuSpeedGood = host.getSpeed().intValue() >= cpuSpeed;
if (isCpuNumGood && isCpuSpeedGood) {
logger.debug("Host: {} has cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
host.getId(), host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
logger.debug("{} has cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
host, host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
return true;
} else {logger.debug("Host: {} doesn't have cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
host.getId(), host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
} else {logger.debug("{} doesn't have cpu capability (cpu: {}, speed: {} ) to support requested CPU: {} and requested speed: {}",
host, host.getCpus(), host.getSpeed(), cpuNum, cpuSpeed);
return false;
}
}
Expand Down Expand Up @@ -684,10 +684,10 @@ public void updateCapacityForHost(final Host host) {
final CapacityState capacityState = (host.getResourceState() == ResourceState.Enabled) ? CapacityState.Enabled : CapacityState.Disabled;

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

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

Pair<String, String> clusterValues =
Expand Down Expand Up @@ -729,7 +729,7 @@ public void updateCapacityForHost(final Host host) {
}

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

for (VMInstanceVO vm : vmsByLastHostId) {
Float cpuOvercommitRatio = 1.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3310,7 +3310,7 @@ public HostStats getHostStatistics(final Host host) {
}

if (answer == null || !answer.getResult()) {
logger.warn("Unable to obtain host {} statistics.", host.getId());
logger.warn("Unable to obtain {} statistics.", host);
return null;
} else {

Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/com/cloud/server/StatsCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ protected void runInContext() {

metrics.clear();
} catch (Exception e) {
logger.debug("Failed to get VM stats for host with ID: " + host.getId());
logger.debug("Failed to get VM stats for : {}", host);
continue;
}
}
Expand Down

0 comments on commit 305f954

Please sign in to comment.