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/07/28 23:49:00 UTC
[GitHub] [cloudstack] GabrielBrascher commented on a diff in pull request #6358: Fix memory stats for KVM
GabrielBrascher commented on code in PR #6358:
URL: https://github.com/apache/cloudstack/pull/6358#discussion_r932759440
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -440,6 +440,19 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
protected Boolean enableManuallySettingCpuTopologyOnKvmVm = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM);
+ /**
+ * Virsh command to set the memory balloon stats period.<br><br>
+ * 1st parameter: the VM name;<br>
+ * 2nd parameter: the period (in seconds).
+ */
+ private static final String COMMAND_SET_MEM_BALLOON_STATS_PERIOD = "virsh dommemstat %s --period %s --live";
+
+ /**
+ * Virsh command to get the memory balloon tag from the VM's XML file.<br><br>
+ * 1st parameter: the VM name;<br>
+ */
+ private static final String COMMAND_GET_MEM_BALLOON_FROM_XML_FILE = "virsh dumpxml %s | grep '<memballoon model='";
Review Comment:
Same here, there is already a Java bind for the `virsh dumpxml` via [Domain.getXMLDesc(int flags)](https://gitlab.com/libvirt/libvirt-java/-/blob/master/src/main/java/org/libvirt/Domain.java#L1296)
##########
agent/conf/agent.properties:
##########
@@ -202,6 +202,11 @@ hypervisor.type=kvm
# Disable memory ballooning on vm guests for overcommit, by default overcommit
# feature enables balloon and sets currentMemory to a minimum value.
#
+# The time interval (in seconds) at which the balloon driver will get memory stats updates.
+# This is equivalent to Libvirt's --period parameter when using the dommemstat command.
+# Default value: 60
+#vm.memballoon.stats.period=60
Review Comment:
```suggestion
# vm.memballoon.stats.period=60
```
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -440,6 +440,19 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
protected Boolean enableManuallySettingCpuTopologyOnKvmVm = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM);
+ /**
+ * Virsh command to set the memory balloon stats period.<br><br>
+ * 1st parameter: the VM name;<br>
+ * 2nd parameter: the period (in seconds).
+ */
+ private static final String COMMAND_SET_MEM_BALLOON_STATS_PERIOD = "virsh dommemstat %s --period %s --live";
Review Comment:
Why use `virsh` commands "by hand" if there is already Java bind for it via [Libvirt-Java Domain.memoryStats(int number)](https://gitlab.com/libvirt/libvirt-java/-/blob/master/src/main/java/org/libvirt/Domain.java#L1509)?
Is there something that the `memoryStats` does not support?
--
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