Quoting Stéphane Graber ([email protected]):
> It's often been reported that the behavior of lxc-create without -t is a
> bit confusing. This change makes lxc-create require the --template
> option and introduces a new "none" special value which when set will
> fallback to the old template-less behavior.
> 
> Signed-off-by: Stéphane Graber <[email protected]>

Thanks, I definately like that better than having the act of
forgetting to specify a template be mistaken for a magic
special case.

nit below, but

Acked-by: Serge E. Hallyn <[email protected]>

> ---
>  doc/lxc-create.sgml.in |  1 +
>  src/lxc/lxc_create.c   | 10 +++++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/lxc-create.sgml.in b/doc/lxc-create.sgml.in
> index 03643c5..1c17c1a 100644
> --- a/doc/lxc-create.sgml.in
> +++ b/doc/lxc-create.sgml.in
> @@ -115,6 +115,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, 
> Boston, MA 02110-1301 USA
>           for details of the expected script structure.
>           Alternatively, the full path to an executable template script
>           can also be passed as a parameter.
> +         "none" can be used to force lxc-create to skip rootfs creation.
>         </para>
>       </listitem>
>        </varlistentry>
> diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c
> index eee6ffd..7de130d 100644
> --- a/src/lxc/lxc_create.c
> +++ b/src/lxc/lxc_create.c
> @@ -132,7 +132,7 @@ static struct lxc_arguments my_args = {
>       .progname = "lxc-create",
>       .helpfn   = create_helpfn,
>       .help     = "\
> ---name=NAME [-w] [-r] [-t template] [-P lxcpath]\n\
> +--name=NAME -t template [-w] [-r] [-P lxcpath]\n\
>  \n\
>  lxc-create creates a container\n\
>  \n\
> @@ -203,6 +203,14 @@ int main(int argc, char *argv[])
>               exit(1);
>       lxc_log_options_no_override();
>  
> +     if (!my_args.template) {

        Oh you went SO far over 80 chars you can't even hear us yelling
        at you to come back.

> +             fprintf(stderr, "A template must be specified.\nUse \"none\" if 
> you really want a container without a rootfs.\n");
> +             exit(1);
> +     }
> +
> +     if (strcmp(my_args.template, "none") == 0)
> +             my_args.template = NULL;
> +
>       memset(&spec, 0, sizeof(spec));
>       if (!my_args.bdevtype)
>               my_args.bdevtype = "_unset";
> -- 
> 1.9.0
> 
> _______________________________________________
> lxc-devel mailing list
> [email protected]
> http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to