3 # description: Create BTRFS subvolumes for LXC reference images.
6 # not needed -- Source function library
7 #. /etc/init.d/functions
9 # This is where sliceimage(s) store their reference images
10 sliceimage_dir=/vservers/.vref
11 lxc_dir=/vservers/.lvref
13 # Check if we are in the build environment
14 function check_node () {
15 mount | grep -q 'planetlab-vservers' || exit 0
16 [ -d $sliceimage_dir ] || { echo "No sliceimage installed" ; exit 1; }
23 sliceimages=$(cd $sliceimage_dir ; ls )
25 for sliceimage in $sliceimages; do
27 # already known to lxc - skip it
28 # xxx we need a smarter way to handle upgrades
29 [ -d $lxc_dir/$sliceimage ] && continue
31 btrfs subvolume create $lxc_dir/$sliceimage
33 #btrfs subvolume create $lxc_dir/lxc-squeeze-x86_64
34 # copy the slice image into the btrfs ?
35 tar -C $sliceimage_dir -cf - $sliceimage | tar -C $lxc_dir -xf -
36 # the original code trashed the ref image that came with an rpm
37 #rm -rf /vservers/lxc-reference-${VERSION}.tgz
38 # this would probably cause the image to be re-created upon yum update
39 # or prevent updates to make it to the node ?
40 #rm -rf $sliceimage_dir/$sliceimage
45 echo -n "Checking node .. "
48 echo "From installed sliceimage variants"
50 echo "Exported to lxc"
55 start|restart|reload) start ; exit 0 ;;
56 status) status ; exit 0 ;;
58 *) echo $"Usage: $0 {start|stop|status}"