What is the robust/recommended way to retrieve the PID of a VM's init process ?

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

 



Hello there

I am trying to locate the namespaces in place for a given lxc container (specifically /proc/<pid>/ns/*)

And to this end I was wondering what is the recommended way to probe for an lxc container's init pid
(mostly I'm after the mnt and pid namespaces, and probably network ones, but the actual list probably should not matter) 

I've found about "virsh domid" but this gives me the pid for libvirt_lxc, which turns out to have unmodified namespaces (at least as far as the mnt ns)
OTOH this process has exactly one child which is the container's init, which seems to have the right set of namespaces 

My angle right now is to look in /proc/<domid_pid>/task/children for a - hopefully single - pid and that seems to work for now, but I am concerned this code may be fragile so I would rather use a more robust approach; or maybe this is robust ? 

Any insight would be most welcome -- Thanks in advance

---
PS.
I am using a stock fedora20 box with 
[root@vnode11 ~]# rpm -q libvirt
libvirt-1.1.3.2-1.fc20.x86_64



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