Change lxc-create to add the name of the template and any parameters
to the container's configuration.
This makes it easier to debug and figure out exactly how a container was built.

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 src/lxc/lxc-create.in | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
index 30f0c22..391f1c3 100644
--- a/src/lxc/lxc-create.in
+++ b/src/lxc/lxc-create.in
@@ -281,7 +281,14 @@ if [ ! -r "$lxc_config" ]; then
     exit 1
 fi
 
-cp $lxc_config $lxc_path/$lxc_name/config
+if [ ! -z $lxc_template ]; then
+    echo "# Template used to create this container: $lxc_template" >> 
$lxc_path/$lxc_name/config
+    if [ -n "$*" ]; then
+        echo "# Parameters passed to the template: $*" >> 
$lxc_path/$lxc_name/config
+    fi
+fi
+
+cat $lxc_config >> $lxc_path/$lxc_name/config
 
 if [ -n "$custom_rootfs" ]; then
        if grep -q "lxc.rootfs" $lxc_path/$lxc_name/config ; then
-- 
1.8.0


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to