Libvirt + LXC terminals

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

 



Hello all,

I am looking for a way to start a container with libvirt and bind multiple consoles to it. My container is running busybox, the filesystem created using the LXC package (0.8.0). My libvirt version is 0.10.1.

Configuration of the filesystem:
- in the container rootfs, /dev contains 2 devices - /dev/console and /dev/tty1
- the inittab file looks like this:
::sysinit:/etc/init.d/rcS
tty1::respawn:/bin/getty -L tty1 115200 vt100
console::askfirst:/bin/sh
- it will link the /bin/sh process to /dev/console and the /bin/getty process to /dev/tty
- when starting the container with lxc-start, each of these processes gets his own local /dev/pts device:
25609 ?        Ss     0:00 lxc-start -n foo -d
25612 ?        Ss     0:00  \_ init
25684 ?        Ss     0:00      \_ /bin/syslogd
25686 pts/3    Ss+    0:00      \_ /bin/getty -L tty1 115200 vt100
25687 pts/4    Ss+    0:00      \_ init

Here is the container.xml file I use to run with libvirt (you may ignore the console devices, since I don't know how much sense they make right now):
<domain type='lxc'>
        <name>foo</name>
        <memory>500000</memory>

        <os>
            <type>exe</type>
            <init>/bin/init</init>
        </os>

        <vcpu>1</vcpu>
        <clock offset='utc'/>
        <on_poweroff>destroy</on_poweroff>
        <on_reboot>restart</on_reboot>
        <on_crash>destroy</on_crash>
        <devices>
                <emulator>/usr/libexec/libvirt_lxc</emulator>

                <filesystem type="mount">
                        <source dir="/usr/var/lib/lxc/foo/rootfs" />
                        <target dir="/" />
                </filesystem>

                <interface type="bridge">
                        <source bridge="br0" />
                        <name>eth0</name>
                        <ip address="10.171.73.128" netmask="255.255.255.0" />
                </interface>

                <console type='pty' tty='/dev/pts/3'>
                        <source path='/dev/pts/3' />
                        <target path='/dev/console' />
                </console>

                <serial type='pty' tty='/dev/pts/4'>
                        <source path='/dev/pts/4' />
                        <target path='/dev/tty1' />
                </serial>

        </devices>
</domain>

When starting the container with virsh start foo, the firt init process gets a local /dev/pts device, and it is inherited by its children:
[root@everest][~]# ps axf
25858 ?        Ss     0:00 /usr/libexec/libvirt_lxc --name foo --console 20 --security=selinux --handshake 23 --background --veth veth1
25859 pts/0    Ss+    0:00  \_ init
25870 ?        Ss     0:00      \_ /bin/syslogd
25872 ?        Ss     0:00      \_ /bin/getty -L tty1 115200 vt100
25873 ?        Ss     0:00      \_ init
[root@everest][~]# ls -l /proc/25872/fd
total 0
lrwx------. 1 root root 64 Mar 14 07:09 0 -> /dev/pts/0
lrwx------. 1 root root 64 Mar 14 07:09 1 -> /dev/pts/0
lrwx------. 1 root root 64 Mar 14 07:09 2 -> /dev/pts/0
[root@everest][~]# ls -l /proc/25873/fd
total 0
lrwx------. 1 root root 64 Mar 14 07:09 0 -> /dev/pts/0
lrwx------. 1 root root 64 Mar 14 07:09 1 -> /dev/pts/0
lrwx------. 1 root root 64 Mar 14 07:09 2 -> /dev/pts/0

What I tried to do in the .xml, and I would need, is a way to bind a local /dev/pts devices to child processes in the container. Explicitly:
- bind /dev/pts/3 to <container_rootfs>/dev/console
- bind /dev/pts/4 to <container_rootfs>/dev/tty1

I've found some documentation at [1], hence my trials in the presented .xml. Is my scenario possible / supported?

Thank you very much,
Bogdan P.

[1] http://libvirt.org/formatdomain.html#elementsConsole



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