]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add vg and zfsroot options to lxc.functions and use in lxc-create
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 29 Apr 2013 12:50:30 +0000 (14:50 +0200)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 30 Apr 2013 14:14:34 +0000 (09:14 -0500)
also make sure to drop spaces between = and variable in lxc.conf

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc-create.in
src/lxc/lxc.functions.in

index 1858c119a4403ef42cbf2f6357da77812428639b..286ed6a0047cdbe4da4187208d376adaa9de17f5 100644 (file)
@@ -134,7 +134,8 @@ optarg_check() {
 backingstore=_unset
 fstype=ext4
 fssize=500M
-vgname=lxc
+vgname=$lxc_vg
+zfsroot=$lxc_zfsroot
 custom_rootfs=""
 
 while [ $# -gt 0 ]; do
index aa5717d0becc30e2b033fc97b6838a15d88ca845..416267f74f1403e95f1927e79f3e164c8a830097 100644 (file)
@@ -34,4 +34,24 @@ get_default_lxcpath() {
        fi
 }
 
+get_default_vg() {
+       LXC_VG=$(grep -v "^#" "$globalconf" 2>/dev/null | grep "[ \t]*lvm_vg[ \t]*=") || true
+       if [ -n "$LXC_VG" ]; then
+               echo $LXC_VG | awk -F= '{ print $2 }'
+       else
+               echo "lxc"
+       fi
+}
+
+get_default_zfsroot() {
+       LXC_ZFSROOT=$(grep -v "^#" "$globalconf" 2>/dev/null | grep "[ \t]*zfsroot[ \t]*=") || true
+       if [ -n "$LXC_ZFSROOT" ]; then
+               echo $LXC_ZFSROOT | awk -F= '{ print $2 }'
+       else
+               echo "tank/lxc"
+       fi
+}
+
 lxc_path=`get_default_lxcpath`
+lxc_vg=`get_default_vg`
+lxc_zfsroot=`get_default_zfsroot`