[lxc-devel] [PATCH 3/4] support alternate container path in lxc-clone.in
Serge Hallyn
serge.hallyn at ubuntu.com
Fri May 3 12:20:12 UTC 2013
Quoting Harald Dunkel (harald.dunkel at aixigo.de):
> ---
> src/lxc/lxc-clone.in | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
lxc-clone is now provided by lxc_clone.c.
(Which brings up the point: we might want to discuss maintenance of
stable trees, i.e. for 0.7.x, 0.8.0, and 0.9.0)
> diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in
> index 4c8acb4..8ff9947 100755
> --- a/src/lxc/lxc-clone.in
> +++ b/src/lxc/lxc-clone.in
> @@ -25,7 +25,7 @@ set -e
>
> usage() {
> echo "usage: $(basename $0) -o ORIG_NAME -n NEW_NAME [-s] [-h] [-L FS_SIZE]" >&2
> - echo " [-v VG_NAME] [-p LV_PREFIX] [-t FS_TYPE]" >&2
> + echo " [-P LXC_PATH] [-v VG_NAME] [-p LV_PREFIX] [-t FS_TYPE]" >&2
> }
>
> help() {
> @@ -38,6 +38,7 @@ help() {
> echo " -n NEW_NAME specify the name of the new container" >&2
> echo " -s make the new rootfs a snapshot of the original" >&2
> echo " -L FS_SIZE specify the new filesystem size (default: same as original)" >&2
> + echo " -P LXC_PATH use an alternate container path (default: @LXCPATH@)" >&2
> echo " -v VG_NAME specify the new LVM volume group name (default: lxc)" >&2
> echo " -p LV_PREFIX add a prefix to new LVM logical volume names" >&2
> echo " -t FS_TYPE specify the new filesystem type (default: ext3;" >&2
> @@ -83,6 +84,11 @@ while [ $# -gt 0 ]; do
> lxc_size=$1
> shift
> ;;
> + -P|--lxcpath)
> + optarg_check $opt $1
> + lxc_path="$1"
> + shift
> + ;;
> -t|--fstype)
> optarg_check $opt $1
> fstype=$1
> @@ -167,9 +173,9 @@ cleanup() {
> fi
> lvremove -f $rootdev || true
> fi
> - ${bindir}/lxc-destroy -n $lxc_new || true
> + ${bindir}/lxc-destroy -n $lxc_new -P "$lxc_path" || true
> if [ $frozen -eq 1 ]; then
> - lxc-unfreeze -n $lxc_orig
> + lxc-unfreeze -n $lxc_orig -P "$lxc_path"
> fi
> echo "$(basename $0): aborted" >&2
> exit 1
> @@ -196,7 +202,7 @@ oldroot=`grep lxc.rootfs $lxc_path/$lxc_orig/config | awk -F'[= \t]+' '{ print $
> rootfs=`echo $oldroot |sed "s/$lxc_orig/$lxc_new/"`
>
> container_running=True
> -lxc-info -n $lxc_orig --state-is RUNNING || container_running=False
> +lxc-info -n $lxc_orig -P "$lxc_path" --state-is RUNNING || container_running=False
>
> sed -i '/lxc.rootfs/d' $lxc_path/$lxc_new/config
> if [ -b $oldroot ]; then
> @@ -205,7 +211,7 @@ if [ -b $oldroot ]; then
> lvm=TRUE
> # ok, create a snapshot of the lvm device
> if [ $container_running = "True" ]; then
> - lxc-freeze -n $lxc_orig
> + lxc-freeze -n $lxc_orig -P "$lxc_path"
> frozen=1
> fi
> if [ $lxc_size = "_unset" ]; then
> @@ -219,7 +225,7 @@ if [ -b $oldroot ]; then
> }
>
> if [ $container_running = "True" ]; then
> - lxc-unfreeze -n $lxc_orig
> + lxc-unfreeze -n $lxc_orig -P "$lxc_path"
> frozen=0
> fi
> if [ $snapshot = "no" ]; then
> @@ -274,14 +280,14 @@ else
> cleanup
> fi
> if [ $container_running = "True" ]; then
> - lxc-freeze -n $lxc_orig
> + lxc-freeze -n $lxc_orig -P "$lxc_path"
> frozen=1
> fi
> mkdir -p $rootfs/
> rsync -Hax $oldroot/ $rootfs/
> echo "lxc.rootfs = $rootfs" >> $lxc_path/$lxc_new/config
> if [ $container_running = "True" ]; then
> - lxc-unfreeze -n $lxc_orig
> + lxc-unfreeze -n $lxc_orig -P "$lxc_path"
> frozen=0
> fi
> fi
> --
> 1.8.1.3
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list