On Thu, 2016-08-04 at 20:02 +0500, Aleem Akhtar wrote:
I am trying to get stats of Domains running under XEN hypervisor.
I used Libvirt function for this purpose. I am trying to understand
output for Memory. Domain running is Fedora-22 with 1GB Ram. Here is my
code
y = virDomainGetInfo(allDomain, &info);
if (y == -1)
printf("Errorl\n");
else {
printf("Max Memory: %lu\n", info.maxMem);
printf("Memory: %lu", info.memory);
}
I get output as
Max Memory: 1048576
Memory: 1048576
Now, as per Libvirt API, info.memory should return the memory in KBytes
used by the domain. My Question is, if info.memory returns memory used
and my domain is using complete 100% of Max Memory or not? Also I tried
to create Domain with memory varying from 128MB to 2GB with same effect.
I also tried to run some applications in Domain but Memory usage return
by given function does not change. Any help or guidance will be much
appreciated.
The relevant virDomainInfo field is described as
/* the memory in KBytes used by the domain */
unsigned long memory;
but in this context, "used by" really means "available to".
So the output above tells you that your Fedora guest has
1 GB of memory available; how much of that memory is actually
being used by the guest OS is something that you can find out
by running top inside the guest.
--
Andrea Bolognani / Red Hat / Virtualization