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 exampleMaybe 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 > >