[lxc-devel] More problems with command option conventions...

Stéphane Graber stgraber at ubuntu.com
Sun Feb 2 00:55:59 UTC 2014


On Sat, Feb 01, 2014 at 11:01:55AM -0500, Michael H. Warfield wrote:
> Hey all!
> 
> I've been helping someone by reviewing an article they're writing about
> LXC.  An issue just came up that point out a glaring inconsistency in
> our use of command option parameters in creating containers from
> templates.
> 
> In the templates, we're specifying the path to the container directory
> as "--path" or "-p".  But, in arguments.c, the same information is
> provided by -P (cap) or --lxcpath.  So one convention is used before the
> double dash "--" and a different convention after for the same
> information.
> 
> That's not good, is it???
> 
> Should we fix that inconsistency?  Which way?  Should that information
> be specified in that manner?  What would be the result of something like
> this:
> 
> lxc-create --lxcpath /var/lib/lxc -n foo -t fedora -- --path /srv/foobar

So I usually consider --name, --rootfs, --path and --mapped-uid to be
internal parameters of the templates which should never be passed by the
user as those are always passed by LXC directly to the template.

From the lxc-download help:
"""
LXC internal arguments (do not pass manually!):
[ --name <name> ]: The container name
[ --path <path> ]: The path to the container
[ --rootfs <rootfs> ]: The path to the container's rootfs
[ --mapped-uid <map> ]: A uid/gid map (user namespaces)
"""

So in short, --lxcpath != --path, --path is the path to the container's
config dir (e.g. /var/lib/lxc/p1/) and not the lxcpath (/var/lib/lxc/).

I think templates shouldn't be implementing short options for those 4 as
LXC always call them with their longname and they shouldn't be listed in
the help or only with a clear indication that they aren't to be passed
by the user (as I did in lxc-download).

> 
> Regards,
> Mike
> -- 
> Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
>    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
>    NIC whois: MHW9          | An optimist believes we live in the best of all
>  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
> 



> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140201/e2706def/attachment.pgp>


More information about the lxc-devel mailing list