When creating a container as lvm snapshot, use the original size unless
user explicitly overrides it.
It's all well and good to day "use lvextend if you run out of space", but
in the meantime applications may become corrupted...
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
lxc_path=@LXCPATH@
bindir=@BINDIR@
snapshot=no
-lxc_size=2G
+lxc_defsize=2G
+lxc_size=_unset
lxc_vg=lxc
lxc_lv_prefix=""
fstype=ext3
lxc-freeze -n $lxc_orig
frozen=1
fi
+ if [ $lxc_size = "_unset" ]; then
+ lxc_size=`lvdisplay $oldroot | grep Size | awk '{ print $3 $4 }'`
+ fi
lvcreate -s -L $lxc_size -n ${lxc_lv_prefix}${lxc_new}_snapshot $oldroot
if [ $container_running = "True" ]; then
lxc-unfreeze -n $lxc_orig