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.hallyn@ubuntu.com>
This commit is contained in:
Serge Hallyn 2013-04-29 14:50:30 +02:00
parent 31a95fecd2
commit 1e1bb42a8f
2 changed files with 22 additions and 1 deletions

View 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

View 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`