Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server/src/main/java/com/cloud/server/StatsCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,14 @@ protected void runInContext() {

Map<Object, Object> metrics = new HashMap<>();
for (HostVO host : hosts) {
if (host.getHypervisorType() == HypervisorType.KVM && ManagementServerNode.getManagementServerId() != host.getManagementServerId()) {
Comment thread
GaOrtiga marked this conversation as resolved.
Outdated
// When there are multiple Management Server nodes on the environment, all of them request stat collections for the same VM in different moments; with that,
// the interval from "vm.stats.interval" is not respected. Also, the stats commands are routed to the Management Server connected to the Agent where the VM is running.
// Furthermore, the number of stat entries on the DB scales with the number of Management Servers. Therefore, we only request the stat collections from
// hosts connected to the Management Server, honoring the interval, presenting the correct data, and reducing the necessary storage to store the VMs stats.
Comment on lines +1230 to +1233

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaOrtiga , can you summarise this and move it to a javadoc?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland

I can move it to the javadoc, I originally put it there because I believe its a little weird to have a javadoc that refers to a single if in the method, but I'm fine with changing it.

As far as summarizing, would it still be necessary? if we are moving it to the javadocs it's no longer cluttering the code, and having the full information on why this if is usefull won't hurt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I’d prefer to have no comment in a method unless there are some really nasty quirks needed. In this case I don’t think any comment is needed to be honest. I summary of the method is more useful in my opinion. (no hard demands)

logger.debug("Skipping VM stat collection for [{}] as it is connected to another Management Server node [{}].", host, host.getManagementServerId());
continue;
}
Date timestamp = new Date();
Pair<Map<Long, VMInstanceVO>, Map<String, Long>> vmsAndMap = getVmMapForStatsForHost(host);
Map<Long, VMInstanceVO> vmMap = vmsAndMap.first();
Expand Down
Loading