Re: Libvirt's DomainGetInfo Function Development

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2016-08-05 at 17:45 +0500, Aleem Akhtar wrote:
> Ok. So that's why I was getting 1 GB as a result.
> So is there any way I can get memory in used
programmatically? 
> I mean without going inside guest domain.

The only way I can come up with at the moment relies on
qemu-guest-agent:

  $ virsh qemu-agent-command guest \
          '{"execute": "guest-exec",
            "arguments": {"path": "/usr/bin/free",
                          "capture-output": true}}'
  {"return":{"pid":1425}}

  $ virsh qemu-agent-command guest \
          '{"execute": "guest-exec-status",
            "arguments": {"pid": 1425}}'
  {"return":{"exitcode":0,"out-data":"ICA...zIK","exited":true}}

  $ echo 'ICA...zIK' | base64 -d
                total        used        free
  Mem:        4020408       97244     3359560
  Swap:       1048572           0     1048572

Of course you'll need to have qemu-guest-agent running
inside the guest and process all the resulting information
yourself.

See the virDomainQemuAgentCommand() API.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]