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

Michael H. Warfield mhw at WittsEnd.com
Sun Feb 2 02:02:35 UTC 2014


On Sat, 2014-02-01 at 19:55 -0500, Stéphane Graber wrote: 
> 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)
> """

Ok...  But lxc-download is relatively new.  Where is this documented at?
I was not aware of this and almost every template is implementing a
short option for it and most of them have it listed in the help section.
I picked up the Fedora template and added the CentOS template but didn't
have any guidance beyond what was in the existing templates.

> 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/).

Hmmm...  I'm going to have to confirm that's what I've got although that
would probably explain a change I had to make in the Fedora template
when I started working on it ages ago as it was using
${path}/name/rootfs and that was resulting
in /var/lib/lxc/${name}/${name}/rootfs which I fixed way back then.  I
even think Serge questioned my change but it was then congruent with
other containers and working properly.  That makes a lot more sense now.

> 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).

It definitely has short options and is listed in the help for the
CentOS, Fedora, and Oracle templates.  Even the ubuntu template lists
--rootfs in its help and there are short options for path and name,
though I don't see any of the others.

> > 
> > 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
> 
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140201/f94d34f4/attachment.pgp>


More information about the lxc-devel mailing list