[lxc-devel] Bug or design in lxc-autostart - related: multiple lxc container path directories?

Michael H. Warfield mhw at WittsEnd.com
Sun Jun 8 21:48:52 UTC 2014


Ok...

After responding to Harald Dunkel about implementing lxcpath as a real
colon separated path, I started looking at the code again.  This
actually looks very doable and not nearly as complicated as I had
originally presupposed.  Much of the code is already there supporting an
array of directories, it's just hard coded to only reference the first
element for most apps (exception lxc-monitor).  It just needs some
iterators and the parser is almost a no-brainer given we can handle
multiple -P options already in the arguments code.

I did run into a surprising peculiarity in lxc-autostart, though (which
will probably be the toughest app to deal with for a multipath).  It
seems to only use the -P option to initialize the logs and then
unconditionally uses the global lxc.lxcpath config variable to search
for containers.

In main, initialize the logs then list the defined containers:

-- 
         if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
                         my_args.progname, my_args.quiet, my_args.lxcpath[0]))
                return 1;
        lxc_log_options_no_override();

        count = list_defined_containers(NULL, NULL, &containers);

-- 

That first NULL to "list_defined_containers" is suppose to be the
lxc_path, if defined.  If it's null, the function grabs the global
variable.

-- 
int list_defined_containers(const char *lxcpath, char ***names, struct lxc_container ***cret)
{
        DIR *dir;
        int i, cfound = 0, nfound = 0;
        struct dirent dirent, *direntp;
        struct lxc_container *c;

        if (!lxcpath)
                lxcpath = lxc_global_config_value("lxc.lxcpath");

        dir = opendir(lxcpath);
-- 

Is that what was intended?  Seems very strange that -P would only affect
the logs and not the search/list path.

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!

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


More information about the lxc-devel mailing list