add vg and zfsroot options to lxc.functions and use in lxc-create

also make sure to drop spaces between = and variable in lxc.conf

Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
---
 src/lxc/lxc-create.in    |    3 ++-
 src/lxc/lxc.functions.in |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
index 3367a89..48c7a1e 100644
--- a/src/lxc/lxc-create.in
+++ b/src/lxc/lxc-create.in
@@ -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
diff --git a/src/lxc/lxc.functions.in b/src/lxc/lxc.functions.in
index aa5717d..416267f 100644
--- a/src/lxc/lxc.functions.in
+++ b/src/lxc/lxc.functions.in
@@ -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`
-- 
1.7.9.5


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to