[lxc-devel] [PATCH] lxc-create: Store template information in config
Serge Hallyn
serge.hallyn at canonical.com
Fri Nov 30 13:56:13 UTC 2012
Quoting Stéphane Graber (stgraber at ubuntu.com):
> 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
What do you think about also storing the sha1sum of the template?
That way we can perhaps figure out whether a container was created
by a known buggy version of a template. (Or we could add version
numbers and ask distros to adhere to an agreed upon versioning
scheme)
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list