[libvirt-users] Correctly using libvirt to mount /dev/pts and /dev in an lxc application container

David Jablonski djablonski at inoc.com
Tue Mar 6 19:34:28 UTC 2012


We would like to mount /dev and /dev/pts correctly using the libvirt xml
config file instead of doing a bind mount in a container init script we use.

Currently the container config is:

<domain type='lxc'>
  <name>CentOS_57</name>
  <uuid>ff5d3c04-49e6-a3cc-0a14-ff13625eca3c</uuid>
  <memory>262144</memory>
  <currentMemory>262144</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686'>exe</type>
    <init>/bin/lxc-progs</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='//home'/>
      <target dir='/home'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/archive/centos57-root'/>
      <target dir='/'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='//archive'/>
      <target dir='/archive'/>
    </filesystem>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
  </devices>
</domain>


The /bin/lxc-progs file is:

#!/bin/sh

service rsyslog start
service sssd start
service sshd start
mount -t devtmpfs none /dev
mount -t devpts none /dev/pts
mount -t tmpfs none /dev/shm
exec /bin/sh

Basically how do we remove the above mount points in the lxc init
process and use libvirt to control the mounts instead?

Any help would be appreciated.  Thank you.

-- 
David W. Jablonski
Systems Administrator
INOC
608.204.0202
608.663.4555
djablonski at inoc.com
www.inoc.com

*** DELIVERING UPTIME ***




More information about the libvirt-users mailing list