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/05/05 07:56:01 UTC

[GitHub] [cloudstack] rohityadavcloud commented on a diff in pull request #6358: Fix memory stats for KVM

rohityadavcloud commented on code in PR #6358:
URL: https://github.com/apache/cloudstack/pull/6358#discussion_r865642146


##########
agent/src/main/java/com/cloud/agent/Agent.java:
##########
@@ -150,6 +153,29 @@ public int value() {
     private String _keystoreSetupPath;
     private String _keystoreCertImportPath;
 
+    /**
+     * Virsh command to list the name of all VM instances starting with "i-".
+     */
+    protected static final String COMMAND_LIST_ALL_VMS = "virsh list --all --name | grep '^i-*'";
+
+    /**
+     * 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:
   (comment for all virsh usages)
   Is there a libvirt equivalent to do this? Forking to shell isn't a good idea with arbitrary strings `%s` that may be passed to it.
   
   In case libvirt doesn't support that, you may also raise a MR with https://gitlab.com/libvirt/libvirt-java and then use those changes.



-- 
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