Skip to content

Incorrect memoryintfreekbs in listVirtualMachines for KVM #4566

Description

@davidjumani

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions