3 # description: Create BTRFS subvolumes for LXC reference images.
16 echo $"Usage: $0 {start|stop|restart|reload|status|force}"
21 # Check if we are in the build environment
22 mount | grep -q 'planetlab-vservers' || exit 0
24 # Source function library
25 . /etc/init.d/functions
27 # xxx get version some other way
28 # might just want to scan /vservers/.vref instead
29 # upgrades (from the real image to the .lvref area) might be challenging
32 sliceimage_dir=/vservers/.vref
34 [ -d $sliceimage_dir ] || exit 0
36 sliceimages=$(cd $sliceimage_dir ; ls )
38 for sliceimage in $sliceimages; do
39 mkdir -p /vservers/.lvref
40 [ -d /vservers/.lvref/$sliceimage ] && continue
41 btrfs subvolume create /vservers/.lvref/$sliceimage
43 # btrfs subvolume create /vservers/.lvref/lxc-squeeze-x86_64
44 # copy the slice image into the btrfs ?
45 tar -C $sliceimage_dir -cf - $sliceimage | tar -C /vservers/.lvref -xf -
46 # we need a smarter way to handle upgrades
47 # the original code trashed the ref image that came with an rpm
48 # rm -rf /vservers/lxc-reference-${VERSION}.tgz
49 # this would probably cause the image to be re-created upon yum update
50 # or prevent updates to make it to the node ?
51 # rm -rf $sliceimage_dir/$sliceimage