Feature #1590

Memory reporting for ESXi VMs

Added by Giovanni Toraldo over 8 years ago. Updated over 8 years ago.

Status:ClosedStart date:10/24/2012
Priority:NormalDue date:
Assignee:-% Done:


Category:Drivers - Auth
Target version:-
Resolution:invalid Pull request:



I've found that with the actual libvirt I am using (0.9.12-4), the allocated memory for VM is available:

Id:             110
Name:           one-43
UUID:           8fd8fe01-2d04-0c63-18fd-3d834ded326d
OS Type:        hvm
State:          running
CPU(s):         1
Max memory:     524288 KiB
Used memory:    524288 KiB
Persistent:     yes
Autostart:      disable
Managed save:   unknown

So I've extended the polling function to report it (it's dirty, I know):

diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb
index d59ca7f..c75e590 100644
--- a/src/vmm_mad/remotes/vmware/vmware_driver.rb
+++ b/src/vmm_mad/remotes/vmware/vmware_driver.rb
@@ -151,14 +151,22 @@ class VMwareDriver
         return "STATE=d" if rc == false

         state = "" 
+       memory ="" 

         info.split('\n').each{ |line|
             mdata = line.match("^State: (.*)")
+            memorydata = line.match("^Max memory: (.*) KiB")

             if mdata
                 state = mdata[1].strip
-                break
+                #break
+            end
+            if memorydata
+                memory = memorydata[1].strip
+                #break

         case state
@@ -172,7 +180,7 @@ class VMwareDriver
                 state_short = 'd'

-        return "STATE=#{state_short}" 
+        return "STATE=#{state_short} USEDMEMORY=#{memory}" 

     # ------------------------------------------------------------------------ #


#1 Updated by Tino Vázquez over 8 years ago

  • Status changed from New to Closed
  • Resolution set to invalid

The used memory and the max memory is hardcoded to the memory requested by ONE, which already knows. For this reason (they being static rather than dynamic values) they are not retrieved by the poll operation-

We are waiting for libvirt to implement this, but as soon as we have free resources we will research on how to retrieve this information bypassing libvirt.

Also available in: Atom PDF