Peter Steele
2016-Mar-10 00:00 UTC
[libvirt-users] How to test if a console session is active?
I use libvirt to manage a container based environment. Is there an efficient method for testing if someone has a console session open for a given container? The approach I'm using at the moment is to use lsof and check if there is an entry for the container's console pts device. For example, I can determine a container's console device from its xml definition: # virsh dumpxml vm-00|grep -A 4 pty <console type='pty' tty='/dev/pts/3'> <source path='/dev/pts/3'/> <target type='lxc' port='0'/> <alias name='console0'/> </console> Once I have pts device, I can do something like # if lsof /dev/pts/3; then echo "Container vm-00 has an active console session"; fi This all works fine but we've found that lsof is very expensive. Is there a more efficient means to make this active console check? Peter
Apparently Analagous Threads
- Re: Zombie processes being created when console buffer is full
- Re: Zombie processes being created when console buffer is full
- Re: libvrtd-1.1.0 crashes when attempting to start some (but not all) LXC containers
- Re: libvrtd-1.1.0 crashes when attempting to start some (but not all) LXC containers
- libvrtd-1.1.0 crashes when attempting to start some (but not all) LXC containers