[lxc-users] lxc-create try rsync data to device instead mount point

Serge Hallyn serge.hallyn at ubuntu.com
Mon Jul 28 13:32:37 UTC 2014


Quoting mxs kolo (kolomaxes at gmail.com):
> >> And problem in lxc-centos and other template fixed with small patch:
> >>
> >> # diff -uN /usr/share/lxc/templates/lxc-centos
> >> /usr/share/lxc/templates/lxc-centos.ORIG
> >> --- /usr/share/lxc/templates/lxc-centos 2014-07-25 17:52:11.509618392
> >> +0400
> >> +++ /usr/share/lxc/templates/lxc-centos.ORIG    2014-07-07
> >> 12:39:32.430333034 +0400
> >> @@ -686,7 +686,7 @@
> >>      case "$1" in
> >>          -h|--help)      usage $0 && exit 0;;
> >>          -p|--path)      path=$2; shift 2;;
> >> -        --rootfs)       rootfs_path=$2; shift 2;;
> >> +        --rootfs)       rootfs=$2; shift 2;;
> >
> > That's the wrong way, you should use what lxc passed in as "--rootfs"
> > argument
> Compare template lxc-download (work in my case)
> 1) get params
>  --rootfs)           LXC_ROOTFS=$2; shift 2;;
> 2) copy data:
>  tar  --anchored ${EXCLUDES} --numeric-owner -xpJf \
>     ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS}
> 
> 
> and in lxc-centos:
> 1) get params
> --rootfs)       rootfs=$2; shift 2;;
> 2) copy data:
> rsync -a $cache/rootfs/ $rootfs_path/
> 
> In lxc-centos everywhere use variable $rootfs_path, but in getops
> created variable  $rootfs
> And because rootfs_path is empty, it defined as /dev/data/LVM_NAME  in
> case LVM in next block:
> if [ -z "$rootfs_path" ]; then
>     rootfs_path=$path/rootfs
>     # check for 'lxc.rootfs' passed in through default config by lxc-create
>     if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
>         rootfs_path=$(sed -e '/^lxc.rootfs\s*=/!d' -e 's/\s*#.*//' \
>             -e 's/^lxc.rootfs\s*=\s*//' -e q $path/config)
>     fi
> fi
> 
> Who must set correct rootfs_path ?

As I said before, the correct rootfs_path is passed in by lxc.  It has
already mounted the device, and is telling the template where it can
find it.


More information about the lxc-users mailing list