You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/11/08 13:11:11 UTC
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6358: Fix memory stats for KVM
DaanHoogland commented on code in PR #6358:
URL: https://github.com/apache/cloudstack/pull/6358#discussion_r1016607418
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -1298,9 +1308,84 @@ public boolean configure(final String name, final Map<String, Object> params) th
s_logger.info("iscsi session clean up is disabled");
}
+ setupMemoryBalloonStatsPeriod(conn);
+
return true;
}
+ /**
+ * Gets the ID list of the VMs to set memory balloon stats period.
+ * @param conn the Libvirt connection.
+ * @return the list of VM IDs.
+ */
+ protected List<Integer> getVmsToSetMemoryBalloonStatsPeriod(Connect conn) {
+ List<Integer> vmIdList = new ArrayList<Integer>();
Review Comment:
```suggestion
List<Integer> vmIdList = new ArrayList<>();
```
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -1298,9 +1308,84 @@ public boolean configure(final String name, final Map<String, Object> params) th
s_logger.info("iscsi session clean up is disabled");
}
+ setupMemoryBalloonStatsPeriod(conn);
+
return true;
}
+ /**
+ * Gets the ID list of the VMs to set memory balloon stats period.
+ * @param conn the Libvirt connection.
+ * @return the list of VM IDs.
+ */
+ protected List<Integer> getVmsToSetMemoryBalloonStatsPeriod(Connect conn) {
+ List<Integer> vmIdList = new ArrayList<Integer>();
+ Integer[] vmIds = null;
+ try {
+ vmIds = ArrayUtils.toObject(conn.listDomains());
+ } catch (final LibvirtException e) {
+ s_logger.error("Unable to get the list of Libvirt domains on this host.", e);
+ return vmIdList;
+ }
+ vmIdList.addAll(Arrays.asList(vmIds));
+ s_logger.debug(String.format("We have found a total of [%s] VMs (Libvirt domains) on this host: [%s].", vmIdList.size(), vmIdList.toString()));
+
+ if (vmIdList.isEmpty()) {
+ s_logger.info("Skipping the memory balloon stats period setting, since there are no VMs (active Libvirt domains) on this host.");
+ }
+ return vmIdList;
+ }
+
+ /**
+ * Gets the current VM balloon stats period from the agent.properties file.
+ * @return the current VM balloon stats period.
+ */
+ protected Integer getCurrentVmBalloonStatsPeriod() {
+ if (AgentPropertiesFileHandler.getPropertyValue(AgentProperties.VM_MEMBALLOON_DISABLE)) {
Review Comment:
```suggestion
if (Boolean.TRUE.equals(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.VM_MEMBALLOON_DISABLE))) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org