[lxc-devel] [PATCH] Remove MAKEDEV call, add autodev hooks, add environment variables for hook scripts.

Serge Hallyn serge.hallyn at canonical.com
Wed Jan 9 21:26:49 UTC 2013


Quoting Michael H. Warfield (mhw at WittsEnd.com):
> Ok, all!
> 
> Here's the patch I promised Serge in the "[PATCH] Support MS_SHARED /"
> thread to address the mayhem that calling MAKEDEV was causing.
> 
> This is a straw-man patch.  This is the first patch I've submitted to
> this project but I plagerized like hell, so I hope I got the coding
> style matched.  Look it over and suggest changes.  It adds some features
> and changes some features.  If you don't like what I did, no problem.  I
> probably did somethings that some people may consider "suboptimal".  My
> feelings won't be hurt if you say so.
> 
> This patch does several things...
> 
> 1) Removes run_makedev() and the call to it from conf.c per discussion.
> 
> 2) Adds an lxc.hook.autodev hook.
> 
> Note: This hook is very close (one routine level abstracted) from where
> the run_makedev was called.  Anyone really rrreeeaaalllyyy needing
> MAKEDEV can add it in with a small shim script to do whatever they want
> under whatever distro they're using, so no functionality is lost there.
> 
> 3) Added a number of environment variables for all the hook scripts to
> reference to assist in execution.  Things like LXC_ROOTFS_MOUNT could be
> very useful but others were added as well.  Room for more if anyone has
> an itch.  All in one spot in lxc_start.c.
> 
> 4) clearenv and putenv( "container=lxc" ) calls were moved to just after
> the "start" hook in the container just prior to actually firing up the
> container so we could use environment variables prior to that and have
> them flushed them before firing up init.  Nice side effect is that you
> can define environment variables and then call lxc-start and have them
> show up in those hooks scripts.
> 
> 5) I actually DID update the man page for lxc.conf!  I guess I lied when
> I said I wouldn't get that done.
> 
> Now for the ugly side...
> 
> I don't think where I stuck all those "setenv" calls is the best place
> in lxc_start.c but it's where all the variables I needed where set in

Right, it should be done in start.c, since lxc-execute won't hit them
if they're in lxc-start.c

Perhaps you can get the logfile using readlink on
/proc/self/fd/$(lxc_conf->lxc_log_fd) ?  The rcfile could be
added to struct conf for you to use.

Other than that, patch looks great, thanks.

-serge




More information about the lxc-devel mailing list