[lxc-devel] [PATCH] lxc-create: Store template information in config
Stéphane Graber
stgraber at ubuntu.com
Thu Nov 29 22:25:30 UTC 2012
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 <stgraber at 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
More information about the lxc-devel
mailing list