cloudstack: Incorrect `memoryintfreekbs` in listVirtualMachines for KVM

The memoryintfreekbs retuned by listVirtualMachines for KVM is always greater than the total memory allocated for the VM. This is because it returns the RSS of the process running the VM (https://libvirt.org/manpages/virsh.html#dommemstat) The RSS shows how much memory is allocated to that process and is in RAM. It is returned by memoryStats over at https://github.com/apache/cloudstack/blob/master/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java#L3712-L3718 when trying to fetch the free memory instead

Need to discuss how to handle this as well as the impact on usage

ISSUE TYPE
  • Bug Report
CLOUDSTACK VERSION
4.11+ (tested)
OS / ENVIRONMENT

KVM

STEPS TO REPRODUCE
(localcloud) SBCM5> > list virtualmachines filter=memory,memoryintfreekbs,memorykbs,memorytargetkbs,
{
  "count": 3,
  "virtualmachine": [
    {
      "memory": 512,
      "memoryintfreekbs": 552836, <---
      "memorykbs": 524288,
      "memorytargetkbs": 524288
    },

EXPECTED RESULTS
The used memory
ACTUAL RESULTS
Total memory used by the process running the VM

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

thanks. can we change the title to match the problem please. Anyone looking back through commits will be misled.

I don’t think that the overhead to run a VM is the end-users problem, I think that if I created a VM with 8GB RAM, I would expect to get charged for 8GB.