[libvirt-users] libvirt and guest processes

Hi I wanted to find out if there is way to list all the running processes in a guest VM from the hypervisor. Like the output of 'ps -ef' from inside the guest VM, but without logging in or ssh into it. Thanks dtsweval

On 20.04.2015 06:22, dt sweval wrote:
Hi I wanted to find out if there is way to list all the running processes in a guest VM from the hypervisor. Like the output of 'ps -ef' from inside the guest VM, but without logging in or ssh into it.
No, I don't think there's a way. Problem is, libvirt views guest internals private to the guest. Having said that, I don't think there ever will be an API for that. Nor qemu-ga has an API for executing an arbitrary shell commands. Michal

As I know, you can use Libvmi API to access the memory of VM and then walk through the double-linked list of process to reconstruct the process list. it is easy, and libvmi has provide the example 在2015-04-20 22:52:02,hanyandong<hanyandong@iie.ac.cn>写道:
On 20.04.2015 06:22, dt sweval wrote:
Hi I wanted to find out if there is way to list all the running processes in a guest VM from the hypervisor. Like the output of 'ps -ef' from inside the guest VM, but without logging in or ssh into it.
No, I don't think there's a way. Problem is, libvirt views guest internals private to the guest. Having said that, I don't think there ever will be an API for that. Nor qemu-ga has an API for executing an arbitrary shell commands.
Michal
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On 04/20/2015 07:32 PM, hanyandong wrote: [please don't top-post on technical lists]
As I know, you can use Libvmi API to access the memory of VM and then walk through the double-linked list of process to reconstruct the process list. it is easy, and libvmi has provide the example
Maybe so, but that requires very intimate knowledge of the exact kernel running in the guest, and could be rather fragile; especially if you are not freezing the guest while snooping memory. Adding a guest-agent command would probably be more portable across a wider range of guests.
No, I don't think there's a way. Problem is, libvirt views guest internals private to the guest. Having said that, I don't think there ever will be an API for that. Nor qemu-ga has an API for executing an arbitrary shell commands.
There have been proposals on the qemu list for adding such a qemu-ga command, although it hasn't been reviewed for inclusion yet. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Apr 20, 2015 at 8:04 PM, Eric Blake <eblake@redhat.com> wrote:
On 04/20/2015 07:32 PM, hanyandong wrote:
[please don't top-post on technical lists]
As I know, you can use Libvmi API to access the memory of VM and then walk through the double-linked list of process to reconstruct the process list. it is easy, and libvmi has provide the example
Maybe so, but that requires very intimate knowledge of the exact kernel running in the guest, and could be rather fragile; especially if you are not freezing the guest while snooping memory. Adding a guest-agent command would probably be more portable across a wider range of guests.
I agree with that, even though this might work, but might require very kernel specific code. Probably not the road that I would want to go down. Nevertheless, Yandong, appreciate the suggestion.
No, I don't think there's a way. Problem is, libvirt views guest internals private to the guest. Having said that, I don't think there ever will be an API for that. Nor qemu-ga has an API for executing an arbitrary shell commands.
There have been proposals on the qemu list for adding such a qemu-ga command, although it hasn't been reviewed for inclusion yet.
Thanks Eric for the pointer, do you know if it is on the roadmap or some kind of plan though ? Michal, thanks for your response too. Regards dtsweval
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

this is the libvmi API: https://github.com/libvmi/libvmi this is the example : https://github.com/libvmi/libvmi/blob/master/examples/process-list.c -- Best Regards, yandong
-----原始邮件----- 发件人: "Michal Privoznik" <mprivozn@redhat.com> 发送时间: 2015年4月20日 星期一 收件人: "dt sweval" <dtsweval@gmail.com>, libvirt-users@redhat.com 抄送: 主题: Re: [libvirt-users] libvirt and guest processes
On 20.04.2015 06:22, dt sweval wrote:
Hi I wanted to find out if there is way to list all the running processes in a guest VM from the hypervisor. Like the output of 'ps -ef' from inside the guest VM, but without logging in or ssh into it.
No, I don't think there's a way. Problem is, libvirt views guest internals private to the guest. Having said that, I don't think there ever will be an API for that. Nor qemu-ga has an API for executing an arbitrary shell commands.
Michal
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
participants (4)
-
dt sweval
-
Eric Blake
-
hanyandong
-
Michal Privoznik