Otherwise after cloning an lvm+xfs container you can't run the
original and clone at the same time.

Based on a patch by Maurizio Sambati posted at
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1013549

Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
---
 src/lxc/lxc-clone.in |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in
index c7413f2..13cb712 100644
--- a/src/lxc/lxc-clone.in
+++ b/src/lxc/lxc-clone.in
@@ -199,7 +199,13 @@ if [ -b $oldroot ]; then
         lxc-freeze -n $lxc_orig
         frozen=1
     fi
-    lvcreate -s -L $lxc_size -n ${lxc_lv_prefix}${lxc_new}_snapshot $oldroot
+    newlv="${lxc_lv_prefix}${lxc_new}_snapshot"
+    lvcreate -s -L $lxc_size -n $newlv $oldroot
+    type xfs_admin > /dev/null 2>&1 && {
+        # change filesystem UUID if it is an xfs filesystem
+        xfs_admin -u /dev/$lxc_vg/$newlv && xfs_admin -U generate 
/dev/$lxc_vg/$newlv
+    }
+            
     if [ $container_running = "True" ]; then
         lxc-unfreeze -n $lxc_orig
         frozen=0
-- 
1.7.9.5


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to