Feature #1590
Memory reporting for ESXi VMs
Status: | Closed | Start date: | 10/24/2012 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Drivers - Auth | |||
Target version: | - | |||
Resolution: | invalid | Pull request: |
Description
Hi,
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 end + } case state @@ -172,7 +180,7 @@ class VMwareDriver state_short = 'd' end - return "STATE=#{state_short}" + return "STATE=#{state_short} USEDMEMORY=#{memory}" end # ------------------------------------------------------------------------ #
History
#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.