Commit 93f29214 by Serge Hallyn Committed by Daniel Lezcano

lxc-clone: maintain size of lvm snapshot

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 96bd45c8
......@@ -50,7 +50,8 @@ localstatedir=@LOCALSTATEDIR@
lxc_path=@LXCPATH@
bindir=@BINDIR@
snapshot=no
lxc_size=2G
lxc_defsize=2G
lxc_size=_unset
lxc_vg=lxc
lxc_lv_prefix=""
fstype=ext3
......@@ -199,6 +200,9 @@ if [ -b $oldroot ]; then
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment