[Lxc-users] [LXC] [lxc-debian] support of simultaneously amd64 and ia32 and many Debian release

LACROIX Jean Marc jeanmarc.lacroix at free.fr
Mon Dec 12 06:18:21 UTC 2011


hi,

I have inprove  lxc-debian in order  to support new options and manage
also legacy containers at the same time.

Please find  the doc in following...

Daniel, I have started this job with the Debian Squeeze lxc package, so i
hope there is no problem for you to merge this tool with your main git
repository.

For test point of vue, i have verified that is is possible to have the
lenny, squeeze and wheezy on  the host with all architecture.

Regards.
-----------------------------------------
NAME: lxc-debian

SYNOPSIS
  lxc-debian [-h|--help] or ...
   [-c|--clean]  or ...
   [-p|--path=<path> -n|--name=<hostname> 
-D|--distrib=[lenny|squeeze|wheezy]]
      [-A|--architecture=[adm64|i386]]
      [-d|--debug]

  -h|--help     (optionnal) this help documentation

  -c|--clean    (optionnal) in order to clean local cache


  -p|--path    (mandatory)  the  directory   for  LXC   virtual machine
  installation

  -n|--name     (mandatory) the hostname for the LXC virtual machine

  -D|--distrib  (mandatory) the Debian distribution to install

  -d|--debug    (optionnal) in order to debug (use internaly set -x)

  -P|--packages (optionnal) in order to  add Debian packages to initial
  list

  -A|--architecture  (optionnal) in order   to force initial user space
  architecture (amd64 or i386)

DESCRIPTION Lxc-debian installs one debootstrap Debian distribution in
a dedicated path specified by <--path> option in order to create later
one Linux LXC virtual machine (VM) with lxc-start command.

The   first  step is   to   download one  minimal Debian  distribution
specified by <--distrib>  option  into  a local  cache   installed in
/var/cache/lxc/debian.
If distribution is already downloaded, then this step is skipped.

Second step consist  to extract  packages from   local cache  to  path
specified by <--path> option.

Last step consist to create a dedicated init sequence in the VM with a
minimal  mount /etc/fstab file.  The hostname   of the VM  is set with
<--name> option  and  one LXC  configuration is  automatically created
with   default dhcp boot configuration    (please adjust it).  The LXC
configuration file is set in <--path>/config file.

The  initial   Debian  distribution is  download   from  web   site  :
http://ftp.debian.org/debian.

The minimal list of  high level packages  used in the new  LXC VM is :

ifupdown,locales,libui-dialog-perl,dialog,dhcp3-client,netbase,net-tools,iproute,openssh-server

If user want to  add  packages to initial  debootstrap list,  then use
<--packages> option with packages separated by comma.(look at EXAMPLES
section)

Of course, it  is user responsability  to set correct package coherent
with the Debian distribution used.

As LXC is a virtualized container technology used in user space, it is
possible  to   have on  the  same  host different   Debian release LXC
containers.  This is  mainly  due to the  fact  that Posix is a   very
stable API interface  so  that it is   possible  at one time  to  have
different   release.  This is why <--distrib>   must be specified as a
mandatory parameter. Remember always that with  LXC, you have only one
Linux  kernel and as  much Glibc as container.   So as all users space
software components are always dependant from Glibc, it is possible to
have different Debian release distributions.  There is however a limit
to  this capability, this  is when one   user space application make a
direct access to kernel without calling Posix service via Glibc.

About <--architecture> option.   This   option can be  used  only  on
Intel/Amd  X86 architecture.  With new  x86  64 bits extensions, it is
possible  to have  on the same   plateform one LXC container  with one
Debian/X86/ia32   architecture,   and  one   another   container  with
Debian/X86/amd64  architecture, providing the  Linux kernel is running
in  amd64  mode.  This tools  does  not NOT VERIFY  if current running
kernel is in 64 bits or not.  It is user responsability to manage this
option according  his platform (!). If  this option is not  used, then
internal architecture is set with the  output value provided by 'arch'
tool.

As a conclusion, with <--architecture>  and <--distrib> options, it is
possible to  build a rich environment mixing  stable, legacy and futur
Debian plateform.  This is very important  if for example  you want to
host on a network of several architectures simultaneously.

This     allows for example     system administrators  to  migrate old
applications to new release one without interrupted service.

  EXAMPLES

   sudo lxc-debian --path=/tmp/test_lxc \
           --distrib=squeeze --name=vm_squeeze

   sudo lxc-debian --path=/tmp/test_lxc \
           --distrib=lenny --name=vm_lenny \
           --packages='iputils-ping,tcpdump'

   sudo lxc-debian --path=/tmp/test_lxc \
           --distrib=wheezy --name=vm_wheezy \
           --architecture=i386

AUTHORS
   daniel.lezcano at free.fr (initial) & jeanmarc.lacroix at free.fr (2011)


-- 
--------------------------------------
  -- Jean-Marc LACROIX                 --
   -- mailto : jeanmarc.lacroix at free.fr --
     ---------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lxc-debian.tar.gz
Type: application/x-gzip
Size: 5619 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20111212/56d172dc/attachment.bin>


More information about the lxc-users mailing list