From 2b289499a375bf90110616654ec5bb9fa8c7eb61 Mon Sep 17 00:00:00 2001 From: leebaok Date: Wed, 6 Apr 2016 14:47:16 +0800 Subject: [PATCH] [lxcfs] add lxcfs support for docklet --- conf/lxc-script/lxc-ifdown | 6 ++++++ conf/lxc-script/lxc-prestart | 8 ++++++++ prepare.sh | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/conf/lxc-script/lxc-ifdown b/conf/lxc-script/lxc-ifdown index 5d80873..50d05b3 100755 --- a/conf/lxc-script/lxc-ifdown +++ b/conf/lxc-script/lxc-ifdown @@ -1,3 +1,9 @@ #!/bin/sh +# $1 : name of container ( name in lxc-start with -n) +# $2 : net +# $3 : network flags, up or down +# $4 : network type, for example, veth +# $5 : value of lxc.network.veth.pair + ovs-vsctl --if-exists del-port $Bridge $5 diff --git a/conf/lxc-script/lxc-prestart b/conf/lxc-script/lxc-prestart index ef9fc1d..3e34c86 100755 --- a/conf/lxc-script/lxc-prestart +++ b/conf/lxc-script/lxc-prestart @@ -5,4 +5,12 @@ # $3 Section (always 'lxc'). # $4 The hook type (i.e. 'clone' or 'pre-mount'). +# following environment variables are set by lxc : +# $LXC_NAME: is the container's name. +# $LXC_ROOTFS_MOUNT: the path to the mounted root filesystem. +# $LXC_CONFIG_FILE: the path to the container configuration file. +# $LXC_SRC_NAME: in the case of the clone hook, this is the original container's name. +# $LXC_ROOTFS_PATH: this is the lxc.rootfs entry for the container. +# Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. + echo $HNAME > $LXC_ROOTFS_PATH/etc/hostname diff --git a/prepare.sh b/prepare.sh index f53b058..ea52cca 100755 --- a/prepare.sh +++ b/prepare.sh @@ -27,7 +27,7 @@ fi # install packages that docklet needs (in ubuntu) # some packages' name maybe different in debian -apt-get install -y cgmanager lxc lvm2 bridge-utils curl exim4 openssh-server openvswitch-switch +apt-get install -y cgmanager lxc lxcfs lxc-templates lvm2 bridge-utils curl exim4 openssh-server openvswitch-switch apt-get install -y python3 python3-netifaces python3-flask python3-flask-sqlalchemy python3-pampy apt-get install -y python3-psutil apt-get install -y python3-lxc