LXC and Dahdi

Home » Asterisk Users » LXC and Dahdi
Asterisk Users 5 Comments

Howdy,

I am playing around with asterisk within an LXC container on Ubuntu 11.04.
I have asterisk (1.4.42) running fine, but want access to dahdi_dummy for
timing (meetme). I have dahdi installed on the “host”, and dahdi_dummy is
loaded:

root@astnorth:/# ls -ltr /dev/dahdi
total 0
crw-rw—- 1 root root 196, 250 2011-06-08 13:59 transcode
crw-rw—- 1 root root 196, 253 2011-06-08 13:59 timer
crw-rw—- 1 root root 196, 255 2011-06-08 13:59 pseudo
crw-rw—- 1 root root 196, 0 2011-06-08 13:59 ctl
crw-rw—- 1 root root 196, 254 2011-06-08 13:59 channel
root@astnorth:/#

But in the container I don’t see them:

root@artha:/# ls -ltr /dev/dahdi
total 0

even though /dev/dahdi showed up as soon as I loaded the kernel module in
the host.

Maybe this is more a question for an LXC list, but I noted that a few
people had played with this (asterisk in LXC) and wondered if anyone
managed to get dahdi_dummy shared across their containers…

Thanks for any input,

5 thoughts on - LXC and Dahdi

  • It works very well for me.

    However I don’t use udev and /dev is statically created like in the good
    old days.

    Gordon

  • Maybe you need to enable the guest to access those devices?

    In the lxc guest conf file, you should probably have omething like:

    lxc.cgroup.devices.allow = c 196:0 rwm # /dev/dahdi/ctl
    lxc.cgroup.devices.allow = c 196:253 rwm # /dev/dahdi/timer
    lxc.cgroup.devices.allow = c 196:254 rwm # /dev/dahdi/channel
    lxc.cgroup.devices.allow = c 196:255 rwm # /dev/dahdi/pseudo
    # For the record: you don’t probably don’t need the following one:
    #lxc.cgroup.devices.allow = c 196:250 rwm # /dev/dahdi/transcode

  • Hi,

    Does it make sense to use LXC as mean to quickly switch from one dahdi
    version to another or shall other virtualization technologies be preferred ?

    Cheers

  • LXC is basically the same as OpenVZ and Linux-VServer (and probably like
    Solaris Zones and FreeBSD Jails): The processes of the guest still run
    inder the same host (specifically: share the same kernel).

    LXC (or rather: cgroups) is now prt of mainline kernel. From palying
    with it on Debian Squeeze, it feels still a bit immature (and even more
    so: lacking documentation). But as the usage of cgroups grows in the
    coming years (e.g.: in systemd), I would expect to see it more and more
    common.

    KVM, Xen, VMWare and the likes “emulate” a complete virtual machine. Not
    just a set of processes. Specifically, your processes run on top of
    their own kernel. This requires more resources, but provides better
    isolation.

  • That’s the important bit: One Kernel – that means the version of
    dahdi you load is shared amongst all containers you use, so trying to get
    one container run with a different version is not possible.

    I’ve been using it for virtual servers for some time now – well, since
    late last year. Both for Asterisk as as general purpose virtual LAMP
    hosting. Documentation is an issue, and it’s a bit of a steep learning
    curve and not everything that people post to the various other lists, etc.
    is relevant to what I want it for, so there’s a little bit of “making it
    up as you go along” – at least for me, but I now have something that works
    well.

    In my early experiments, I used an old 1.8Mhz Celeron as a test-bed – I
    installed 20 containers, each running asterisk and arranged one to call
    the next to call the next … to call the first … and when the last one
    got to a certian count it connected itself to MoH… I then got a SIP
    phone to call the first one…

    Without doing anything clever, I got it to loop 3 times before it showed
    signs of stress… So so each asterisk only passing media for 3 calls, but
    that’s effectively 60 calls all passing media between them – the kernel
    time was starting to get high at that point – I reckoned it was probably
    the network stack was topping out more than anything else. When I did this
    on production hardware (quad core, 3GHz cpus), that setup was barely
    noticable.

    I briefly played with KVM, but you really need a CPUs that support a few
    extra instructions to make it more efficient – even then, it’s not as
    efficient as LXC is, however it does have other benefits – differenet
    kernels, different modules, kill a kernel, you don’t kill the host, etc.
    However for my needs, LXC is working very well.

    Gordon